Communication of ROS2 with the DDS-Space/RTPS

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

ToRaVe gravatar image

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

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 imagegvdhoorn ( 2018-10-23 05:17:37 -0600 )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 imagerhogan ( 2019-10-03 16:08:19 -0600 )edit