Skip to content

Instantly share code, notes, and snippets.

@gianpiero
Created September 8, 2016 18:56
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save gianpiero/2977a4b7e03068d21090579458fb32e8 to your computer and use it in GitHub Desktop.
Save gianpiero/2977a4b7e03068d21090579458fb32e8 to your computer and use it in GitHub Desktop.
<?xml version="1.0"?>
<!--
(c) 2005-2015 Copyright, Real-Time Innovations, Inc. All rights reserved.
RTI grants Licensee a license to use, modify, compile, and create derivative
works of the Software. Licensee has the right to distribute object form only
for use with RTI products. The Software is provided "as is", with no warranty
of any type, including any warranty for fitness for any purpose. RTI is under
no obligation to maintain or support the Software. RTI shall not be liable for
any incidental or consequential damages arising out of the use or inability to
use the software.
-->
<dds xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="http://community.rti.com/schema/5.1.0/rti_dds_profiles.xsd" version="5.1.0">
<!-- Qos Library -->
<qos_library name="QosLibrary">
<qos_profile name="DefaultProfile" is_default_qos="true">
<participant_qos>
<transport_builtin>
<mask>UDPV4 | SHMEM</mask>
</transport_builtin>
<!-- Turn on monitoring -->
<!-- Begin Monitoring
<property>
<value>
<element>
<name>rti.monitor.library</name>
<value>rtimonitoring</value>
</element>
<element>
<name>rti.monitor.create_function_ptr</name>
<value>$(NDDS_MONITOR)</value>
</element>
</value>
</property>
End Monitoring -->
</participant_qos>
</qos_profile>
</qos_library>
<!-- types -->
<types>
<struct name="ShapeType" extensibility="extensible">
<member name="color" stringMaxLength="128" id="0" type="string" key="true"/>
<member name="x" id="1" type="long"/>
<member name="y" id="2" type="long"/>
<member name="shapesize" id="3" type="long"/>
</struct>
<enum name="ShapeFillKind" extensibility="extensible">
<enumerator name="SOLID_FILL" value="0"/>
<enumerator name="TRANSPARENT_FILL" value="1"/>
<enumerator name="HORIZONTAL_HATCH_FILL" value="2"/>
<enumerator name="VERTICAL_HATCH_FILL" value="3"/>
</enum>
<struct name="ShapeTypeExtended" baseType="ShapeType" extensibility="extensible">
<member name="fillKind" id="4" type="nonBasic" nonBasicTypeName="ShapeFillKind"/>
<member name="angle" id="5" type="float"/>
</struct>
</types>
<!-- Domain Library -->
<domain_library name="MyDomainLibrary">
<domain name="MyDomain" domain_id="0">
<register_type name="ShapeType" kind="dynamicData" type_ref="ShapeType" />
<topic name="Square" register_type_ref="ShapeType"/>
</domain>
<domain name="MyDomainOne" domain_id="1">
<register_type name="ShapeType" kind="dynamicData" type_ref="ShapeType" />
<topic name="Square" register_type_ref="ShapeType"/>
</domain>
</domain_library>
<!-- Participant library -->
<participant_library name="MyParticipantLibrary">
<domain_participant name="Zero" domain_ref="MyDomainLibrary::MyDomain">
<publisher name="MyPublisher">
<data_writer name="MySquareWriter" topic_ref="Square" />
</publisher>
<subscriber name="MySubscriber">
<data_reader name="MySquareReader" topic_ref="Square" />
</subscriber>
</domain_participant>
<domain_participant name="One" domain_ref="MyDomainLibrary::MyDomainOne">
<publisher name="MyPublisher">
<data_writer name="MySquareWriter" topic_ref="Square" />
</publisher>
<subscriber name="MySubscriber">
<data_reader name="MySquareReader" topic_ref="Square" />
</subscriber>
</domain_participant>
</participant_library>
</dds>
##############################################################################
# Copyright (c) 2005-2015 Real-Time Innovations, Inc. All rights reserved.
# Permission to modify and use for internal purposes granted.
# This software is provided "as is", without warranty, express or implied.
##############################################################################
import sys
import os
filepath = os.path.dirname(os.path.realpath(__file__))
sys.path.append(filepath + "/../../../");
import time
import rticonnextdds_connector as rti
connector = rti.Connector("MyParticipantLibrary::Zero", filepath + "/../ShapeExample.xml");
output = connector.getOutput("MyPublisher::MySquareWriter")
connectorOne = rti.Connector("MyParticipantLibrary::One", filepath + "/../ShapeExample.xml");
outputOne = connectorOne.getOutput("MyPublisher::MySquareWriter")
for i in range(1,500):
output.instance.setNumber("x", i);
output.instance.setNumber("y", i);
output.instance.setNumber("shapesize", i);
output.instance.setString("color", "BLUE");
output.write();
outputOne.instance.setNumber("x", i*2);
outputOne.instance.setNumber("y", i*2);
outputOne.instance.setNumber("shapesize", i*2);
outputOne.instance.setString("color", "RED");
outputOne.write();
time.sleep(2)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment