Communication of ROS2 with the DDS-Space/RTPS

asked 2018-10-23 05:02:40 -0500

ToRaVe gravatar image

updated 2018-10-23 05:40:55 -0500

I try to set up a communication between ROS2 and C-based RTPS-Stack. That way, I want to exchange information.

How I try:

In ROS2, I have defined a my_msg_type.msg, which consists of a single float. The file looks like this:

float32 f_time_stamp

and that's it. Based on this, I implemented a simple Publisher and a Subscriber and gave them a topic name: my_topic. They work perfectly fine together. ROS2 is - as far as i know - running on default settings, so it should be using the rmw_fastrtps_cpp middleware implementation.

On the opposite end, I am using the Micro-XRCE-DDS-Client ( https://github.com/eProsima/Micro-XRC... ) in combination with the Micro-XRCE-DDS-Agent ( https://github.com/eProsima/Micro-XRC... ), which are supposed to work together. Here I defined my message type in an .idl, which looks like this:

struct my_msg_type { float f_time_stamp; };

From this, I built simple Publishers and Subscribers, using Micro-XRCE-DDS-Agent ( https://github.com/eProsima/Micro-XRC... ). I adjusted the topic and message type according to the ROS2 mappings to rt/my_topic and my_pkg/my_msg_type respectively. They also work perfectly well together and all data sent by the publisher reaches the subscriber.

What doesn't work:

Now when I am trying to let the Micro-XRCE-DDS Stack communicate with ROS2, both sides seem to have problems. When I try to listen to the topic using ros2 topic echo /my_topic, it says

Cannot echo topic '/my_topic', as it contains more than one type: [my_pkg/my_msg_type, my_pkg/my_msg_type]

So I guess that I must have gone wrong somewhere in the type definitions or that they are changing somewhere on their journey.

The header-file produced from my .msg in ROS2 contains

typedef struct my_pkg__msg__my_msg_type { float f_time_stamp; } my_pkg__msg__my_msg_type;

while the header-file produced by the Micro-XRCE-DDS-Agent contains

typedef struct my_msg_type { float f_time_stamp; } my_msg_type;

I tried changing the struct's name in the latter header-file, so it reads the same as in the header produced by ROS2, but it changed nothing on the behaviour.

Any help and idea is greatly appreciated

edit retag flag offensive close merge delete

Comments

So I guess that I must have f* up somewhere [..]

really?

gvdhoorn gravatar image gvdhoorn  ( 2018-10-23 05:17:37 -0500 )edit

Hello,

Have you, or has anyone else reading this, been able to find a solution for this type of communication between ROS2 and DDS and can point me in the right direction?

rhogan gravatar image rhogan  ( 2019-10-03 16:08:19 -0500 )edit

I would set-up a wireshark according to https://community.rti.com/downloads/rti-wireshark So that it's easier to see what the rtps layer is doing. If I were to hazard a guess, the rtps type names are mis-matched. Note that at the rtps layer, ros2 topics look more like my_pkg::dds_::my_msg_type_.

I would stop both ros2 and micro-xrce-dds-agent nodes, start wireshark recording, then start the nodes again in order to capture the discovery process, wait 10-20 seconds, then stop wireshark.

After you have the capture, you'll want to look for the topic discovery packets. Inside, you'll see information about the topic qos settings, type, topic, partition, etc. If you see things that don't match between the ros2 subscriber and the dds agent, then that's where you should focus.

ChuiV gravatar image ChuiV  ( 2021-10-06 09:04:33 -0500 )edit