ROS2 Humble Installation - Weber-State-UAV-Program/Documentation-2024-2025 GitHub Wiki

This project uses ROS2 Humble. This version of ROS is only compatible with Ubuntu 22.04. Upgrading to a newer version of ubuntu would require porting of all ROS2 code to the its proper version. For ubuntu 24.04, it is ROS2 Jazzy.

Installing ROS2 Humble

1. Set locale

locale  # check for UTF-8

sudo apt update && sudo apt install locales
sudo locale-gen en_US en_US.UTF-8
sudo update-locale LC_ALL=en_US.UTF-8 LANG=en_US.UTF-8
export LANG=en_US.UTF-8

locale  # verify settings

2. Setup Sources

You will need to add the ROS2 apt repository to your system.

First ensure that the Ubuntu Universe Repository is enable.

sudo apt install software-properties-common
sudo add-apt-repository universe

Now add the ROS2 GPG key with apt.

sudo apt update && sudo apt install curl -y
sudo curl -sSL https://raw.githubusercontent.com/ros/rosdistro/master/ros.key -o /usr/share/keyrings/ros-archive-keyring.gpg

Then add the repository to your sources list.

echo "deb [arch=$(dpkg --print-architecture) signed-by=/usr/share/keyrings/ros-archive-keyring.gpg] http://packages.ros.org/ros2/ubuntu $(. /etc/os-release && echo $UBUNTU_CODENAME) main" | sudo tee /etc/apt/sources.list.d/ros2.list > /dev/null

3. Install ROS2 Packages

Update your apt repository caches after setting up the repositories.

sudo apt update
sudo apt upgrade

Install the base ROS2 tools

sudo apt install ros-humble-ros-base

Install the ROS2 development tools in order to build packages.

sudo apt install ros-dev-tools

4. Source the setup script

Add the source to the shell startup script.

echo "source /opt/ros/humble/setup.bash" >> ~/.bashrc