ROS Resources: Documentation | Support | Discussion Forum | Index | Service Status | Q&A
Ask Your Question

what the ROS_IP for?

asked 2016-01-28 01:26:35 -0500 gravatar image

updated 2019-06-25 19:22:35 -0500

130s gravatar image


Can anybody explain what the ROS_IP environment variable is for? I've read the "ROS/NetworkSetup" wiki, but didn't get the clear answer.

Here is my environment:

  • Hostname, IP address
  • robot,
  • pc,
  • android_phone,

my pc & android_phone can't resolve the hostname "robot". So, I specify the ROS_MASTER_URI=

I want to run rviz to show the map in the robot. Also, I want to run "android_core" API to access the map in the app in android phone.

I know that I HAVE TO have the envirnment variable ROS_IP =

But, can anybody tell me why??

The strange thing is, if I didn't setup the ROS_IP environment variable, slaves still can send messages to /cmd_vel. But the slaves won't be able to retrieve the /map

If the robot has multiple network interfaces, things will be more difficulty. for example:

robot has two interfaces:

  • wlan0
  • usb0

Due to network reachability issue, some of the slaves have to access to, and others have to access to In this case, what IP should be filled in ROS_IP in the robot??

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted

answered 2019-06-25 22:24:23 -0500

ahendrix gravatar image

updated 2019-06-26 14:26:59 -0500

ROS nodes exchange topic and service data peer-to-peer; this means that all nodes need to be able to communicate over the network with all other nodes. Each node has a URI that it sends to the ROS master, along with its list of topics and services. When other nodes want to use a topic or service, they ask the ROS master for the URIs of the nodes on those topics, and the ROS master gives them those URIs. The other nodes then use the node's URI to establish topic and service connections.

By default, a node creates its URI from the hostname of the computer that it is running on. Setting ROS_IP overrides this, and causes the node to use the specified IP address when advertising itself. (ROS_HOSTNAME can also be used to override the hostname)

The ROS_IP should be set to the IP address of the computer that the ROS node is running on. If you want your node to be reachable on several different networks, you can either set up routing so that the node's IP is reachable from all networks, or set up DNS, hosts files, or some other mechanism for resolving hostnames to IP addresses. This way, hosts on one network will resolve one IP address for the node, and hosts on the other network will resolve the other IP address for the node.

For your specific environment, the correct settings (per-host) are:

  • robot,
    • ROS_IP=
  • pc,
    • ROS_IP=
  • android_phone,
    • ROS_IP=

I gave a talk at ROSCon 2013 which goes into the full details of the topic setup process, and why topics can work in one direction but not another between hosts on a network: ,

edit flag offensive delete link more


For android_phone, isn't ROS_IP supposed to be instead of

130s gravatar image 130s  ( 2019-06-26 07:14:48 -0500 )edit

Thank you! gravatar image  ( 2019-06-26 08:43:24 -0500 )edit

Ooops; yes. The ROS_IP for android_phone should be

ahendrix gravatar image ahendrix  ( 2019-06-26 14:27:37 -0500 )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: 2016-01-28 01:26:35 -0500

Seen: 8,295 times

Last updated: Jun 26 '19