Ask Your Question

ROS2 Talker cannot communicate with Listener

asked 2018-08-12 08:13:49 -0600

takijo gravatar image

updated 2018-09-08 23:42:48 -0600


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 | sudo apt-key add -
$ sudo sh -c 'echo "deb [arch=amd64,arm64] 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)

edit retag flag offensive close merge delete


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.

Geoff gravatar image Geoff  ( 2018-09-10 01:38:31 -0600 )edit

I waited for about ten seconds,but not try it more. After a change of my ufw, I could success quickly.

takijo gravatar image takijo  ( 2018-09-10 17:47:05 -0600 )edit

1 Answer

Sort by » oldest newest most voted

answered 2018-08-12 20:59:48 -0600

Geoff gravatar image

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.

edit flag offensive delete link more


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
sudo ufw allow in proto udp from

Thank you for your help!

takijo gravatar image takijo  ( 2018-08-13 08:31:39 -0600 )edit

If you run into a similar problem you can try the new multicast verb to test if simple multicast functionality is working for you:

Dirk Thomas gravatar image Dirk Thomas  ( 2018-09-10 17:54:09 -0600 )edit

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.

Tav_PG gravatar image Tav_PG  ( 2019-09-25 22:16:15 -0600 )edit

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools



Asked: 2018-08-12 08:13:49 -0600

Seen: 1,065 times

Last updated: Sep 08 '18