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

ROS2 Multicast not working between remote pc's?

asked 2019-09-10 11:13:42 -0500

Felipe gravatar image

updated 2019-09-10 11:14:02 -0500


I am currently running ROS2 DD Patch 2. I have followed these instructions here to set it between a raspberry pi running ubuntu mate, and a remote pc:

My remote PC is running a VM with my ros2 code.

When I try to connect them through Multicast UDP, nothing happens.

When i run ros2 multicast send and ros2 multicast receive then cannot find each other either, even being on the same network. My firewalls are disabled on both devices. I am using fast_rtps.

Any suggestions for getting Multicasting in ROS2 working would be great!

edit retag flag offensive close merge delete


Can you ping each way?

Tav_PG gravatar image Tav_PG  ( 2019-10-02 23:34:44 -0500 )edit

1 Answer

Sort by ยป oldest newest most voted

answered 2020-09-18 07:24:16 -0500

nyquist09 gravatar image

Generally, mutlicast adresses are a special type of IP addresses as they don't address devices directly. This means, that a network stack does not know on which network segment the multicast packets are supposed to go out.

As an example: you might have two interfaces:

eth0 on subnet
wlan0 on subnet

So if you want to publish a message to a multicast address, e.g., the network stack does not know on which interface to publish. It might even be, that some multicast adresses go on one interface, and others on the other interface. It will just choose one (your default route).

You need to tell your stack which one to use. In your case, it might work to just set a route for all multicast traffic on the interface were your remote ROS PC is located, using the route command like this

route add netmask dev eth0

(assuming the ROS peer is on eth0). This adds a routing entry, that multicast is always routed via eth0. You have to make sure the routes are correct on both machines.

As a very quick solution: you can disable all but interfaces but the one over which ROS is communicating. Do this on both PCs. Then the network stack will chose the only interface that is up for multicast traffic

edit flag offensive delete link more

Question Tools



Asked: 2019-09-10 11:13:42 -0500

Seen: 3,068 times

Last updated: Sep 18 '20