Developing with docker and ROS#

Overview#

For software development, it is possible to use an Ubuntu 20.04 distro computer, or else the ARI docker provided by PAL Robotics. For facility, using the docker is highly encouraged.

Computer requirements#

A computer with 8 CPU cores is recommended. A powerful graphics card with resolution of at least 1920x1080 pixels is recommended in order to have a better user experience when using visualization tools like rviz and the Gazebo simulator.

In the event you wish to use your own development computer, without a docker, ROS Noetic should be installed on your machine, following instructions of ROS Noetic installation . Note that with this approach different packages may need to be installed separately depending on the need, available at PAL Robotics github.com .

What is a docker?#

Docker is a platform for developers and sysadmins to develop, deploy, and run applications with containers. The use of Linux containers to deploy applications is called containerization. Containers are not new, but their use for easily deploying applications is. Containerization is increasingly popular because containers are:

  • Flexible: Even the most complex applications can be containerized.

  • Lightweight: Containers leverage and share the host kernel.

  • Interchangeable: You can deploy updates and upgrades on-the-fly.

  • Portable: You can build locally, deploy to the cloud, and run anywhere.

  • Scalable: You can increase and automatically distribute container replicas.

  • Stackable: You can stack services vertically and on-the-fly.

If you are interested on how docker works, visit their webpage .

The ARI docker is based on the Linux Ubuntu 20.04 LTS distribution. The docker provides support for Nvidia cards. In case of upgrading the kernel of the development computer PAL Robotics cannot ensure proper support for other graphic cards.

Retrieving the SDK Docker image#

Firstly install Docker for Ubuntu 20.04 following the instructions of the official page. Verify that the Docker Engine installation is successful by running the hello-world image:

1sudo docker run hello-world

PAL Robotics hosted dockers are shared with clients from https://gitlab.com/pal-robotics/[CLIENT_ID] , where [CLIENT_ID] is the short-name provided to each customer.

If access has not been granted yet, raise a Customer Ticket at PAL Robotics requesting the ARI robot docker. An email will be sent inviting you to your specific sub-group. Follow the steps to register to gitlab.com/pal_robotics/. Finally you should be able to enter to your sub-group, and visualize the dockers repository.

From the left tab, Packages and registries ‣ Container Registry, you will see all dockers shared with you. By default, ARI’s development docker will be shared. If additional features are wished to be added, contact Customer Support.

../_images/gitlab_dockers_2.png

You can use the copy button to retrieve the url for using it, it will be needed later instead of PATH_TO_YOUR_DOCKER_IMAGE as seen in the image above.

Run the SDK Docker image#

In order to start any of the dockers loaded on this repository, you will need to log in the docker daemon on gitlab.com:

1docker login registry.gitlab.com

an then enter your personal GitLab user and password. Then you can pull the docker image:

1docker pull PATH_TO_YOUR_DOCKER_IMAGE

Note

For your convenience, we have published some scripts that simplify the launch of a docker with GPU acceleration. Follow the instructions at pal_docker_utils to properly set up your environment with nvidia-docker. If you do not follow the steps properly, you will not be able to run gazebo, rviz or other graphical applications from within the docker container.

Once logged and after configuring pal_docker_utils, you will need to execute the pal_docker.sh script with the name of the image and the application you want to start.

1cd pal_docker_utils/scripts/
2
3./pal_docker.sh -it PATH_TO_YOUR_DOCKER_IMAGE bash

The previous command starts a bash terminal inside a container of the specified image.

Attention

Remember that once inside the docker, any file created or any program installed on the docker will be deleted, if the specific file was not saved on the exchange folder. If the user needs to install a specific software every time, it is better to create a new docker following the instructions on the tutorials, and taking as a base the desired docker image.

If you already have a catkin workspace on your main computer, you can mount it to the ARI docker with:

1./pal_docker.sh -it -v ~/docker_mounts/gallium:/home/user/ -v /home/user/example_ws:/home/user/example_ws/ PATH_TO_YOUR_DOCKER_IMAGE bash

With the above command even if you modify the workspace inside the docker changes will be saved on the main computer.

Setting ROS environment#

In order to use the ROS commands and packages provided in the docker the following command needs to be executed when opening a new sh

1source /opt/pal/gallium/setup.bash

A good way to spare the execution of this command everytime is to append it at the /home/pal/.bashrc file.

Compiling software#

The docker includes the ROS messages, system headers and our C++ open source headers necessary to compile and deploy software to the robot, as well as its Gazebo simulation.

Some of the software APIs that we have developed are proprietary, and their headers are not included by default. If you require them you can contact us through our customer service portal and after signing a non disclosure agreement, they will be provided. These APIs are for accessing advanced features not available through a ROS API.

System Upgrade#

In order to upgrade the software of the docker, you have to use the pal_upgrade_chroot.sh command. Log in as a root and execute:

1/opt/pal/gallium/lib/pal_debian_utils/pal_upgrade_chroot.sh

Notifications will appear whenever software upgrades are available.

ROS communication with the robot#

When developing applications for robots based on ROS, it is typical to have the rosmaster running on the robot’s computer and the development computer or docker running ROS nodes connected to the rosmaster of the robot. This is achieved by setting in each terminal of the development computer running ROS nodes the following environment variable, regardless if using a docker or development computer.

1export ROS_MASTER_URI=http://ari-0c:11311

Note that in order to successfully exchange ROS messages between different computers, each of them needs to be able to resolve the hostname of the others. This means that the robot computer needs to be able to resolve the hostname of any development computer or docker and vice versa. Otherwise, ROS messages will not be properly exchanged and unexpected behaviour will occur.

Do the following checks before starting to work with a development computer running ROS nodes that point to the rosmaster of the robot:

1ping ari-0c

Make sure that the ping command reaches the robot’s computer.

Then do the same from the robot:

1ssh pal@ari-0c
2ping devel_computer_hostname

If ping does not reach the development computer then proceed to add the hostname to the local DNS of the robot. Otherwise, you may export the environmental variable ROS_IP - the IP of the development computer that is visible from the robot. For example, if the robot is set as access point and the development computer is connected to it and it has been given IP 10.68.0.128 (use ifconfig to figure it out), use the following command in all terminals used to communicate with the robot:

1export ROS_MASTER_URI=http://ari-0c:11311
2export ROS_IP=10.68.0.128

All ROS commands sent will then use the computer’s IP rather than the hostname.

Ensure that you can successfully see the robot’s topic with:

1 rostopic list