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

rospy talker listener

asked 2012-03-15 00:08:37 -0500

owh gravatar image

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.

edit retag flag offensive close merge delete

2 Answers

Sort by » oldest newest most voted
0

answered 2012-03-15 04:01:51 -0500

John Hoare gravatar image

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

edit flag offensive delete link more

Comments

@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).

owh gravatar image owh  ( 2012-03-16 00:34:23 -0500 )edit
0

answered 2012-03-15 01:09:12 -0500

michikarg gravatar image
  1. When you are starting a roscore on A, you will only have to export your ROS_MASTER_URI on B and set it to the IP-adress of A

  2. Your second problem is related to Ubuntu/Bash. Every time you start a new terminal, the .bashrc is sourced (which usually is located in your home). By default ROS installation, it loads the setup.bash in your /opt/ros/electric/ folder which sets your ROS_MASTER_URI to localhost.

edit flag offensive delete link more

Comments

@michikarg Thanks for the reply/hints! 1. Tried without export in A and received same behavior. As before, rostopic list showed chatter there but rostopic echo chatter received nothing (silent wait) on A, while talker busy talking on B (ssh). 2. Ok, I shall just leave it then.

owh gravatar image owh  ( 2012-03-15 01:47:57 -0500 )edit

Question Tools

Stats

Asked: 2012-03-15 00:08:37 -0500

Seen: 969 times

Last updated: Mar 15 '12