Ask Your Question

How ROS2 communication is done between two nodes over DDS?

asked 2021-12-02 06:47:21 -0500

sumit.paul gravatar image

Hi, I am a newbie in the ROS2 paradigm. I have Ubuntu 20.04 and ROS2 Foxy installed on it. I am able to communicate among nodes via publishing/subscribing topics and services. I have read the documentation about default DDS in ROS2. I have also read about, how to create a fast DDS publisher and subscriber, as well as the topic name mapping between ROS2 and DDS.

But I am still unable to understand how can I communicate between two nodes over DDS? Do I need a discovery server?

What steps should I follow to communicate via a topic between two nodes?


  1. As DDS follows idl format for messages, how msg and srv files will be translated to dds?
  2. There is also an integer domain_value to set up the availability among publishers and subscribers. How can I set domain values?
  3. Will publishing and subscribing to DDS topics follow the same procedure as ROS2 topics?
edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted

answered 2021-12-29 04:01:41 -0500

sumit.paul gravatar image

A newbee like me might find this answer helpful.

After some debugging I have figured out the way to communicate different nodes over dds. RMW_IMPLEMENTATION=rmw_fastrtps_cpp ROS_DOMAIN_ID=<id> ros2 run <package> <application> This will run the ROS2 node on the fastrtps DDS. To establish pub/sub communication between two nodes we have to use the same ROS_DOMAIN_ID. As fastrtps is the default dds middleware for ROS2 so we do not have to install it seperately. If anyone has to use other dds middleware he/she has to download the desired dds middleware and replace it in the RMW_IMPLEMENTATION=<desired_dds>

If the ROS2 nodes are in different DOMAIN, then Integration-service is there to save us. Please check this links. ROS2-FASTDDS, Integration-Service, ROS2-Different-Domain-Communication

The transformation of ROS2 topic and DDS idl are handled by the integration-service. This example can be a good starting point.

If anyone has to compile their own ROS2 msg/service/interfaces and generate mix files to use in the integration-service please check this, ROS2-System-handle.

edit flag offensive delete link more

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools

1 follower


Asked: 2021-12-02 05:03:43 -0500

Seen: 105 times

Last updated: Dec 29 '21