- Ubuntu
- Intel or AMD processor (with x64 processor architecture). This is the reason why the Docker container won't work directly for example on Apple Silicon, Raspberry or Jetson platforms.
- A computer with sufficient processing power to run Gazebo simulation smoothly.
- Docker. Follow the link for the official tutorial and the latest installation instructions. Optionally, you can follow the commands below, but they might get out of date.
- Git (
sudo apt install git
)
Docker installation instructions
- Set up Docker's
apt
repository by running these commands (one-by-one) in a new terminal:
# Add Docker's official GPG key:
sudo apt-get update
sudo apt-get install ca-certificates curl
sudo install -m 0755 -d /etc/apt/keyrings
sudo curl -fsSL https://download.docker.com/linux/ubuntu/gpg -o /etc/apt/keyrings/docker.asc
sudo chmod a+r /etc/apt/keyrings/docker.asc
# Add the repository to Apt sources:
echo \
"deb [arch=$(dpkg --print-architecture) signed-by=/etc/apt/keyrings/docker.asc] https://download.docker.com/linux/ubuntu \
$(. /etc/os-release && echo "$VERSION_CODENAME") stable" | \
sudo tee /etc/apt/sources.list.d/docker.list > /dev/null
sudo apt-get update
- Install the Docker packages by running the following command in the same terminal:
sudo apt-get install docker-ce docker-ce-cli containerd.io docker-buildx-plugin docker-compose-plugin
- Verify your installation by running this command:
sudo docker run hello-world
- Create a
docker
user group.
sudo groupadd docker
- Add your user to the
docker
group.
sudo usermod -aG docker $USER
- Log out and log back in to your system, or run the following command:
newgrp docker
- Test that you can run
docker
commands withoutsudo
.
docker run hello-world
(Optional) If you are running Docker on a Linux machine equipped with an Nvidia GPU and the proper installed drivers
- Configure the production repository:
curl -fsSL https://nvidia.github.io/libnvidia-container/gpgkey | sudo gpg --dearmor -o /usr/share/keyrings/nvidia-container-toolkit-keyring.gpg \
&& curl -s -L https://nvidia.github.io/libnvidia-container/stable/deb/nvidia-container-toolkit.list | \
sed 's#deb https://#deb [signed-by=/usr/share/keyrings/nvidia-container-toolkit-keyring.gpg] https://#g' | \
sudo tee /etc/apt/sources.list.d/nvidia-container-toolkit.list
Optionally, configure the repository to use experimental packages:
sed -i -e '/experimental/ s/^#//g' /etc/apt/sources.list.d/nvidia-container-toolkit.list
- Update the packages list from the repository:
sudo apt-get update
- Install the NVIDIA Container Toolkit packages:
sudo apt-get install -y nvidia-container-toolkit
- Configure the container runtime by using the nvidia-ctk command:
sudo nvidia-ctk runtime configure --runtime=docker
- Restart the Docker daemon:
sudo systemctl restart docker
All the practical examples in this course are containerized with Docker, so no ROS 2 or Gazebo simulation installations are required!
-
Clone the repository:
git clone https://github.com/henki-robotics/robotics_essentials_ros2.git
-
Create a new workspace for your exercises. This will be automatically mounted and available from the Docker container
mkdir -p $HOME/exercises_ws/src
Before anything run the following command in a new terminal. This will give display permissions to your containers:
xhost +
Note: This has to be run everytime you restart your computer
-
Use docker compose to build and run the Docker container, which includes the ROS 2, Gazebo and simulated Andino installation.
cd robotics_essentials_ros2/docker/ docker compose up
-
Open a new terminal with CTRL+ALT+T (or by using right click on Desktop -> "Open in Terminal") and run this command to start a new terminal inside the Docker container:
docker exec -it robotics_essentials_ros2 bash
The docker compose up
command launches the robotics_essentials_ros2
Docker container, which essentially acts as a virtual environment.
It is a completely isolated environment, that includes all the software dependencies you need, including even the Ubuntu operating system.
The docker exec
command on the other hand opens a new terminal inside this Docker container, allowing you to interact with it.
Refer to this section whenever you need to relaunch your Docker container, or start a new terminal during the upcoming exercises.
-
Verify that everything is running correctly, by starting the simulation with:
ros2 launch andino_gz andino_gz.launch.py
Note: Gazebo might take a long while to open up.
-
Press the play button in simulation to start it.
You've now successfully installed everything you need for the upcoming exercises!
Next exercises: Exercises 1: ROS 2 Introduction.