Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

@gianpiero
Created August 28, 2018 18:53
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/fd6735d53c5c316a6e227d89dbb2531f to your computer and use it in GitHub Desktop.
Save gianpiero/fd6735d53c5c316a6e227d89dbb2531f to your computer and use it in GitHub Desktop.
extremely-slow-functions-rti-connext-python-connector
<?xml version="1.0" encoding="UTF-8"?>
<!--
(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>
<!-- types -->
<types>
<struct name="InnerType">
<member name="id_" type="int32"/>
<member name="x_" type="int32"/>
<member name="y_" type="int32"/>
<member name="v_rad_" type="int32"/>
<member name="a_rad_" type="int32"/>
</struct>
<struct name="ShapeType" extensibility="extensible">
<member name="id_" type="int32"/>
<member name="objects_" type="nonBasic" nonBasicTypeName="InnerType" sequenceMaxLength="10"/>
</struct>
</types>
<!-- Qos Library -->
<qos_library name="QosLibrary">
<qos_profile name="DefaultProfile" base_name="BuiltinQosLibExp::Generic.StrictReliable" is_default_qos="true">
<participant_qos>
<transport_builtin>
<mask>UDPV4 | SHMEM</mask>
</transport_builtin>
</participant_qos>
</qos_profile>
<!-- 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 -->
</qos_library>
<!-- Domain Library -->
<domain_library name="MyDomainLibrary">
<domain name="MyDomain" domain_id="0">
<register_type name="ShapeType" type_ref="ShapeType"/>
<topic name="Square" register_type_ref="ShapeType"/>
</domain>
</domain_library>
<!-- Participant library -->
<domain_participant_library name="MyParticipantLibrary">
<domain_participant name="PubProfile" domain_ref="MyDomainLibrary::MyDomain">
<publisher name="MyPublisher">
<data_writer name="MySquareWriter" topic_ref="Square"/>
</publisher>
</domain_participant>
<domain_participant name="SubProfile" domain_ref="MyDomainLibrary::MyDomain">
<subscriber name="MySubscriber">
<data_reader name="MySquareReader" topic_ref="Square"/>
</subscriber>
</domain_participant>
</domain_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.
##############################################################################
"""Samples's writer."""
from sys import path as sysPath
from os import path as osPath
from time import sleep
import time
filepath = osPath.dirname(osPath.realpath(__file__))
sysPath.append(filepath + "/../../../")
import rticonnextdds_connector as rti
connector = rti.Connector("MyParticipantLibrary::PubProfile",
filepath + "/ShapeExample.xml")
outputDDS = connector.getOutput("MyPublisher::MySquareWriter")
a = 1
b = 2
c = 3.3
d = 4.3
e = 5.3
f = 6.3
times=[]
times.append( time.clock())
outputDDS.instance.setNumber("id_",a)
times.append( time.clock())
outputDDS.instance.setNumber("objects_[1].id_",b)
times.append( time.clock())
outputDDS.instance.setNumber("objects_[1].x_",c)
times.append( time.clock())
outputDDS.instance.setNumber("objects_[1].y_",d)
times.append( time.clock())
outputDDS.instance.setNumber("objects_[1].v_rad_",e)
times.append( time.clock())
outputDDS.instance.setNumber("objects_[1].a_rad_",f)
times.append( time.clock())
outputDDS.write()
times.append( time.clock())
outputDDS.write()
for x in range(len(times)):
# print ( "Timestep: " + str(x) +": " + str(times[x]-times[0]))
print (str(times[x]-times[0]))
times = []
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment