ROS_MASTER_URI not taken, ubuntu hostname taken instead
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:
127.0.0.1 localhost
127.0.1.1 pablo-Aspire-V5-573G
10.42.0.1 pablo
10.42.0.97 raspberrypi1
Raspberry pi:
127.0.0.1 localhost
::1 localhost ip6-localhost ip6-loopback
fe00::0 ip6-localnet
ff00::0 ip6-mcastprefix
ff02::1 ip6-allnodes
ff02::2 ip6-allrouters
10.42.0.97 raspberrypi1
10.42.0.1 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
SUMMARY
========
PARAMETERS
* /rosdistro: jade
* /rosversion: 1.11.16
NODES
auto-starting new master
process[master]: started with pid [6971]
ROS_MASTER_URI=http://pablo-Aspire-V5-573G:11311/
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?
Just to make sure:
export
does not do anything permanent, so you'll have to keep doing that each time before you startroscore
or any other ROS binary (or add it to your.bashrc
fi). I mention this because of thehttp://localhost:11311
on your RPi.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).