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

ROS remote master: can see topics but no data

asked 2013-10-14 01:40:26 -0600

psei gravatar image

updated 2014-01-28 17:18:13 -0600

ngrennan gravatar image

Hi there,

I have got a question about running ROS on several machines. I currently have 4 systems:

Robot: 192.168.1.1
PC1: 192.168.1.2
PC2: 192.168.1.3
PC3: 192.168.1.4

Roscore/Rosmaster is running on the Robot and on all PCs I have set "export ROS_MASTER_URI=http://192.168.1.1:11311". Further more, all PCs can ping each other and it is possible to establish ssh connections.

Here comes the strange thing I do not understand: I can enter "rostopic list" on each PC, and I can see the topics that are running in the roscore on the robot. But when I enter "rostopic echo /someTopic", it only works for PC2. On PC1 and PC3 I don't receive any data. Why can I see the topics but can't receive/send messages?

The tutorial about ROS remote says, that it is only necessary that the PCs can ping each other and that nothing else except "ROS_MASTER_URI" needs to be configured.

Does anyone know why this is happening?

regards psei

edit retag flag offensive close merge delete

7 Answers

Sort by ยป oldest newest most voted
7

answered 2013-10-14 03:24:04 -0600

dornhege gravatar image

The actual problem here is network resolution. Seeing the topics only shows you one direction of communication. Every computer needs to be able to talk to (test e.g. by ping) each other (from/to) using whatever name this is known by to ROS. That's what the ROS_IP settings are for.

edit flag offensive delete link more

Comments

2
tfoote gravatar image tfoote  ( 2013-10-14 16:33:22 -0600 )edit

I've run into the same issue and every time it was caused by messed up /etc/hosts file and/or lack of the ROS_IP export. If one does not export ROS_IP on the publishing PC, it should be possible to list the topics but you won't be able to establish a connection. This should be the answer.

autonomy gravatar image autonomy  ( 2013-10-15 06:25:56 -0600 )edit
3

I'm sorry, but I had the same issue and ROS_IP was set properly, it didn't make a difference. What made a difference is the /etc/hosts file on the remote PC having the hostname and ip of the master PC.

evk02 gravatar image evk02  ( 2014-03-15 06:04:52 -0600 )edit

I know this is an old post, but I'm facing kind of the same problem. I'm completely sure the machines can communicate with each other as I can subscribe to simple topics. For example running this on the robot board:

rostopic pub /robot/str std_msgs/String "Hello there"

I can retrieve the message on my PC with:

rostopic echo /robot/str

The problem arises when the topics are of type sensor_msgs/Image. I have a stereo camera that publishes a RGB image as well as a depth one. If I run rviz within the robot (I have to connect a monitor to it), I'm able to see both. However, when I try to visualize them from my remote PC, I'm not able to (I keep receiving as if there is no data).

Thank you all!

pfontana96 gravatar image pfontana96  ( 2021-06-09 15:12:58 -0600 )edit
11

answered 2013-10-14 23:30:21 -0600

psei gravatar image

updated 2013-10-15 00:53:56 -0600

Hi everyone and thanks for your answers. I tried several things like setting ROS_IP, ROS_HOSTNAME, etc.... but I could not get it running.

What finally solved my problem was adding all PCs with their hostnames and IP Adresses to the "/etc/hosts" file. Since then, everything works fine.

edit flag offensive delete link more

Comments

2

I had the same issue. All ROS_IP, ROS_MASTER_URI settings were fine, I did see the topics but when subscribed no message came through. It was because the node running roscore had a hostname and that hostname was not added to the /etc/host file or the remote PC. I have added the hostname and the topics immediately started to show their data on the remote PC.

evk02 gravatar image evk02  ( 2014-03-15 06:03:28 -0600 )edit
1

Thanks for posting an answer to your problem. Could you be more specific about what you did, though? You added IP addresses to /etc/hosts, but what did you do then? Just refer to the strings in ~/.bashrc? I'm having the same problem and any help would be wonderful.

mycal gravatar image mycal  ( 2015-03-20 12:37:44 -0600 )edit
1

