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

rostopic list works but rostopic echo does not

asked 2012-11-13 06:05:21 -0600

Tom Sgouros gravatar image

updated 2012-11-13 09:18:11 -0600

Ben_S gravatar image

I'm running the ROS core on a mobile robot and am using ssh to monitor it from a workstation. On the workstation I have ROS_MASTER_URI and ROS_IP configured per the wiki's instructions to point at the robot's IP address. "rostopic list" works correctly and shows me the correct list of topics. Unfortunately, "rostopic echo" is silent, and "rxgraph" also implies the workstation is not connected to the host.

The question: under what circumstances could rostopic list work and rostopic echo not work?

(I'm familiar with the relevant sections of the wiki (http://www.ros.org/wiki/ROS/NetworkSetup, for example), but they're not answering this question for me.)

Thank you.

edit retag flag offensive close merge delete

Comments

Just to elaborate, I can edit /etc/hosts on both machines to make this work, but the network setup page implies I should be able to do this by setting ROS_IP, which does not seem to work. I don't have su privilege on all the machines I want to use.

Tom Sgouros gravatar image Tom Sgouros  ( 2012-11-13 06:24:18 -0600 )edit

Suffering the same problem in 2021, but I do have su access so I edited /etc/hosts and its started working. None of the rest of the ROS_ID= stuff worked. Why does this make it work?

Mattster gravatar image Mattster  ( 2021-07-15 11:50:10 -0600 )edit

10 Answers

Sort by ยป oldest newest most voted
8

answered 2012-11-13 08:12:57 -0600

jbohren gravatar image

updated 2012-11-13 08:13:39 -0600

$ROS_IP on your workstation should be your workstation's IP address, not the robot's.

rostopic list is just talking to the master, whereas rostopic echo needs to be able to communicate with the publishers.

edit flag offensive delete link more

Comments

Thank you so much. It worked. I forgot to set ROS_IP on master, and slave robot

BaBui gravatar image BaBui  ( 2022-06-15 03:30:43 -0600 )edit
7

answered 2015-07-14 16:51:31 -0600

Thomas10111 gravatar image

Adding the ros server to the /etc/hosts file on the client worked for me.

edit flag offensive delete link more
5

answered 2017-03-31 09:11:21 -0600

Wiew gravatar image

updated 2021-02-24 10:30:16 -0600

lucasw gravatar image

Check your settings in both terminal. We had same problem and problem was in :

We had in 1st terminal ROS_MASTER_URI=http://192.168.1.10:11311 - in this terminal runs roscore and in 2nd terminal ROS_MASTER_URI=http://localhost:11311 - in this terminal runs urg_node

In matlab we receive using rostopic list all nodes but if we use rostopic echo /scan, we are not able to receive data.

there is our solution: best way how eliminate similiar mistakes is add few lines to .bashrc file

export ROS_MASTER_URI=http://192.168.1.10:11311
export ROS_HOSTNAME=192.168.1.10
export ROS_IP=              (empty data)

and it works!

and if you want use matlab

192.168.1.11 - our PC with matlab 192.168.1.10 RPI with ROS and sensors

setenv('ROS_MASTER_URI','http://192.168.1.10:11311')
setenv('ROS_IP','192.168.1.11')
setenv('ROS_HOSTNAME','192.168.1.11')
edit flag offensive delete link more
1

answered 2014-04-15 16:53:31 -0600

Younghyo gravatar image

I undergo the same problem. You also should set $ROS_IP on mobile robot. It works.

edit flag offensive delete link more
1

answered 2019-11-18 08:14:05 -0600

benwex93 gravatar image

In my case it was a matter of my client not being able to resolve the IP address of my server. I was able to verify this by subscribing to a topic and then checking the info about that topic:

$rostopic info /gazebo/model_states

Type: gazebo_msgs/ModelStates

