0
$\begingroup$

Rosanswers logo

EDIT: Solved, see solution at the bottom of this comment.

I'm trying to get two computers set up to communicate between ROS. I set up SSH, and can access the terminals of each computer from the other. (One is Ubuntu 12.04 and the other is 13.04). From one computer, I try to run this tutorial:

wiki.ros.org/ROS/Tutorials/MultipleMachines

I did the tutorial using one computer. The other master already had roscore running on it. To start the listener on this machine, I did

ssh <master>@<master's IP>
export ROS_MASTER_URI=http://<master>@<master's IP>:11311
rosrun rospy_tutorials listener.py

When I run this, the listener doesn't print anything, but looks ready to print. In a new terminal, I used the main computer as the slave to run

export ROS_MASTER_URI=http://<master>@<master's IP>:11311
rosrun ropsy_tutorials talker.py

and ran the talker, which continuously printed lines like:

[INFO] [WallTime: 1406648603.610351] hello world 1406648603.61

With everything closed, I tried to see if the slave computer could subscribe to topics on the other computer, with ROS and some nodes already running from earlier. I did

rostopic list

in a new terminal and it said

ERROR: Unable to communicate with master!

I did

export ROS_MASTER_URI=http://<master>@<master's IP>:11311 

and then tried to list the topics, and they all listed. When I did

rostopic echo /joint_states

nothing printed. It looked like it was ready to print, but nothing did. I tried

ssh <master>@<master's IP>
rostopic echo /joint_states

and the info printed out no problem.

Does anyone know what the issue is? I never got any error codes. When I tried the tutorial again, using

export ROS_MASTER_URI=http://<master's hostname>:11311 

instead, I got this error:

Unable to register with master node [http://<master's hostname>:11311]: master may not be running yet. Will keep trying.

Thanks!

SOLUTION:

First terminal:

ssh <master>@<master's IP>
export ROS_IP=<master's IP>
roscore

Second terminal:

ssh <master>@<master's IP>
export ROS_IP=<master's IP>
export ROS_MASTER_URI=http://<master's IP>:11311
rosrun rospy_tutorials listener.py

Third Terminal:

export ROS_MASTER_URI=http://<master's IP>:11311
export ROS_IP=<slave's IP>
rosrun rospy_tutorials talker.py

Originally posted by mattc12345 on ROS Answers with karma: 328 on 2014-07-28

Post score: 1


Original comments

Comment by tfoote on 2014-07-28:
Please copy and paste your actual console output into your question so we can see the output as well and try to reproduce. You are probably entering the wrong MASTER_URI but we cannot help you without the actual inputs and outputs.

Comment by mattc12345 on 2014-07-28:
I don't think there is any output from the console. The talker runs fine and prints what it did from the original example, but there is no output at all from the listener. What console output would you expect?

Comment by tfoote on 2014-07-28:
We need to see what you typed on the command line and what the errors or non errors were, including the actual IPs and hostnames. With your sanitization of the outputs the critical information has been removed. With a multiple machine setup the correct usage of the two different IPs and hostnames is important.

Comment by mattc12345 on 2014-07-29:
Okay, I edited the main post with all the info. I don't have enough Karma to include links, so I had to add a space after http:// to be able to post.

Comment by Maya on 2014-07-29:
Shouldn't it be export ROS_MASTER_URI=http://10.243.44.19:11311. Without the quan then ? My guess is that it doesn't know baxterbox as a name

$\endgroup$

1 Answer 1

0
$\begingroup$

Rosanswers logo

Your slave machine probably cannot resolve the hostname of the primary machine.

From the slave machine, you should be able to do rosnode list and then use rosnode ping <node> to ping one of the remote nodes. If rosnode ping fails, try running rosnode info <node> on the node in question to get its hostname, and try to ping that hostname directly.

If it doesn't resolve or can't ping, you need to set ROS_IP on the master before running nodes there.

For more information on why this happens and how it works, watch my roscon talk from last year: http://vimeo.com/67806888


Originally posted by ahendrix with karma: 47576 on 2014-07-29

This answer was ACCEPTED on the original site

Post score: 2


Original comments

Comment by mattc12345 on 2014-07-30:
It seems strange that if I run the listener through ssh on the master, after I set the master URI I can see the listener on the slave rosnode list. But when I try to ping the node, I get this error: ERROR: Unknown host [baxterbox] for node [/listener_6260_1406746344405]

Comment by mattc12345 on 2014-07-30:
I just tried switching master and slave, and the old process worked. When I try only exporting ROS_MASTER_URI on the slave computer, I get this error in roscore on the ssh of the master: Couldn't find an AF_INET address for [robotics] robotics is the hostname of the slave.

Comment by mattc12345 on 2014-07-30:
answers.ros.org/question/163556/how-to-solve-couldnt-find-an-af_inet-address-for-problem/ looks like it is a ROS_IP problem then.

EDIT: Solved, solution at bottom of answer above. Thanks, ahendrix.

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.