0
$\begingroup$

Rosanswers logo

Hi,

I want to use ROS2.

I finished to setup ROS2,but talker cannot communicate with listener.

My setup is below.

$ sudo apt update && sudo apt install curl 
$ curl http://repo.ros2.org/repos.key | sudo apt-key add -
$ sudo sh -c 'echo "deb [arch=amd64,arm64] http://repo.ros2.org/ubuntu/main xenial main" > /etc/apt/sources.list.d/ros2-latest.list'
$ sudo apt update
$ sudo apt install `apt list "ros-ardent-*" 2> /dev/null | grep "/" | awk -F/ '{print $1}' | grep -v -e ros-ardent-ros1-bridge -e ros-ardent-turtlebot2- | tr "\n" " "`

So, the terminal 1 is

$ source /opt/ros/ardent/setup.bash
$ ros2 run demo_nodes_cpp talker

and, the terminal 2 is

$ source /opt/ros/ardent/setup.bash
$ ros2 run demo_nodes_cpp listener

terminal 1 display

$ ros2 run demo_nodes_cpp talker
[INFO] [talker]: Publishing: 'Hello World: 1'
[INFO] [talker]: Publishing: 'Hello World: 2'
[INFO] [talker]: Publishing: 'Hello World: 3'
[INFO] [talker]: Publishing: 'Hello World: 4'
[INFO] [talker]: Publishing: 'Hello World: 5'

but ,terminal 2 no response.

What am I wrong?

(I use Ubuntu16.04LTS)


Originally posted by takijo on ROS Answers with karma: 110 on 2018-08-12

Post score: 5


Original comments

Comment by Geoff on 2018-09-10:
How long have you left the listener running for to wait for a response? Discovery can take some time, although on a local machine I would expect it to success fairly quickly.

Comment by takijo on 2018-09-10:
I waited for about ten seconds,but not try it more. After a change of my ufw, I could success quickly.

$\endgroup$

1 Answer 1

0
$\begingroup$

Rosanswers logo

Make sure that you are allowing multicast traffic in the firewall. By default, the ufw firewall included in 16.04 blocks multicast traffic, even for loopback (i.e. on the same system). Here's an example of allowing multicast in ufw.


Originally posted by Geoff with karma: 4203 on 2018-08-12

This answer was ACCEPTED on the original site

Post score: 3


Original comments

Comment by takijo on 2018-08-13:
I can communicate with listener by the the way of above site.

I allow udp multicast in ufw.

sudo ufw allow in proto udp to 224.0.0.0/4
sudo ufw allow in proto udp from 224.0.0.0/4

Thank you for your help!

Comment by Dirk Thomas on 2018-09-10:
If you run into a similar problem you can try the new multicast verb to test if simple multicast functionality is working for you: https://github.com/ros2/ros2cli/pull/145

Comment by Tav_PG on 2019-09-25:
Also note, the same symptoms (i.e. ROS2 Talker cannot communicate with Listener) occur if the computer has no network configured. To test, try this: ros2 multicast receive in one terminal and ros2 multicast send in another terminal. If there are errors like load_entry_point … then plug your computer into a network and try again.

Comment by codierknecht on 2021-08-23:
Is there someone else with ros2 multicast working, other nodes are not able to see each other? Even ros2 topic pub /chatter std_msgs/String "data: ping" in one terminal isn't noticed by ros2 topic list in an another terminal. Of cause both have ros2 galactic sourced.

Comment by twaddell on 2021-09-27:
@codierknecht, I also have that issue, what version are you running? did you ever find a fix?

Comment by codierknecht on 2021-10-01:
@twaddell I did mange to solve the problem for running nodes on the same machine by exporting ROS_LOCALHOST_ONLY=1. However I currently don't have a second machine due to cross-compilation problems for a raspberry pi model 2b.

Comment by RickROS2 on 2023-01-12:
I have a similar problem. I am trying to connect a raspberry pi 3B+ to my pc with ROS2. I can connect to it just fine, my firewall is not active and multicast/ping between them works. However, topics listed on my pi do not show up on my pc and talker listener mode does not work either. (listener no response). ROS_ID is both 30. Please help me I do not know what else to do.

Comment by grhex on 2023-04-03:
I have a similar problem with ROS2 humble. I tried several things, including: sudo ufw allow in proto udp to 224.0.0.0/4 sudo ufw allow in proto udp from 224.0.0.0/4 "ros2 multicast receive" and "ros2 multicast send" communicated between two machines over wifi, but the talker and listener still didn't.

Comment by xaxam2001 on 2023-05-16:
Hi, I have the exact same issue that @grhex. I'm trying to use a turtlebot4 that use a pi 4B. I can ping the pi from my machine and the machine from my pi, ros2 multicast receive and ros2 multicast send are working fine. But the listener and the talker doesn't communicate, I can't use ros2 node list, I can't stop the daemon using ros2 daemon stop and I think there are a lot of other commands I can't use. Even after adding the rules in the answer above and even if I disable the ufw firewall.

I precise that I'm using Discovery Server configuration and I'm using FastDDS.

Does someone have any solution now ?

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.