Setup
In this page you will find the information on how to set up your system for this HIL project. For this step you need the Husarion ROSBot 2, your computer and access to an active network.
Last updated
In this page you will find the information on how to set up your system for this HIL project. For this step you need the Husarion ROSBot 2, your computer and access to an active network.
Last updated
To get started, first you need to create a connection between the Husarion ROSbot 2 and your computer, so they can both access the same running ROS system.
1.a) Connect through WiFi
Connect both your computer and your robot to the same WiFi network.
For more information about how to connect to a WiFi network with an Ubuntu system, visit: https://help.ubuntu.com/stable/ubuntu-help/net-wireless-connect.html.en
For more information about how to connect to a wifi network with the Husarion ROSbot 2, visit: https://husarion.com/manuals/rosbot/#connect-rosbot-to-your-wi-fi-network
1.b) Connect with UTP cables
In case you don't have an available WiFi network, or the connection speed is too slow, you can use UTP cables to connect the robot and your computer to the same network.
The Husarion ROSbot 2 does not have an Ethernet port. To be able to connect to the network with an UTP cable, you need to use an USB-Ethernet converter, for example like the one below:
For the next steps, you will need to know the IP address of both your computer and your robot. You can check the IP address for example by typing the following command in a terminal window:
The Husarion ROSbot has an HDMI port as well as two USB ports. You can use these to connect an external display, a mouse and a keyboard. If you do so, you will see a desktop environment on the display, where you can open and use a terminal the same as you would normally do so with your computer. You can use this terminal to obtain the IP address of the robot.
The command above usually gives you a list of multiple IP addresses. You can use the ip a
command to check which IP address belongs to which network interface. Make sure to choose the IP address for both your computer and your robot that have the same CIDR.
For example if you see the following two IP addresses for your computer: 192.168.103.85, 172.17.0.1
, and the following two for your robot: 192.168.103.76,172.17.0.3
, either choose for both the ones that belong to the 192.168.103.xxx or the other, but don't mix them.
Note: At this step it is important to have a correctly set-up network. If not done so there could be significant problems when trying to access the robot or with the ROS communication.
The Asimovo platform utilizes a container based setup. In this tutorial one of the simulation images of Asimovo will be used. The Dockerfile describing this image is available here.
You can start this container directly on your computer or you can start it using the Asimovo platform. In case of the former, make sure you have docker with GPU support set up on your computer.
For more information about how to do so, visit: https://docs.docker.com/engine/install/ubuntu/ and for Nvidia GPU: https://docs.nvidia.com/datacenter/cloud-native/container-toolkit/latest/install-guide.html.
For more information about Dockerfiles, visit: https://docs.docker.com/develop/develop-images/dockerfile_best-practices/
To build the container image, download the file linked above, go to the folder where this file is located, then use the command docker build . -t hil_setup_noetic_foxy
. This builds a container image with the name hil_setup_noetic_foxy
.
After the build is complete you can use the run.sh script that is available here to start a container instance.
Further in this tutorial it will be assumed that you are working inside this container. To access a running container from other terminal windows you can use the command docker exec -it hil_setup_noetic_foxy /bin/bash
.
Tip: You will need to have many terminal windows (or tabs) opened parallel for your work. In any new terminal you open you have enter the running container with the command above.
This feature is under development. Please come back later for more information.
You can use SSH to access the ROSbot from the container.
Enter the following command in a terminal of your running container to connect: ssh husarion@<ROSbot IP address>
For example if the IP address of your ROSbot is 192.168.103.76 then the connection command will look like: ssh husarion@192.168.103.76
After connecting, the system will ask you for a password. For the Husarion ROSbot 2 used in this project the password is husarion
.
The user should be the same in both the container and in the husarion rosbot's ssh-d terminals. For simplicity, in this tutorial the root user is used in both. You can use the sudo su
command to switch to the sudo user in th Husarion ROSbot ssh'd terminals. In the container by default the root the user is set.
For more information about ssh connections visit: https://www.digitalocean.com/community/tutorials/how-to-use-ssh-to-connect-to-a-remote-server.
As mentioned before, the Husarion ROSbot 2 has ROS1 Noetic installed, while the container has both ROS2 Foxy and ROS1 Noetic. To create a connection between the two ROS versions, the ros2/ros1_bridge will be used, that is also installed in the container.
For the ROS1 specific elements to work, you will need to set the following environmental variables:
You can do so by using the following commands:
For example if the IP address of your ROSbot is 192.168.103.76 and the IP address of your running container (in case of using the --net=host
option the P address of your computer) is 192.168.103.85, furthermore, we want to run ROS master on the ROSbot with the port 46335, then the commands above will look like:
On Husarion ROSbot 2:
On your locally running container :
You have to set these variables in every terminal window where you would like to use any ROS1 specific command.
You can make these settings permanent by for example adding the commands above to a .bashrc file like ~/.bashrc
.
For more information about bashrc visit: https://phoenixnap.com/kb/bashrc
Additionally you also need to modify the /etc/hosts
file in both the ROSbot and in the container, by adding the IP address and hostname of the computer (provided if the --net=host
setting is on when launching the container) and the ROSbot. This means adding the following lines:
For example if the IP address of your ROSbot is 192.168.103.76 and the IP address of your computer (provided if the --net=host
setting is on when launching the container) is 192.168.103.85, then on the Husarion ROSbot 2 you need to add the following two lines to the file /etc/hosts
:
and on your computer:
For more information about network setup with multiple machines for ROS1, visit: http://wiki.ros.org/ROS/NetworkSetup
You're all set up. Now you can start with the HIL project of your choosing.