Ask Your Question

ROS_MASTER_URI not taken, ubuntu hostname taken instead

asked 2016-04-19 06:48:39 -0500

pgarcia gravatar image

Hi everybody,

I'm running ROS in two machines, in my laptop and in a Raspberry Pi. I'm connecting them through an Ethernet cable. I configured the hostnames in both of them (/etc/hosts):

Laptop:       localhost       pablo-Aspire-V5-573G       pablo     raspberrypi1

Raspberry pi:       localhost
::1             localhost ip6-localhost ip6-loopback
fe00::0         ip6-localnet
ff00::0         ip6-mcastprefix
ff02::1         ip6-allnodes
ff02::2         ip6-allrouters      raspberrypi1       pablo

With this configuration, I can ping between them without problem, i.e. ping raspberrypi1 at my laptop, and ping pablo at the Raspberry Pi. Also, I use:

At my laptop:

export ROS_HOSTNAME=pablo
export ROS_MASTER_URI=http://pablo:11311

At the Raspberry Pi:

export ROS_HOSTNAME=raspberrypi1
export ROS_MASTER_URI=http://pablo:11311

So I want my laptop to be the master, and the Raspberry to be the slave and send messages to my laptop.

Well I ran roscore at my laptop, and I see:

pablo@pablo-Aspire-V5-573G:~$ roscore
... logging to /home/pablo/.ros/log/fc0545e6-0620-11e6-8814-78843c3472e1/roslaunch-pablo-Aspire-V5-573G-6959.log
Checking log directory for disk usage. This may take awhile.
Press Ctrl-C to interrupt
Done checking log file disk usage. Usage is <1GB.

started roslaunch server http://pablo-Aspire-V5-573G:54165/
ros_comm version 1.11.16


 * /rosdistro: jade
 * /rosversion: 1.11.16


auto-starting new master
process[master]: started with pid [6971]

setting /run_id to fc0545e6-0620-11e6-8814-78843c3472e1
process[rosout-1]: started with pid [6984]
started core service [/rosout]

It's taking ROS_MASTER_URI=http://pablo-Aspire-V5-573G:11311/ , but not ROS_MASTER_URI=http://pablo:11311/ as I was expecting! Actually pablo-Aspire-V5-573G is the hostname of my computer in Ubuntu, and ROS takes this one, instead of the one a gave him (pablo). When I run a publisher at the Raspberry Pi, I get:

Unable to register with master node [http://localhost:11311]: master may not be running yet. Will keep trying.

I could fix it just changing everywhere pablo by pablo-Aspire-V5-573G, but still I wonder why it is not working.

Any ideas?

edit retag flag offensive close merge delete


Just to make sure: export does not do anything permanent, so you'll have to keep doing that each time before you start roscore or any other ROS binary (or add it to your .bashrc fi). I mention this because of the http://localhost:11311 on your RPi.

gvdhoorn gravatar image gvdhoorn  ( 2016-04-19 08:59:49 -0500 )edit

Thanks for your comment! Yes, I added them to both .bashrc.

To be sure, I also run echo $ROS_HOSTNAME, and both were right (raspberrypi1 and pablo).

pgarcia gravatar image pgarcia  ( 2016-04-19 09:34:41 -0500 )edit

2 Answers

Sort by ยป oldest newest most voted

answered 2016-04-19 09:30:32 -0500

Orhan gravatar image

Try to change sequence of and I think your laptop uses first one;

started roslaunch server http://pablo-Aspire-V5-573G:54165/

Starts master with,

edit flag offensive delete link more

answered 2016-04-19 09:44:23 -0500

pgarcia gravatar image

Ok, I fixed it!

I was executing the publisher in the Raspberry as super user (because one of the libraries I use needs it). Then, editing the .bashrc under super user, fixed the problem.

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


Asked: 2016-04-19 06:48:39 -0500

Seen: 833 times

Last updated: Apr 19 '16