A Step-by-Step Guide to Installing ROS Humble Hawksbill on Ubuntu 22.04
Introduction
The Robot Operating System, or ROS, is a powerful framework that provides libraries and tools for software developers to create robot applications.
ROS offers hardware abstraction, device drivers, libraries, visualizers, message-passing capabilities, package management, and more. The best part? It's open source and licensed under the BSD license, making it accessible to the entire robotics community.
In this article, we'll walk you through the installation process of ROS Humble Hawksbill on Ubuntu 22.04.
This version of ROS is compatible with Ubuntu 22.04 and comes with a host of exciting features and improvements. So, let's dive right in and get ROS up and running on your system.
Installation Steps
Set Locale
Before we begin the installation, ensure that your system's locale supports "UTF-8." To check your current locale settings and make necessary adjustments, use the following commands:
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
Setup Sources
To install ROS Humble Hawksbill, you'll need to add the ROS 2 apt repository to your system. First, make sure the Ubuntu Universe repository is enabled by running these commands:
sudo apt install software-properties-common
sudo add-apt-repository universe
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
Now, add the ROS 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
Install ROS 2 Packages
After setting up the repositories, update your apt repository caches:
sudo apt update
It's always a good practice to ensure your system is up to date before installing new packages:
sudo apt upgrade
For a Desktop installation (recommended), which includes ROS, RViz, demos, and tutorials, use the following command:
sudo apt install ros-humble-desktop
Environment Setup
To set up your environment, source the ROS setup file:
source /opt/ros/humble/setup.bash
If you want to automatically add ROS environment variables to your bash session every time a new shell terminal is launched, enter the following command:
echo "source /opt/ros/humble/setup.bash" >> ~/.bashrc
To apply the changes, either source the bashrc file using the following command or close and reopen your terminal:
source ~/.bashrc
Check Installation
To confirm that ROS Humble Hawksbill has been installed successfully, open a new terminal and run the following commands:
In one terminal, source the setup file and then run a C++ talker:
ros2 run demo_nodes_cpp talker
In another terminal, source the setup file and run a Python listener:
ros2 run demo_nodes_py listener
You should see the talker publishing messages and the listener receiving them. This verifies that both the C++ and Python APIs are functioning correctly.
Conclusion
Congratulations! You've successfully installed ROS Humble Hawksbill on your Ubuntu 22.04 system.
With ROS up and running, you're now ready to dive into the exciting world of robotics development, creating innovative applications for robots and autonomous systems.
ROS makes it easier than ever to bring your robotic visions to life.
Have you recently installed ROS Humble Hawksbill on your Ubuntu 22.04 system? Or perhaps you have experience with ROS and want to share your thoughts or tips on using it?
We'd love to hear from you! Drop a comment below and let's start a discussion about your ROS experiences and projects. Your insights and questions are always welcome!
Comments