Install ROS 2 Humble Hawksbill on Ubuntu 22.04 (Jammy Jellyfish)

Alper YazarAlper Yazar
2 min read

The steps are clearly defined here. When I followed the instructions, I didn't encounter any problems but for completeness here I write most of the steps verbatim.

The original instructions start with checking locele. I find that the default locale for standard Ubuntu English installation on x86 PC is already en_US.UTF-8 but I would make sure and check the locale.

Example settings from my machine (Although the selected language was English during installation, my timezone is İstanbul/Turkey and I think this is the reason behind some tr_TR.UTF-8 settings).

Open a terminal and run the command locale.

locale

LANG=en_US.UTF-8
LANGUAGE=
LC_CTYPE="en_US.UTF-8"
LC_NUMERIC=tr_TR.UTF-8
LC_TIME=tr_TR.UTF-8
LC_COLLATE="en_US.UTF-8"
LC_MONETARY=tr_TR.UTF-8
LC_MESSAGES="en_US.UTF-8"
LC_PAPER=tr_TR.UTF-8
LC_NAME=tr_TR.UTF-8
LC_ADDRESS=tr_TR.UTF-8
LC_TELEPHONE=tr_TR.UTF-8
LC_MEASUREMENT=tr_TR.UTF-8
LC_IDENTIFICATION=tr_TR.UTF-8
LC_ALL=

If you don't see UTF-8, check this section. Let's continue with the installation.

sudo apt install software-properties-common
sudo add-apt-repository universe
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.gpg
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
sudo apt update
sudo apt upgrade
sudo apt install ros-humble-desktop

At the end of the above commands, the most complete ROS2 packages (desktop) should be installed (around 1.1k new packages and 1 GB). By default, ROS Humble is installed on path /opt/ros/humble. To use ros2 commands either we should run source /opt/ros/humble/setup.bash for each terminal session or we should add it the end of the .bashrc. If you are planning to work with ROS, adding it to the end of the .bashrc is more convenient (my recommendation).

Finally, test our setup. Open two terminals then type

1:

source /opt/ros/humble/setup.bash
ros2 run demo_nodes_cpp talker

and 2:

source /opt/ros/humble/setup.bash
ros2 run demo_nodes_py listener

demo_nodes_cpp and demo_nodes_py use C++ and Python bindings for ROS, respectively. talker sends Hello World message with a counter and listener captures messages and prints them. Both C++ and Python programs support sending and receiving test messages thus all the given commands are valid. But testing both C++ and Python bindings at the same time is a good idea.

# All commands are valid
ros2 run demo_nodes_cpp talker
ros2 run demo_nodes_cpp listener
ros2 run demo_nodes_py talker
ros2 run demo_nodes_py listener
💡
ROS 2 supports TAB completion. Feel free to press TAB while writing commands and parameters (separated by spaces) after ros2 command.

The expected output is shown below.

References

0
Subscribe to my newsletter

Read articles from Alper Yazar directly inside your inbox. Subscribe to the newsletter, and don't miss out.

Written by

Alper Yazar
Alper Yazar

I am an electronics engineer interested in digital design, FPGAs, embedded systems, programming and other things...