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

ROS2 Multicast works but nodes can't communicate or see each other over multiple machines

asked 2022-08-24 04:46:35 -0500

ThomasCairnes gravatar image

I'm trying to get a ROS2 system working across a few machines using some Raspbery Pi 4's. I'm on Ubuntu 22.04 LTS and am using ROS2 Humble. The kernel version on the host machine is 5.15.0-46-generic and the kernel version on the raspberry pi is 5.15.0-1013-raspi.

I install Ubuntu 22 server onto the Raspberry PI then ssh into it via WiFi to configure a user and install ROS2. I go through all the steps of setting up an environment, I make sure the setup.bash file is correctly sourced and that the machines share the same ROS_DOMAIN_ID (default in this case). I make no changes to the DDS implementation.

I then follow advice in the troubleshooting section of the documentation and I update my firewall to allow multicast UDP messages. I tested this using multicast send and multicast receive and confirmed that ros2 instances on the same machine can see each other as well as receive multicast UDP messages across the WiFi network from the Raspberry Pi. So in theory the instances of ROS2 across the two machines should be able to see each other but running ros2 run demo_nodes_cpp talker & ros2 run demo_nodes_cpp listener only works locally. Only the talker and listener on the Pi can see each other and the same goes for my main machine.

What I've Tried:

  1. Setting Static IPs - The Pi has a static IP that it will always be at, it seems to have made no difference other than making logging in by ssh more convenient.
  2. Change DDS Implementation - I followed advice here and attempted to change the DDS implementation on both machines to Cyclone but that makes no difference either. The user on the Pi is technically a different user so I thought this may work but no change.
  3. I've Reflashed the Pi and reinstalled ROS2 several times over - It has made no difference.
  4. Check that multicast is enabled - I've used ifconfig to double check and used ufw to provide a route for multicast traffic as per the documentations suggestion. It's resulted in the multicast tool working but that's it.
  5. Try an ethernet connection instead - I've connected a network switch to my host machine and the pi and a similar issues occurs. I can force the use of the ethernet connection and multicast works but regular nodes can't communicate at all.

All packages are the latest versions and up to date. Unsure what to attempt next, I've been through every suggestion I can find and it all points to getting multicast working then it should just work, so the fact that multicast is working but still unable to communicate across machines has gotten me stuck. There aren't really any error logs or messages for me to share because it's not producing errors, it's simply not working as intended.

edit retag flag offensive close merge delete

Comments

Are all your hosts using a service to keep an precise time-of-day? systemd-timesyncd is the one most commonly used. Your subnet will need access to the internet (unless you are running your own NTP server locally.)

Mike Scheutzow gravatar image Mike Scheutzow  ( 2022-09-10 11:04:43 -0500 )edit

All hosts are using timedatectl (which i believe is built on top of systemd-timed) to handle timezone configuration while an NTP server on the main host machine is connected to each pi. The actual subnet is an ethernet LAN with no internet access but the host machine does have internet access so that it is in time sync.

I have considered disabling the hotplugging behaviour on the Pi's so that they can maintain a wifi connection while the ethernet connection is active however I'm not sure what difference that would make if they're being kept in sync with a machine that has an internet connection anyway.

ThomasCairnes gravatar image ThomasCairnes  ( 2022-09-10 13:09:24 -0500 )edit

2 Answers

Sort by ยป oldest newest most voted
0

answered 2022-09-09 04:36:08 -0500

ThomasCairnes gravatar image

updated 2022-09-19 02:59:31 -0500

UPDATE: This isn't much of an answer but I've managed to reverse the issue that I now have.

After messing around with a router and ufw and making sure that traffic from the IP subnet the Pi is on is allowed into the host machine I've now run into a problem where nodes can now see and talk to each other but the specific multicast send and multicast receive no longer work?

I used the router to assign static IPs to the Pi and Host machines then used ufw on the host machine like so: sudo ufw allow 192.168.0.0/24 to allow all incoming and outgoing traffic in the IP subnet 192.168.0.0 to 192.168.0.254

Doing the same on the Pi has no effect, still in a situation where topics and nodes can now see each other but the multicast package doesn't work. If demo_nodes talker and listener can see each other I assume multicast is actually working, so it's strange that ros2 multicast send isn't.

I haven't marked this as an answer because ideally a proper solution would allow the nodes to see each other and leave the multicast tool working.

edit flag offensive delete link more

Comments

Hello, I ran across a similar issue and also struggled with firewall, rmw, etc but finally found out that ROS_LOCALHOST_ONLY was set to 1. Exporting it to 0 (which is the default) solved it, evidently.

In case you missed that... hope this helps.

P gravatar image P  ( 2023-02-07 15:38:52 -0500 )edit

Hi,

I double checked and ROS_LOCALHOST_ONLY was set to its default on all machines. I'm still stuck with the problem for now but my ros packages can communicate fine with each other using the solution I've already gone through. The weird thing about it is just the fact that the specific multicast send package doesn't seem to work, despite other ros packages communicating over the network fine.

ThomasCairnes gravatar image ThomasCairnes  ( 2023-02-09 08:03:16 -0500 )edit
0

answered 2023-07-02 02:45:05 -0500

achmad_fathoni gravatar image

In my case I just need to set export RMW_IMPLEMENTATION=rmw_fastrtps_cpp. I know it is weird since the docs states that eProsima is the default DDS. Source

edit flag offensive delete link more

Question Tools

2 followers

Stats

Asked: 2022-08-24 04:46:35 -0500

Seen: 1,278 times

Last updated: Jul 02 '23