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

Please see wiki/ROS/MultipleMachines.

You only run a single master, so both ROS_MASTER_URI variables should point to the same IP (ie: the one running your roscore).

Additionally: the value of ROS_HOSTNAME is used by ROS nodes to identify who is 'talking' to them. But localhost is a special hostname, that will (should?) always resolve to the local machine (at 127.0.0.1). It is therefor not usable to configure a distributed (ie: networked) ROS nodegraph.

Make sure to use either globally resolvable hostnames or don't set ROS_HOSTNAME, but set ROS_IP to the IP of the network interface that you use to connect both computers to the same network.

Please see wiki/ROS/MultipleMachines.

You only run a single master, so both ROS_MASTER_URI variables should point to the same IP (ie: the one running your roscore).

Additionally: the value of ROS_HOSTNAME is used by ROS nodes to identify who is 'talking' to them. But localhost is a special hostname, that will (should?) always resolve to the local machine (at 127.0.0.1). It is therefor therefore not usable to configure a distributed (ie: networked) ROS nodegraph.

Make sure to use either globally resolvable hostnames or don't set ROS_HOSTNAME, but set ROS_IP to the IP of the network interface that you use to connect both computers to the same network.

Please see wiki/ROS/MultipleMachines.

You only run a single master, so both ROS_MASTER_URI variables should point to the same IP (ie: the one running your roscore).

Additionally: the value of ROS_HOSTNAME is used by ROS nodes to identify who is 'talking' to them. But localhost is a special hostname, that will (should?) always resolve to the local machine (at 127.0.0.1). It is therefore not usable to configure a distributed (ie: networked) ROS nodegraph.

Make sure to use either globally resolvable hostnames or don't set ROS_HOSTNAME, but set ROS_IP to the IP of the network interface that you use to connect both computers to the same network.


Edit: the first version of your question used localhost everywhere, the second c3po and r2d2 and your last version now uses alpha and betha. Can you confirm that those hostnames actually resolve to IPs? The values you set for ROS_HOSTNAME have to actually be existing hosts on your network, you cannot just make something up.

On alpha, what is the output of ping betha (or on c3po, what is the output of r2d2)?

Please see wiki/ROS/MultipleMachines.

You only run a single master, so both ROS_MASTER_URI variables should point to the same IP (ie: the one running your roscore).

Additionally: the value of ROS_HOSTNAME is used by ROS nodes to identify who is 'talking' to them. But localhost is a special hostname, that will (should?) always resolve to the local machine (at 127.0.0.1). It is therefore not usable to configure a distributed (ie: networked) ROS nodegraph.

Make sure to use either globally resolvable hostnames or don't set ROS_HOSTNAME, but set ROS_IP to the IP of the network interface that you use to connect both computers to the same network.


Edit: the first version of your question used localhost everywhere, the second c3po and r2d2 and your last version now uses alpha and betha. Can you confirm that those hostnames actually resolve to IPs? The values you set for ROS_HOSTNAME have to actually be existing hosts on your network, you cannot just make something up.

On alpha, what is the output of ping betha (or on c3po, what is the output of r2d2)?


export ROS_HOSTNAME=r2d2 
export ROS_MASTER_URI=http://c3po:11311

Edit 2: just making sure: you are exporting those variables in all terminals that you start ROS programs in? Or do you have those export lines added to your .bashrc?

If you haven't, add the export lines to your .bashrc on both machines (for now, at least). Close all terminals.

Now on c3po:

  • open a new terminal: start roscore in it
  • open a new terminal: run the following:

    rostopic pub -r1 /chatter std_msgs/String "something"
    

Now on r2d2:

  • open a new terminal: run the following:

    rostopic echo /chatter
    

you should now see rostopic printing "something" once per second.

To make sure everything us working, do the reverse (so start rostopic pub -r1 .. on r2d2 and rostopic echo .. on c3po).

If you don't get any output from rostopic echo .. on r2d2, your network setup is not correct. In that case, try a rosnode ping /rosout on r2d2.