[Solved] Running tutorial image: host is not set to this machine

Hello,

I am new to Linux, ROS, Virtual Machines and everything that comes with it, but I need to learn this for my Master thesis.

As a preparation for when the Rosbot 2.0 Pro arrives, I want to try out ROS and Gazebo and program my own nodes using Python. I’m running into issues however.

First of all, I’m using Oracle VM VirtualBox and I added an Ubuntu 64-bit machine.
I used the ‘ready to go virtual machine image’ from the Husarion fileserver. Which I unzipped and placed in the ‘Ubuntu Rosbot’ folder my hard disk where the virtual machine was set up from inside VirtualBox (at first without storage). Then linked the storage to the unzipped ‘husarion-vm.vmdk’.

After which I booted the VM and continued following the tutorial, typing roscore in the Terminal Emulator.
This resulted in: WARNING: ROS_MASTER_URI [http://master:11311] host is not set to this machine among other errors. After which I followed the steps in these two topics:
GPG keys
host is not set to this machine
Including me updating the image using:

sudo apt update
sudo apt upgrade

and opening sudo nano /etc/hosts and adding to the end:

127.0.0.1 husarion
: : 1 master # managed by Husarnet
: : 1 husarion # managed by Husarnet

But sadly I am still getting an the same errors, just with a newer version:

husarion@husarion:~$ roscore
... logging to /home/husarion/.ros/log/7ed8454a-eb33-11e9-8de0-080027c27cd8/roslaunch-husarion-1282.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://husarion:40162/
ros_comm version 1.12.14


SUMMARY
========

PARAMETERS
 * /rosdistro: kinetic
 * /rosversion: 1.12.14

NODES

WARNING: ROS_MASTER_URI [http://master:11311] host is not set to this machine
auto-starting new master
process[master]: started with pid [1292]
ROS_MASTER_URI=http://husarion:11311/

setting /run_id to 7ed8454a-eb33-11e9-8de0-080027c27cd8
process[rosout-1]: started with pid [1305]
started core service [/rosout]
[ERROR] [1570694202.393455221]: [registerService] Failed to contact master at [husarion:11311].  Retrying...

I’m fine with deleting the virtual machine and starting from 0 again if that is better.
If that is not the best option and this can be easily fixed, then what should I do to be able to get this running so I can start experimenting with ROS, Lidar, RGB-D, Gazebo (and more?) until my physical Rosbot 2.0 Pro arrives?

I hope I have provided enough information.
Regards,
Patrick

Hello Patrick,

Entry in /etc/hosts file should be

::1 master # managed by Husarnet
::1 husarion # managed by Husarnet

It is without spaces between “:” and “1”. I can see that in topic you mentioned it was posted with the spaces, It must be an editorial mistake, sorry for that.

Regards,
Łukasz

1 Like

Hello Łukasz,

Thank you for your help, this fixed my issue and I can now run roscore and continue with turtlesim and turtle_teleop_key!

Just a quick question, why did this fix it? What does ::1 master and ::1 husarion do in the first place?

Regards,
Patrick

Hello Patrick,

File /etc/hosts contains list of static addresses mapped to hostnames.
Structure of file is in each line:

<IP_ADDRESS> <HOSTNAME>

The ::1 is IP address of local host, thus mapping of ::1 master redirects master to local address.
Sometimes it is convenient to run ROS on more than one device, then master will be mapped to other address.

Regards
Łukasz

1 Like

Hello Łukasz,

Thank you for the clear and quick explanation, this really furthers my understanding of how ROS works :slight_smile:

I will edit the title to include [Solved]

Regards,
Patrick