Ask Your Question
2

Running ROS across multiple machine

asked 2016-10-26 17:05:03 -0500

farhansajjad gravatar image

updated 2016-10-27 02:43:40 -0500

gvdhoorn gravatar image

I'm trying to run ROS on two machines which are connected to a local network. Both can ping each other.

I started roscore on first machine and set the ROS_MASTER_URI=http://192.168.0.22:11311 to the second machine. When I run rosnode list on the second machine it shows /rosout node. But when I start a node on the second machine it fails saying:

[ERROR] [1477518161.033462327]: [registerPublisher] Failed to contact master at [localhost:11311].  Retrying...

It keeps looking for ros master on the same machine. I don't know why. Both machines are running Ros Indigo.

Any help would be much appreciated.

edit retag flag offensive close merge delete

Comments

How did you "set the ROS_MASTER_URI=.. exactly?

Can you add the output of echo $ROS_MASTER_URI (from both machines) to your question?

gvdhoorn gravatar imagegvdhoorn ( 2016-10-27 02:44:32 -0500 )edit

Please also add the output of echo $ROS_IP and echo $ROS_HOSTNAME for both machines to your question. Use the edit button/link to update it.

gvdhoorn gravatar imagegvdhoorn ( 2016-10-27 02:45:39 -0500 )edit

Yea i think you have to use export ROS_IP=192.168.0.22 and also the export ROS_MASTER_URI=http://192.168.0.22:11311 in order to be able to communicate between both machines

gijsje170 gravatar imagegijsje170 ( 2016-10-27 03:58:11 -0500 )edit

2 Answers

Sort by ยป oldest newest most voted
2

answered 2016-10-27 06:42:14 -0500

SilverBullet gravatar image

updated 2016-10-27 06:43:16 -0500

On each machine, you should export ROS_MASTER_URI = http:// master_ip:11311 and export ROS_HOSTNAME = this_machine_ip. For each terminal, these two environment variables should be set, so it's recomanded that you write them in .bashrc .
The former variable is used to tell this machine where the master(roscore) is. The latter variable is used to tell master where this machine is for registering node.

xx_ip above should be replaced by your ip conf.Hope this answer helps.

edit flag offensive delete link more

Comments

export ROS_HOSTNAME = this_machine_ip

No. If you use ROS_HOSTNAME, set it to the hostname of the machine. If you want to use IPs, set ROS_IP.

Also: this is only needed if you don't have a working DNS (ie: can resolve all names of involved hosts to their IPs, using a DNS server or similar)

gvdhoorn gravatar imagegvdhoorn ( 2016-10-27 06:46:24 -0500 )edit

From your error message, I think ROS_MASTER_URI is not set correctly. Maybe you start a new window of terminal without setting variables for the new terminal?

SilverBullet gravatar imageSilverBullet ( 2016-10-27 06:47:48 -0500 )edit

Yeah, I think it's better to set ip for ROS_IP and hostname for ROS_HOSTNAME. But both can be used in practice since I've been setting ip for ROS_HOSTNAME and it has been working very well.:)

SilverBullet gravatar imageSilverBullet ( 2016-10-27 06:52:16 -0500 )edit
0

answered 2016-10-27 12:57:15 -0500

farhansajjad gravatar image

updated 2016-10-27 13:00:45 -0500

I got it working now. The reason was that i'm using ssh to access other machine and i was setting ROS_MASTER_URI for only one.

You have to set the environment variables for each terminal window if master is not on the same machine or you can add it to .bashrc. And yeah, setting only ROS_MASTER_URI will do the trick.

Thanks for your help, much appreciated.

edit flag offensive delete link more

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools

2 followers

Stats

Asked: 2016-10-26 17:05:03 -0500

Seen: 549 times

Last updated: Oct 27 '16