ROS Resources: Documentation | Support | Discussion Forum | Index | Service Status | ros @ Robotics Stack Exchange
Ask Your Question

Communicating With Two Machines With ROS2

asked 2022-03-31 09:06:21 -0500

Jacob G. gravatar image

updated 2022-03-31 09:07:26 -0500

I'm trying to start up communication between two machines running ROS2 Galactic using the examples:

ros2 run demo_nodes_cpp talker


ros2 run demo_nodes_cpp listener
  • Both machines are on the same network,
  • Both machines have multicasting enabled
  • Both machines can ping each other
  • Both machines have the same netmask
  • I have also tried running the examples on different networks with no success
  • Both machines have "export ROS_DOMAIN_ID=30" in their .bashrc

When running the two example nodes on the same machine everything works fine.

Please tell if you need any more info.

Any help would be greatly appreciated!

edit retag flag offensive close merge delete

2 Answers

Sort by ยป oldest newest most voted

answered 2022-04-13 03:42:59 -0500

Jacob G. gravatar image

Thanks a lot for the answer! I tried out the different RMWs but nothing seemed to work. Those things didn't fix it for me.

Instead the problem was solved by: 1. Switching to a different network. (I was on a network with extra security layers that might have messed with the communication). 2. The firewall on my two machines were blocking the communication. - As a quick fix you can disable firewall by using the following command:

sudo ufw disable

You can check the status of your firewall do typing:

sudo ufw status

It is not recommended to have your firewall disabled at all times however, so only use this as a way to test if it is the firewall that is the problem.

edit flag offensive delete link more


Hello, Is there a way to keep the firewall on and to configure the network to allow the topics to pass ?

Sam_Prt gravatar image Sam_Prt  ( 2022-10-11 03:38:35 -0500 )edit

answered 2022-03-31 10:04:08 -0500

ljaniec gravatar image

Which RMW implementation do you use?

I got better results with Fast RTPS on 2 AWS instances for connecting nodes and their topics. There is more documentation about its configuration too.

edit flag offensive delete link more

Question Tools

1 follower


Asked: 2022-03-31 09:06:21 -0500

Seen: 437 times

Last updated: Apr 13 '22