ROS2 Multicast not working between remote pc's?
Hello,
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: http://emanual.robotis.com/docs/en/platform/turtlebot3/ros2/
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!
Asked by Felipe on 2019-09-10 11:13:42 UTC
Answers
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 192.168.1.0/24
wlan0 on subnet 172.16.1.0/24
So if you want to publish a message to a multicast address, e.g. 239.140.0.1, 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 224.0.0.0 netmask 240.0.0.0 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
Asked by nyquist09 on 2020-09-18 07:24:16 UTC
Comments
Can you ping each way?
Asked by Tav_PG on 2019-10-02 23:34:44 UTC