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

Communicating with ROS over network - do not use host names

asked 2014-03-15 21:25:15 -0600

rb gravatar image

updated 2016-10-24 08:36:24 -0600

ngrennan gravatar image

I am trying have two computers communicate over a network as described here:

The problem is, no matter what I do, it seems that ros tries to communicate using hostnames. I want to use IP addresses only.

on both computers I have tried setting both ROS_IP and ROS_HOSTNAME to their own respective IP addresses.

-Both computers are able to ping eachother

  • ROS_MASTER_URI is set to http:// master.IP.Add.ress:11311 on both computers

  • upon running rospy_tutorials on the "other" computer, it shows up under node list on the "host" computer. However, if I run rosnode info on the talker, it says:

    contacting node http:// ubuntu:33802/ ...
    ERROR: Communication with node[http://ubuntu:33802/] failed!

Running the listener, or rostopic echo on the talker yields no results. Why can't I get rid of the "ubuntu" hostname? I just want IP addresses.

edit retag flag offensive close merge delete



note: had to add spaces after "http://" because it said insufficient karma to post links

rb gravatar image rb  ( 2014-03-15 21:25:41 -0600 )edit

1 Answer

Sort by ยป oldest newest most voted

answered 2014-03-17 07:50:50 -0600

Wolf gravatar image

Your error very much looks like you failed to set ROS_IP. You need to set

export ROS_MASTER_URI= # IP of PC hosting roscore
export ROS_IP=      # own IP

And do not modify ROS_HOSTNAME. Tell me if it worked....

edit flag offensive delete link more



I did try it this way initially, and it did not work. One issue I feel like may be that I don't really understand the way environment variables work in linux. Are they per terminal window? Should I set them before or after I run ros? I've been trying all kinds of combinations blindly...

rb gravatar image rb  ( 2014-03-17 22:18:07 -0600 )edit

Yes, they are per terminal and yes, you have to set them before running any ros-related stuff. I personally prefer to add these two lines also to ~/.bashrc (same as source /opt/ros .... /setup.bash). After you added them you need to close and open again all terminals to have the env vars set.

Wolf gravatar image Wolf  ( 2014-03-17 23:50:06 -0600 )edit

if you dont write this codes((export ROS_MASTER_URI= # export ROS_IP= # own IP )) in /opt/ros .... /setup.bash file, you should write this codes before every running roscore .

burakekincioglu gravatar image burakekincioglu  ( 2018-09-09 05:29:45 -0600 )edit

Question Tools

1 follower


Asked: 2014-03-15 21:25:15 -0600

Seen: 1,837 times

Last updated: Mar 17 '14