General overview
The goal of this lab is to install ROS2 Humble. The final test of the installation will be running terminal commands such as
or and making sure the proper graphical output is displayed.Note: Just to be clear this is not the only way to install ROS2 Humble. The experienced or adventerous students can install ROS without any virtualization software by following insructions available online (e.g. link). In this case students are responsible for making sure ROS and the required packages operate properly.
PC with Ubuntu 20.04 and later, installation steps with Docker
This is a simplified visualization of what we are trying to achive:\ OS => Docker (virtualization software) => Ubuntu 22.04 + ROS2 Humble (container)\ It doesn't matter if you launching Ubuntu using dual booting, or single booting, or using VM software.
- Installing Docker using apt repository (full guide)
- Uninstall old Docker versions
- Set up Docker's apt repository
# 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
- Verify installation success
- Change permissions to run docker without sudo
- Restart PC
- Run the following and make sure there is no error
- Installing Nvidia drivers and Docker support (only if you have Nvidia GPU)
- Test if you have Nvidia drivers installed already
- If you get error consider installing the drivers yourself (see link) or talk to your insructor
- If
nvidia-smireturned proper output, then install Nvidia container toolkit (see full guide here)# one large command 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 # command ended sudo apt-get update sudo apt-get install -y nvidia-container-toolkit sudo nvidia-ctk runtime configure --runtime=docker sudo systemctl restart docker
- Downloading and building Docker image
- Download Dockerfils and navigate terminal to the folder it is stored
- Run the following command (make sure to include "." in the last line)
- For the class purposes I used the abridged version of the docker image (see first line of the Docker file). Outside of the class please delete the first line and uncomment the second line (FROM osrf/ros:humble-desktop-full)
- Running Docker container
- If you have Nvidia GPU, run the following command
- If you don't have Nvidia GPU, run the following command
PC with Ubuntu 22.04, installation steps without Docker
-
Make sure your system is up to date
-
Install supplementary packages
-
Install ROS2 Humble
Follow official instructions from here
-
Install supplementary ROS packages
-
Fix python
setuptoolspackage -
Install TB3 ROS packages
-
Set up TB3 workspace
-
Source your ROS2 installation and
colconautocompleteecho 'source /opt/ros/humble/setup.bash' >> $HOME/.bashrc echo 'source /usr/share/colcon_cd/function/colcon_cd.sh' >> $HOME/.bashrc echo 'source /usr/share/colcon_argcomplete/hook/colcon-argcomplete.bash' >> $HOME/.bashrc echo 'export ROS_DOMAIN_ID=1' >> ~/.bashrc echo 'export ROS_LOCALHOST_ONLY=1' >> ~/.bashrc echo 'export TURTLEBOT3_MODEL=waffle_pi' >> $HOME/.bashrc echo '#source $HOME/tb3_ws/install/setup.bash' >> $HOME/.bashrc echo '#source /usr/share/gazebo/setup.bash' >> $HOME/.bashrc -
(Optionally but recommended) Download tmux config file
PC with Windows 10 and later, installation steps with Docker
On Windows machines our setup will have another virtualization layer but the rest will repeat Ubuntu setup Windows 10 => WSL2 with Ubuntu 20.04 (virtualization software) => Docker (virtualization software) => Ubuntu 22.04 + ROS2 Humble (container) 1. Installing WSL2 (see full guides 1, 2) * Run Powershell as Administrator * Verify compatibility of your system
* Enable Windows Machine Platform Set WSL2 as the default version for future WSL installations * Install Ubuntu 20.04 in WSL 2 * To launch WSL2, start Powershell in a regular mode and run 2. Follow instructions from "PC with Ubuntu 20.04 and later ...". All commands should be executed from WSL2 environmentMac laptops
There are some issues with GPU acceleration support for Docker applications running on Mac. Mac users should use VMware Fusion virtualization software instead. This is a simplified visualization of what we are trying to achive:\ Mac OS => VMware Fusion (virtualization software) => Ubuntu 22.04 + ROS2 Humble (container)\ Since VMware Fusion can be taxing on resources of Mac laptops, we won't use Docker as a middle virtualization layer. Instead
- Download VMware Fusion 13. Use one of these options:
- Follow UMD Terpware instructions
- Download VMware Fusion Tech Preview 2023 as described here
- Install VMware Fusion 13 (Tech Preview) on your Mac laptop
- Download Ubuntu 22.04 desktop image
- Use the downloaded Ubuntu image to create a new Virtuale Machine
- Start the Virtuale Machine and follow instructions from "PC with Ubuntu 22.04 ..."
Installation test
- Start Docker container using image that you built (
tb3_image). - Verify that ROS2 environmental variables are set
- Verify that graphics output is working (you should see a popup window with rotating gears)
- Verify that Gazebo is installed (you should see empty Gazebo environment)
IDE installation (optional)
Install your IDE of choice, e.g. VS Code
Troubleshooting
General
-
Tmux shortcuts don't work (e.g. when trying to create new panes)
- If you are using setup with Docker, make sure that you copied the tmux config file into your home folder
- If you are using setup with Docker, talk to your instructor. Perhaps you are entering the shortcuts incorrectly
-
Problems with listing ROS2 nodes
- Restart your ROS2 daemon
Windows PC
-
Issues with connecting to Docker daemon but
If it works, you'll have to run this command every time you launch WSL2 terminal. There is a workaround that we can discuss deparately.docker versionworks properly. Try starting docker service manually, in the WSL2 terminal run -
When launching GUI apps in docker, it throws an error because it cannot access DISPLAY variable.
- If running Windows 10 make sure the OS build version is above 19044. If not, run the system update.
- In the Powershell run
- If the issue persists, check if you have the GPU drivers installed, see here
Suggestion (Windows PC)
- Remove path to windows binaries in WSL2
- Edit /etc/wsl.conf, e.g.
- Add the following to the file
- Restart WSL