This worked for me. Just add the publishing computer to the /etc/hosts file in the same format as the localhost is added.

Clancy gravatar image Clancy  ( 2015-04-03 23:56:36 -0600 )edit

Thanks man! I just spend the entire day trying everything!

Tristan9497 gravatar image Tristan9497  ( 2021-11-07 14:33:47 -0600 )edit
4

answered 2013-10-21 06:57:28 -0600

MadEgg gravatar image

updated 2013-10-21 06:59:42 -0600

The lack of data means that your client can see the ROS master, but cannot connect to the topics on the remote machine. The cause is that the services on the remote machine are not accepting remote connections, only local. This is determined by the ROS_IP variable.

So, to use ROS over network, you need do two two things:

On the machine running roscore, you need to make sure that your services listen on any port. When no port is set, localhost (127.0.0.1) is used. So, you should select the IP of your machine on the internal network, or listen on any interface:

export ROS_IP=0.0.0.0 # Listen on any interface

OR

export ROS_IP=192.168.1.1 # Listen on 192.168.1.1

On the machine running roscore, you needn't worry about ROS_MASTER_URI or ROS_HOSTNAME.

On the client machine, not running roscore, there's two things you need to do. First, you need to make sure that ROS nodes are able to connect to the master by specifying ROS_MASTER_URI:

export ROS_MASTER_URI=192.168.1.1:11311

Second, you need to make sure that nodes running on the remote machine can also access topics published on the local machine, by setting ROS_IP to something different than 127.0.0.1, so:

export ROS_IP=0.0.0.0 # To listen on any interface

edit flag offensive delete link more
3

answered 2021-07-04 23:01:22 -0600

quanghai gravatar image

updated 2021-07-04 23:04:11 -0600

Disable Firewall worked for me

Use below cmd to disable Firewall (refer)

$ sudo ufw disable
edit flag offensive delete link more

Comments

Yeah, I tried everything else in the other answers. But ultimately this helped.

Jibran gravatar image Jibran  ( 2021-12-21 16:44:11 -0600 )edit
1

answered 2020-05-22 12:37:46 -0600

houjiawei11 gravatar image

I solved my problem by adding both machines' hostname to /etc/hosts. refer to https://husarion.com/tutorials/ros-tu...


Details:

You can use roswtf to see what's happening. For me I got this error on my client machine:

ERROR: Unknown host [robot-desktop] for node [***]

where "robot-desktop" is the hostname of the master machine. If this ERROR occurs, you need to add the hostname of both machines to /etc/hosts like this:

X.X.X.X master-hostname

X.X.X.X client-hostname

You can run hostname in terminal to see the hostname of the machine.

edit flag offensive delete link more
0

answered 2013-10-14 02:33:23 -0600

Chrimo gravatar image

I'm using this and it works for me:

RemoteROS.sh

export ROS_HOSTNAME=/bin/hostname -I

export ROS_MASTER_URI="http://$1:11311"

echo Using ROS MASTER at $ROS_MASTER_URI from $ROS_HOSTNAME

ping -c 1 $1

rostopic list

export LIBGL_ALWAYS_SOFTWARE=1

edit flag offensive delete link more

Comments

Thx for your answer. As I wrote, "rostopic list" works, but not "rostopic echo /someTopic". I tried your script, it works, but I still can't use "rostopic echo"... I just don't get it. Any other ideas?

psei gravatar image psei  ( 2013-10-14 02:46:42 -0600 )edit

Have you set ROS_IP or ROS_HOSTNAME? Do some of the PCs have Firewalls installed?

Ben_S gravatar image Ben_S  ( 2013-10-14 03:07:59 -0600 )edit
0

answered 2022-04-20 05:37:06 -0600

daniil gravatar image

Hello. I solved this problem. I simple used roswtf and realized that it can't find hostname. Something trying to get access to rosmaster by hostnames from my local machine. So i added this host to '/etc/hosts'.

edit flag offensive delete link more

Question Tools

5 followers

Stats

Asked: 2013-10-14 01:40:26 -0600

Seen: 37,831 times

Last updated: Apr 20 '22