1
$\begingroup$

I have a question regarding ROS2 data exchange over the network.

Let’s assume, I have two hosts that are running some ros nodes over the same network, using ROS_DOMAIN_ID=0, so I broadcast all topics. If, from host1, I list all the topics I can see the topics used by host1 and host2. Does that mean that the data/msgs are exchanged over the network? Or are the data published only when there is a subscriber to a certain topic?

My understanding is that data are published only when the latter happens, i.e. there is a subscriber from host1 to host2.

If that is the case, now let’s assume that on host1 I have two nodes that exchange some data subscribing and publishing over a topic that is used only by host1, not host2. Is this data published over the common network or do they remain local to localhost to ?

$\endgroup$

3 Answers 3

1
$\begingroup$

Ciao Filippo, when it comes to ROS2, the underlying communication system relies on a DDS implementation: the nodes go through a "discovery process" to "find each other". For the latest ROS2 releases, this is the default DDS implementation. If you are interested about what happens at the very low level in this or other cases, you might want to use a tool like this. Hope it answers/helps your question.

$\endgroup$
4
  • $\begingroup$ Thanks for the answer, but no that didn't much help, I'm sorry. I'd like to know when topics with their data are published over the network and when instead they are kept local to the host. That is because I'm trying to minimize the data exchanged over the network when multiple hosts are part of it. So for instance, I have a topic on host1 that nobody subscribes to, are those data still published over the network? $\endgroup$ Nov 9, 2023 at 13:25
  • $\begingroup$ Or, if internally on host1, a node subscribes to a certain topic where another node on the same host is publishing, are those data published over the network, or are they managed internally over the localhost? $\endgroup$ Nov 9, 2023 at 13:28
  • $\begingroup$ Try to take a look here: fast-dds.docs.eprosima.com/en/latest/fastdds/discovery/… In relation to fast-dds, the nodes first they discovery each other, and by doing that they will send multi-cast or unicast messages depending on the DDS configuration. When the topic(s) will match then the nodes will start to "talk directly". So all in all depends on your discovery method. Take a look here, you might want to take a look to the discovery server (fast-dds.docs.eprosima.com/en/latest/fastdds/ros2/…). $\endgroup$
    – modo
    Nov 9, 2023 at 20:54
  • $\begingroup$ Here you have some examples with discovery server: robotics.stackexchange.com/questions/104468/… $\endgroup$
    – modo
    Nov 9, 2023 at 20:55
1
$\begingroup$

I can't speak for all DDS implementations, but I investigated the network traffic between two running ROS 2 nodes using CycloneDDS using wireshark, and as far as I can tell, if there is not a subscriber on the remote computer, the topics are not transmitted over the network. Likewise, data exchanged exclusively between nodes on one computer is not sent over the network at all.

$\endgroup$
0
$\begingroup$

Source it : source export ROS_DOMAIN_ID = 1 (int unique num) save it and check ros2 topic list. if host 1 and host 2 exports same number. it shown the topic otherwise not shown.

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.