Publishing Objects/sequence through RTI connector to ROS2

asked 2018-08-03 09:30:28 -0600

aks gravatar image

I am interfacing ROS2 with native RTI DDS Connector for python where I am publishing messages in RTI connector and subscribing in ROS2.

I have the following message structure for the message named DetectedObjectList :

int16 id

//an array of objects of another message type

DetectedObject[ ] objects

This is interpreted as unbounded sequences in IDL.

another message named DetectedObject :

int16 id

string name

int16 x

int16 y

Lets say the topic the are communicating is called objects and the message type is DetectedObjectList

Since the subscriber in ROS2 is subscribing to id of type int16 and objects of type DetectedObject[ ] .

How can I publish an object from RTI connector ?

A usual flow in RTI Connector is :

get an instance of the output :

output = connector.getOutput("MyPublisher::MyDataWriter")

and the post an instance :

output.instance.setNumber("id", 5)
output.write()

Now how can I write an object of type DetectedObject instead of setNumber ?

edit retag flag offensive close merge delete