Ask Your Question
0

Set ROS_MASTER_URI on remote robots

asked 2016-03-10 08:30:26 -0500

fabbro gravatar image

updated 2016-03-10 08:45:20 -0500

Hi everyone,

I tried searching on the internet, but I didn't find exactly what I wanted.

I have the following infrastructure:

PC : 192.168.0.100 Robot1 : 192.168.10.101 Robot2 : 192.168.10.102 Robot3 : 192.168.10.103

The robots are always the same but the PC can change. If I use mine that is the IP , if someone else uses another one the IP changes.

For this reason everytime I start an experiment I need to make sure to do an export on the Robot1-2-3 of my ROS_MASTER_URI.

I am sure there is a way of doing it in one of the launch files I use but I didn't find yet a solution which is fast and clean.

Could you please point me in the right direction?

EDIT:

I do :

<machine name="Robot1" address="192.168.10.101" user="odroid" env-loader="/home/odroid/catkin_ws/devel/env.sh" default="true"> </machine>

I would like to pass directly the environment variable ROS_MASTER_URI in the previous lines but I know it is not possible anymore. Do you know how should I modify the env.sh file to tell it to do an

export ROS_MASTER_URI="http://192.168.0.100:11311"

Where, as I said before, 192.168.0.100 is the IP of my PC where the ros master is running. Thanks a lot.

edit retag flag offensive close merge delete

3 Answers

Sort by ยป oldest newest most voted
1

answered 2016-03-10 08:46:56 -0500

gvdhoorn gravatar image

This is a situation in which a DNS server (which is coupled with / knows how to deal with your DHCP server) would work best. Instead of using IP addresses, you'd give hostnames to your robots and your PC, and then make sure the DNS server can resolve the hostnames to the IPs (and back).

All your robots would then have ROS_MASTER_URI=http://hostname_of_your_pc:11311, which would work no matter what IP your PC gets. You would also need to make sure ROS_HOSTNAME is configured correctly on all three robots & your PC.

edit flag offensive delete link more

Comments

ok. Let's say on all the robots I have: ROS_MASTER_URI=http://hostname_of_your_pc:11311

This means that I have to set my ROS_MASTER_URI on my PC to : ROS_MASTER_URI=http://hostname_of_your_pc:11311

But also set the default of the machines to NEVER. Right?

fabbro gravatar image fabbro  ( 2016-03-10 09:09:53 -0500 )edit

The value of ROS_MASTER_URI on your PC doesn't really matter for your robots. It's only used locally. You can leave it at the default (using localhost) or change it to the hostname.

But also set the default of the machines to NEVER. Right?

I don't understand what this means.

gvdhoorn gravatar image gvdhoorn  ( 2016-03-10 09:27:18 -0500 )edit
0

answered 2016-03-10 11:03:45 -0500

zhibo gravatar image

nano~/.bashrc and add this at the end

export ROS_MASTER_URI="http://192.168.10.101:11311"` 
#export ROS_MASTER_URI="http://192.168.10.102:11311"
#export ROS_MASTER_URI="http://192.168.10.103:11311"

comment the lines you want, save and open another terminal, this is the case when your robot is the master, and you are operating only one robot, if you want to operate multiple robots, you can check the turtlebot concert, basically your pc is the master and the robots are the slaves.

edit flag offensive delete link more
0

answered 2016-03-10 08:45:58 -0500

alee gravatar image

updated 2016-03-10 08:46:28 -0500

If I understand the problem correctly, perhaps the machine tag is what you're looking for? ( http://wiki.ros.org/roslaunch/XML/mac... )

Or you could just put them in the ~/.bashrc file and it would happen on startup.

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

1 follower

Stats

Asked: 2016-03-10 08:30:26 -0500

Seen: 1,345 times

Last updated: Mar 10 '16