0
$\begingroup$

Rosanswers logo

I am trying ROS across two machines and started with the rospy talker/listener exercise. I checked ssh and netcat without problem. However, there are few problems with 'remote' behaviors that I hope to get some help here.

To clarify my problems, say I have two machines A and B.

PROBLEM 1:

  1. Started roscore on A, export ROS_MASTER_URI=A (using IP:port).
  2. From A, ssh to B without problem.
  3. On B (ssh) export ROS_MASTER_URI=A (using IP:port) and rosrun rospy_tutorials talker.py (also tried talker) and talker talked (series of Hello World strings).
  4. On A, rosrun rospy_tutorials listener.py and nothing happened. rostopic list on A showed /chatter on the list.
  5. Tried swap listener, talker and had same behavior.
  6. Tried started roscore on B (ssh), updated ROS_MASTER_URI and tested above. Received same behavior.
  7. Then physical on machine B, tried listener on it, listener can print the messages from talker (started on B through ssh).

It appears that topic from remote connection can be found on the list however the values are not accessible. This does not seem to be connection problem as both machines can see the same master and same set of topics (list). netcat could allow communicate in both ways.

PROBLEM 2:

I exported ROS_MASTER_URI on B through ssh. When physically on B and opened new terminal, the ROS_MASTER_URI need to be re-exported, i.e. every new terminal carry a default ROS_MASTER_URI=http://localhost:11311. Am I right that this is normal Ubuntu behavior?

Thanks for any help.


Originally posted by owh on ROS Answers with karma: 67 on 2012-03-15

Post score: 1

$\endgroup$

1 Answer 1

0
$\begingroup$

Rosanswers logo

My understanding with this is that you have to allow both machines to be able to resolve one another via their hostnames, even if you set the ROS_MASTER_URI as the ip address.

To resolve this, I have added the machine's entries into their respective /etc/hosts files. e.g. Put an entry for B in A's hosts file, and put A in B's hosts file.

I've pulled up the following URL from a quick google search that may explain hosts files in more detail: http://www.faqs.org/docs/securing/chap9sec95.html


Originally posted by John Hoare with karma: 765 on 2012-03-15

This answer was ACCEPTED on the original site

Post score: 0


Original comments

Comment by owh on 2012-03-16:
@John Thanks! That's the problem. So, in ROS we need both IP and Hostname. I did not fix this relationship in hosts file as few machines are on Auto DHCP. I use export ROS_IP as per ROS NetworkSetup tutorial. This has to be done on advertising machine(s).

$\endgroup$

Your Answer

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