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

ROS2 nodes can not see one another via network

asked 2018-09-27 04:33:44 -0600

uthinu gravatar image

updated 2018-09-27 08:01:19 -0600

Hello, I compiled ROS2 on a PC and on TurtleBot3/Raspberry Pi. When I run the talker/listener demos, it turns out that they communicate within the same machines, but across the machines they do not see each other, effectively creating two independent ROS2 instances.

.bashrc on the PC:

export ROS_HOSTNAME=192.168.88.11
export ROS_VERSION=2
export ROS_MASTER_URI=http://$ROS_HOSTNAME:11311
source /home/art/ros2_ws/install/local_setup.bash

.bashrc on Turtlebot/Raspberry Pi:

export ROS_DISTRO=bouncy
export ROS_MASTER_URI=192.168.88.11:11311
export ROS_IP=192.168.88.10
export ROS_HOSTNAME=$ROS_IP
export ROS_VERSION=2
source /home/pi/ros2_ws/install/local_setup.bash
source /home/pi/ros2_turtlebot/install/local_setup.bash

Also, after ros2 daemon start on the PC, ros2 daemon status on the Raspberry Pi shows "not running". Is there any problem with the configuration, which makes ROS2 not form a common system?

This question suggests that ROS_MASTER_URI is used by ROS2, but here it is written that ROS2 does not use a centralized discovery mechanism. Then there is some info that there is no master in ROS2 and that multicast should be enabled, DDS should be configured etc. but I found no example of whether a plain ROS2 installation which uses the default DDS is configured already, if not what should I change in exactly that configuration? Taking into account that multicast is known to have problems via WiFi and a ROS2 user may have no influence on the configuration of a local WiFi network.

By the way, this works in two directions fot the two machines in question:

$ nc -lu -p 5555

$ nc -vzu 192.168.88.<10 or 11> 5555
Connection to 192.168.88.<10 or 11> 5555 port [udp/rplay] succeeded!

A local connection via an Ethernet cable also does not make the nodes see one another. All four interfaces Ethernet, Wifi have the MULTICAST flag.

I cound not find an option in ros2 which would show me the DDS used, its capabilities, possibly its connection logs. Any way of debugging what happens here?

edit retag flag offensive close merge delete

Comments

You give two very different IPs for the involved hosts: 137.194.88.10 and 192.168.88.11. Are the networks they are in routed to each other? Because in your nc example you use 137.194.88.10 and 137.194.88.11.

gvdhoorn gravatar image gvdhoorn  ( 2018-09-27 07:22:53 -0600 )edit

No, I am sorry, it is just a mistake. They are all on the same network, the IPs change depending on whether it is a Wifi network or a local Ethernet via a cable (I tested both), but in any case only the last .10 and .11 are different.

uthinu gravatar image uthinu  ( 2018-09-27 08:03:25 -0600 )edit

Also there is no firewall on both machines (tested with iptables -L) so at least in the case of the Ethernet connection, there is no firewall at all.

uthinu gravatar image uthinu  ( 2018-09-27 08:20:18 -0600 )edit

You need to use ROS_DOMAIN instead of ROS_MASTER_URI since in ROS2 there is no master anymore, check here : https://discourse.ros.org/t/how-to-ru...

Marc Testier gravatar image Marc Testier  ( 2018-09-27 23:02:25 -0600 )edit

I did not have ROS_DOMAIN initially because the docs were saying that it is for an additional isolation. Possibly it changed, but anyway, I have ROS_DOMAIN already and the problem persists. I compiled a snapshot of ROS2 from git, I will try with some beta instead to see if it helps.

uthinu gravatar image uthinu  ( 2018-09-28 02:59:41 -0600 )edit

First of all: you don't have to set any of these environment variables. Actually ROS_MASTER_URI, ROS_HOSTNAME, and ROS_IP are not even used in ROS 2.

Dirk Thomas gravatar image Dirk Thomas  ( 2018-10-08 12:41:07 -0600 )edit

Commonly ROS 2 uses DDS for communication which uses UDP multicast packets. You might want to double check that your network supports multicasts. The following command line tool might be helpful for that: https://github.com/ros2/ros2cli/tree/...

Dirk Thomas gravatar image Dirk Thomas  ( 2018-10-08 12:43:44 -0600 )edit

Was this resolved? I am having the same issue, and I ran the multicast tool and that works. Not sure what else to try.

mkhansen gravatar image mkhansen  ( 2019-03-04 17:52:12 -0600 )edit

1 Answer

Sort by ยป oldest newest most voted
2

answered 2019-03-06 10:35:21 -0600

mkhansen gravatar image

updated 2019-03-07 17:11:19 -0600

jayess gravatar image

I had the same issue, and even though I could run the 'ros2 multicast send; and receive both directions, topics and nodes couldn't be seen on the other system.

The only thing that resolved this for me (at least temporarily) was to stop the ros2 daemon and restart it on each system:

ros2 daemon stop

ros2 daemon start

Then it started working again as normal.

This may be more of a work-around than a fix however as if this happens intermittently on a product, the daemon start and stop may not be possible in those cases.

edit flag offensive delete link more

Comments

Thanks this worked perfectly!

jerek gravatar image jerek  ( 2023-02-09 07:15:18 -0600 )edit

Question Tools

2 followers

Stats

Asked: 2018-09-27 04:33:44 -0600

Seen: 10,980 times

Last updated: Mar 07 '19