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

How to enable UDP multicast communication?

asked 2023-01-17 12:48:45 -0600

andi gravatar image

updated 2023-01-19 11:19:37 -0600

Hi all, i'm having a really bad time with ROS2 communication between 2 machines: 1. my laptop where i run a VM with ubuntu focal ( ip 192.168.1.24) 2. Raspi 4 with Ubuntu focal as well running ROS2 (ip 192.168.1.42) I set the ROS_DOMAIN_ID=5 on both machines. The problem is that when i try to make a communication between the 2, ie running a listener node on Raspi and a talker node on the VM, nothing happens! Neither when i run the ros2 multicast send / receive doesn't give any responses!! Surfing on internet, i found that it might be a UDB multicast communication problem, but unfortunately i didn't found any solutin!! Any ideas? Thanks.

This is the ip addr on the VM:

   andi@andi-vm:~$ ip addr
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN group default qlen 1000
    link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
    inet 127.0.0.1/8 scope host lo
       valid_lft forever preferred_lft forever
    inet6 ::1/128 scope host 
       valid_lft forever preferred_lft forever
2: enp0s3: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc fq_codel state UP group default qlen 1000
    link/ether 08:00:27:14:e4:9a brd ff:ff:ff:ff:ff:ff
    inet 10.0.2.15/24 brd 10.0.2.255 scope global dynamic noprefixroute enp0s3
       valid_lft 86173sec preferred_lft 86173sec
    inet6 fe80::5ae5:7f99:50fa:1e8d/64 scope link noprefixroute 
       valid_lft forever preferred_lft forever

and this is on the Raspi:

andi@andi-raspi:~$ ip addr
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN group default qlen 1000
    link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
    inet 127.0.0.1/8 scope host lo
       valid_lft forever preferred_lft forever
    inet6 ::1/128 scope host 
       valid_lft forever preferred_lft forever
2: eth0: <NO-CARRIER,BROADCAST,MULTICAST,UP> mtu 1500 qdisc mq state DOWN group default qlen 1000
    link/ether dc:a6:32:e9:fa:20 brd ff:ff:ff:ff:ff:ff
3: wlan0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc fq_codel state UP group default qlen 1000
    link/ether dc:a6:32:e9:fa:21 brd ff:ff:ff:ff:ff:ff
    inet 192.168.1.42/24 brd 192.168.1.255 scope global dynamic noprefixroute wlan0
       valid_lft 86228sec preferred_lft 86228sec
    inet6 2a02:8428:1d60:fc01:fc52:84a0:d7fd:e5c9/64 scope global dynamic noprefixroute 
       valid_lft 604783sec preferred_lft 604783sec
    inet6 fe80::4d6:4e0:eaf9:fbd7/64 scope link noprefixroute 
       valid_lft forever preferred_lft forever
edit retag flag offensive close merge delete

Comments

Can you show the network configuration (ip addr) on Linux, or similar on your OS? You need to make sure multicast is enabled on your network interface.

At the ROS level, the default settings already have it enabled.

ryanf55 gravatar image ryanf55  ( 2023-01-18 11:47:04 -0600 )edit

I updated the question with this info.

andi gravatar image andi  ( 2023-01-19 11:18:50 -0600 )edit

Can you ping the PC with VM and RPi normally? The addition of the VM layer could be to blame for the problem - what software are you using for VMs? Can you check if the VM config has the networking enabled/bridged?

ljaniec gravatar image ljaniec  ( 2023-01-19 12:21:04 -0600 )edit

Yes i can ping the Pc by both VM and Raspi. The VM has Ubuntu focal. The thing is that from the Raspi i cannot ping the VM ip which is 10.0.2.15 (the one assigned to the VM), but i do ping the PC (192.168.1.24). In the VM Network conf i have the Virtual-Box Host-Only Ethernet Adapter with address 192.168.56.1. So i guess that the problem is in the assignement of the VM ip address. I do not know that much on how does this work!

andi gravatar image andi  ( 2023-01-19 13:29:59 -0600 )edit

Can you check, whether your ports (on both sides) are open or not? Check here: https://docs.ros.org/en/galactic/Conc... which UDP ports should be open according to your ROS_DOMAIN_ID

Andromeda gravatar image Andromeda  ( 2023-01-21 12:20:25 -0600 )edit

Which VM do you use? VirtualBox? If yes, check this document: https://nsrc.org/workshops/2014/sanog...

Andromeda gravatar image Andromeda  ( 2023-01-21 12:22:12 -0600 )edit

1 Answer

Sort by ยป oldest newest most voted
1

answered 2023-01-25 11:20:31 -0600

andi gravatar image

Ok, i solved the problem! Basically, since i was using a VM with NAT network, the VM wasn't seen as another device on the net. Hence i changed the VM network configuration to Net with Bridge and this assigns an IP to the VM as it was another computer. Now everything works fine!

edit flag offensive delete link more

Comments

1

Nice to hear that it was just a VM configuration as it was suggested :)

ljaniec gravatar image ljaniec  ( 2023-01-26 06:42:55 -0600 )edit

Question Tools

2 followers

Stats

Asked: 2023-01-17 12:48:45 -0600

Seen: 1,094 times

Last updated: Jan 25 '23