Publishers: 
 * /gazebo (http://my-workstation:42193/)

Subscribers: 
 * /rostopic_117_1574085827847 (http://132.11.11.111:40064/)

I had passed 132.11.11.111 to my client as ROS_MASTER_URI but my server publishes as 'my-workstation' and not 132.11.11.111. It's clear then that the Ros Master was unable to connect the topic listener and publisher to listen and publish to the same port because it cant resolve what 'my-workstation' is referring to.

So my solution was to add

132.11.11.111 my-workstation

to the end of etc/hosts on my client and now it works

edit flag offensive delete link more
1

answered 2019-07-16 11:29:41 -0600

sai krishna gravatar image

even after the correct settings of ROS_MASTER_URI and ROS_IP to the base workstation you would some times not receive the data and rostopic list works but not rostopic echo

in order to work on this issue you'll have to add an exception in your firewall settings for the robot's IP connection or disable the firewall using the command : sudo ufw disable

it should definitely work !

edit flag offensive delete link more

Comments

"sudo ufw disable" solved my case

MarkAi9 gravatar image MarkAi9  ( 2021-05-11 05:59:14 -0600 )edit
1

answered 2015-05-09 08:35:10 -0600

charles.fox gravatar image

I just had this issue when I moved my computers onto a new network, where they got assigned new nonstatic IPs by DHCP. The fix which worked for me was:

set ROS_HOSTNAME on robot PC to its own ip,

set ROS_HOSTNAME on base PC to its own ip

set ROS_IP on robot PC to base IP

set ROS_MASTER_URI to base IP:11311 both machines.

edit flag offensive delete link more

Comments

Thanks for your answer! I got headache with other solutions but this does help me!

lhnguyen gravatar image lhnguyen  ( 2017-06-13 09:17:37 -0600 )edit

This worked for me, either! For my case ROS_MASETER_URI setting for base machine itself was not necessary. Also ufw disable(turn off firewall) and etc/hosts file did not affect my result.

Harestew gravatar image Harestew  ( 2020-05-02 03:43:13 -0600 )edit
1

answered 2012-11-13 09:57:51 -0600

Ben_S gravatar image

$ROS_IP and $ROS_HOSTNAME basically tell the nodes running on a computer on which address they are reachable from the outside. You need to set only one of those. Whatever works better in your network. (To be absolutely sure and if you can use static IPs, i prefer using IP addresses)

So make sure, that you can ping in both directions and set $ROS_IP on the server and the workstation each to their externally reachable addresses.

jbohren already mentioned what constellation can lead to the observed behaviour. rostopic list is completely independent from the setting of $ROS_IP. It only needs an correctly set $ROS_MASTER_URI. :)

edit flag offensive delete link more
0

answered 2021-02-25 22:10:44 -0600

loguna gravatar image

updated 2021-02-25 22:12:18 -0600

By default:

Step 1: On the robot:

1) run Roscore

2) export ROS_IP: IP address of Robot

Step 2: On your server monitor PC:

1) export ROS_IP: IP address of your PC

2) export ROS_MASTER_URI: http:// IP_address of Robot :11311

If it doesnt work, disable firewalls both the robot and the server PC.

edit flag offensive delete link more
0

answered 2023-01-26 09:54:12 -0600

xperroni gravatar image

I had this problem the other day, but in my case it was due to a network configuration issue. The entry in /etc/hosts in the client machine mapped the master machine IP to the hostname robot-base, but its hostname was internally set to robot-lab. And this was the hostname shown in rostopic info calls, for example:

$ rostopic info /odom
Type: nav_msgs/Odometry

Publishers: 
* /ekf_localization (http://robot-lab:40969/)

So when I tried to subscribe to a remote topic, ROS would lookup the name robot-lab, which wasn't present in the hosts list.

Bottom line, don't try to be smart about it, always name your machines in /etc/host exactly what they call themselves.

edit flag offensive delete link more

Question Tools

3 followers

Stats

Asked: 2012-11-13 06:05:21 -0600

Seen: 26,217 times

Last updated: Jan 26 '23