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

ROS2: communication over two machines on the same network

asked 2021-09-23 05:50:47 -0600

Mrmara gravatar image

updated 2021-09-23 07:22:29 -0600

Hi everybody,

I am experiencing a weird problem with ROS2 foxy. Basically I have one machine that is not able to commuinate over ROS2 with others on the same network.

Let me give you some details:

MACHINE 1 (the one with the problem) Laptop DELL Ubuntu 20.04 LTS ROS2 Foxy

MACHINE 2 (this one is able to communicate with others in the same network but not with MACHINE 1) Laptop DELL Ubuntu 18.04 LTS ROS2 Foxy

Machine 1 cannot discover topic being published, and if it publish I cannot see the topics being published on Machine2(or any other machine)

I am able to ping M1 from M2 and viceversa, ROS_DOMAIN_ID is not set and even if I set it, that does not solve the problem. I would exclude that the porblem is because of the mismatch of two OS, in fact I have other machines with Ubuntu 20.024 able to communicate over ros topics.

Anybody has any clue on what's going on here?

I already tried to uninstall and reinstall ROS, that did not fix the issue

edit retag flag offensive close merge delete

Comments

Can you please! provide all steps you have followed. Thanks

Ranjit Kathiriya gravatar image Ranjit Kathiriya  ( 2021-09-23 06:21:23 -0600 )edit

I am not sure what do you mean with all the steps I have followed. I publish a topic with ros2 topic pub /topicXYZ msg_type (e.g. ros2 topic pub /asdfg nav_msgs/msg/Path) and on the other machine I use ros2 topic echo /topicXYZ (e.g. ros2 topic echo /asdfg)

Mrmara gravatar image Mrmara  ( 2021-09-23 07:21:10 -0600 )edit

I was telling you about configuration steps, Do you have /topicXYZ msg file in other machines? If no then I would suggest to add the following msg file and build a package and try.

Ranjit Kathiriya gravatar image Ranjit Kathiriya  ( 2021-09-23 08:35:05 -0600 )edit

That message type is installed in both machines

Mrmara gravatar image Mrmara  ( 2021-09-23 09:31:48 -0600 )edit

Main Pc:

export ROS_MASTER_URI=http://url:11311/
export ROS_HOSTNAME=192.168.1.1
export ROS_IP=192.168.1.1

Second Pc:

export ROS_MASTER_URI=http://192.168.1.1:11311/    # Ip address of 1 PC
export ROS_HOSTNAME=192.168.1.2
export ROS_IP=192.168.1.2

This was my configuration while connecting 2 PC.

You have to include this in your bashrc file.

Ranjit Kathiriya gravatar image Ranjit Kathiriya  ( 2021-09-23 09:37:05 -0600 )edit
1

Thank you for your support and time but the problem was the firewall, sudo ufw disable solved the issue

Mrmara gravatar image Mrmara  ( 2021-09-23 09:41:18 -0600 )edit

make it an answer and tick it.

Ranjit Kathiriya gravatar image Ranjit Kathiriya  ( 2021-09-23 09:45:09 -0600 )edit

ROS2 does not use any of those environment variables to connect.

Per Edwardsson gravatar image Per Edwardsson  ( 2021-09-23 10:03:31 -0600 )edit

1 Answer

Sort by ยป oldest newest most voted
1

answered 2021-09-23 10:59:12 -0600

Mrmara gravatar image

It turned out to be a firewall issue.

sudo ufw disable

made the magic

edit flag offensive delete link more

Question Tools

1 follower

Stats

Asked: 2021-09-23 05:50:47 -0600

Seen: 2,201 times

Last updated: Sep 23 '21