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

Revision history [back]

click to hide/show revision 1
initial version

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, 192.168.25.80
    • ROS_IP=192.168.25.80
    • ROS_MASTER_URI=http://192.168.25.80:11311/
  • pc, 192.168.25.112
    • ROS_IP=192.168.25.112
    • ROS_MASTER_URI=http://192.168.25.80:11311/
  • android_phone, 192.168.25.113
    • ROS_IP=192.168.25.112
    • ROS_MASTER_URI=http://192.168.25.80:11311/

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, 192.168.25.80
    • ROS_IP=192.168.25.80
    • ROS_MASTER_URI=http://192.168.25.80:11311/
  • pc, 192.168.25.112
    • ROS_IP=192.168.25.112
    • ROS_MASTER_URI=http://192.168.25.80:11311/
  • android_phone, 192.168.25.113
    • ROS_IP=192.168.25.112
    • ROS_MASTER_URI=http://192.168.25.80:11311/

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: https://roscon.ros.org/2013/wp-content/uploads/2013/06/Networking-for-ROS-Users.pdf , https://vimeo.com/67806888

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, 192.168.25.80
    • ROS_IP=192.168.25.80
    • ROS_MASTER_URI=http://192.168.25.80:11311/
  • pc, 192.168.25.112
    • ROS_IP=192.168.25.112
    • ROS_MASTER_URI=http://192.168.25.80:11311/
  • android_phone, 192.168.25.113
    • ROS_IP=192.168.25.112ROS_IP=192.168.25.113
    • ROS_MASTER_URI=http://192.168.25.80:11311/

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: https://roscon.ros.org/2013/wp-content/uploads/2013/06/Networking-for-ROS-Users.pdf , https://vimeo.com/67806888