Setting up ROS 2 Humble Hawksbill on Ubuntu
Environment
Ubuntu 22.04
Setup Sources
Enable the Ubuntu Universe repository.
sudo apt install software-properties-common
sudo add-apt-repository universeAdd the ROS 2 GPG key with apt.
sudo apt update && sudo apt install curl
sudo curl -sSL https://raw.githubusercontent.com/ros/rosdistro/master/ros.key -o /usr/share/keyrings/ros-archive-keyring.gpgAdd 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/nullInstall ROS 2 packages
WARNING: ROS2 tools like colcon does not quite work with
condaenvironments, so it's recommended to install ROS-related things directly under system environment. In this case, make sure when running the commands, the conda environment is disabled:> (base)$ conda deactivate > $
aptwill install things to system directory, butpipwill install it to current active Python directory.
Update apt repository caches after setting up the repositories, and ensure the system is up to date before installing new packages.
sudo apt update
sudo apt upgradeInstall Desktop Install, including ROS, RViz, demos, and tutorials.
sudo apt install ros-humble-desktopInstall Colcon
Colcon is a tool used to build ROS 2 software packages.
sudo apt update
sudo apt install python3-colcon-common-extensionsAdding Environment Variables
Colcon also has a tool, colcon_cd, to help navigating to package directories.
# ROS 2 Humble
source /opt/ros/humble/setup.sh
source /usr/share/colcon_cd/function/colcon_cd.shAdditional Tools
sudo apt install python3-rosdep2
rosdep updateother possible required dependencies
sudo apt install ros-humble-joint-state-publisher-gui
sudo apt install ros-humble-xacroWith Ubuntu 22.04 + ROS 2 Humble combination, we also need the following dependencies for building turtlesim:
pip install empy
pip install larkInstall Gazebo support
sudo apt install ros-humble-gazebo-ros2-control ros-humble-gazebo-rosLast updated
Was this helpful?