Ask Your Question
9

Running ROS across multiple machines [closed]

asked 2012-07-12 10:48:34 -0500

antonella gravatar image

updated 2012-07-13 07:05:21 -0500

I am attempting to run ROS across multiple machines. To test if everything is working, I'm trying to run a publisher on one machine, and subscribe to the published messages on the other machine. My setup is as follows:

Machine1 has the IP 192.168.1.101 (machine_1_ip)

Machine2 has the IP 192.168.1.111 (machine_2_ip)

I have edited the /etc/hosts file on each machine to reflect this:

Machine1 /etc/hosts has the entry: 192.168.1.111 Machine2

Machine2 /etc/hosts has the entry: 192.168.1.101 Machine1

I can ping between the machines just fine.

I set up the ROS_MASTER_URI and ROS_MASTER_IP on 1 and 2:

Machine1:

export ROS_MASTER_URI=http://Machine1:11311
export ROS_IP=machine_1_ip

Machine2:

export ROS_MASTER_URI=http://machine_1_ip:11311
export ROS_IP=machine_2_ip

Then, I run the following launch file:

<launch>

  <machine name="Machine1" address="machine_1_ip" ros-root="$(env ROS_ROOT)"
     ros-package-path="$(env ROS_PACKAGE_PATH)" user="mach1user" default="true" />

  <machine name="Machine2" address="machine_2_ip" ros-root="$(env ROS_ROOT)"
     ros-package-path="$(env ROS_PACKAGE_PATH)" user="mach2user" />

  <node name="master_node" pkg="master_node" type="Master.py" />

  <env name="ROS_MASTER_URI" value="http://Machine1:11311" />

</launch>

master_node is running a simple publisher that I want to subscribe to from Machine2. The publisher publishes a series of strings.

From Machine2, I can run rosnode/rostopic/rosservice list and see everything that's running on Machine1 (including the topic I want to subscribe to). However, when I run a subscriber on Machine2, it stops at the line that is supposed to subscribe. It doesn't give an error, it just sits there until I kill it (and it doesn't give an error after I kill it either).

I am fairly new to ROS, but I've read up on all the multiple machines and network setup stuff. I'm really not sure what's going wrong. Any help would be much appreciated! Thanks!

edit retag flag offensive reopen merge delete

Closed for the following reason the question is answered, right answer was accepted by SL Remy
close date 2017-07-21 00:23:46.246221

Comments

Where did the cinemaster ros master line come from?

Daniel Stonier gravatar imageDaniel Stonier ( 2012-07-12 11:53:30 -0500 )edit

Sorry about that. I was changing the names to make them more "universal" but I forgot that one. It should be Machine1 (our master machine).

antonella gravatar imageantonella ( 2012-07-12 12:26:59 -0500 )edit

What exactly do you see when you run "rostopic info" on the topic (from each machine) when all the nodes are running?

SL Remy gravatar imageSL Remy ( 2012-07-14 18:12:11 -0500 )edit

4 Answers

Sort by ยป oldest newest most voted
5

answered 2012-07-16 13:10:13 -0500

antonella gravatar image

updated 2012-07-17 08:59:19 -0500

It turns out it was a problem with the ROS_HOSTNAME variable. Somehow, certain processes on the master were running under a different hostname than others. Considering this, I'm not sure why the client was still able to see/ping all the nodes, because it seems like it would have been looking in the wrong place (i.e. under a different master process). (?)

Anyway, now I just run export ROS_HOSTNAME=Machine1 before the setup steps above (on both Machine1 and Machine2) and everything seems to work fine. So now the setup process is:

Machine1:

export ROS_HOSTNAME=Machine1    
export ROS_MASTER_URI=http://Machine1:11311
export ROS_IP=machine_1_ip

Machine2:

export ROS_HOSTNAME=Machine1  
export ROS_MASTER_URI=http://machine_1_ip:11311
export ROS_IP=machine_2_ip
edit flag offensive delete link more

Comments

You're lucky the ROS_IP is overriding the ROS_HOSTNAME. You should be setting ROS_HOSTNAME to the resolvable hostname to identify each individual computer. See http://www.ros.org/wiki/ROS/NetworkSetup

tfoote gravatar imagetfoote ( 2012-08-09 22:47:12 -0500 )edit
1

answered 2012-07-12 19:07:14 -0500

MarkyMark2012 gravatar image

looks like your URI. should be export ROS_MASTER_URI=http://Machine1:11311 - check case too on both machines. So long as your hosts file is correct shouldn't be a problem

edit flag offensive delete link more

Comments

I tried that and the same problem is still happening. I think the problem is the subscriber on the remote machine isn't entering its callback function, but I don't know why. The same subscriber run on the local machine works just fine. Is it possibly a problem with the subscriber's namespace?

antonella gravatar imageantonella ( 2012-07-13 07:52:47 -0500 )edit
0

answered 2014-08-05 23:32:27 -0500

ttuuttuututu gravatar image

hi, I just meet the same problem. Have you solved the problem?

edit flag offensive delete link more

Comments

The original author posted a very detailed answer indicating that they have solved the problem.

ahendrix gravatar imageahendrix ( 2014-08-06 00:01:32 -0500 )edit
0

answered 2017-04-06 07:26:15 -0500

cakiva gravatar image

Hey, I had a similar problem. Can you have your own network configuration on your computer where you manually configure the IP addresses? That was the case with my computers. The solution was on the computer where the master master ran to change the IP address to which we refer everyone (ROS_MASTER_URI) to be the first address in the configuration.

(Network connections-> choseyour connection-> edit-> IPv4 settings-> up this IP to top of the list)

thanks to michele

edit flag offensive delete link more

Question Tools

1 follower

Stats

Asked: 2012-07-12 10:48:34 -0500

Seen: 6,886 times

Last updated: Apr 06 '17