Skip to content
On this page

ROS 2

ROS2 (Robot Operating System 2) is the next version of the Robot Operating System (ROS), and it was developed to address some of the limitations of the original ROS. It provides a wide range of tools and libraries for building and operating robots, similar to ROS, and it's designed to be modular and extensible.

ros2!

Here are some of the main features and improvements of ROS2:

Communication: ROS2 uses a new communication middleware called Fast RTPS (Real Time Publish Subscribe) which is based on the DDS (Data Distribution Service) standard. This allows for improved performance and reliability in distributed systems, and enables features such as Quality of Service (QoS) policies and support for different transport protocols.

Operating System support: ROS2 is designed to work with a variety of operating systems including Windows, Linux, and MacOS.

Security: ROS2 introduces support for secure communication and authentication, which is a fundamental requirement for safety-critical systems.

Performance: ROS2 has been designed to have better real-time performance and better scalability than ROS1.

Language support: ROS2 supports multiple programming languages, including C++, Python and now also Rust, which allows developers to use the language that is most appropriate for their application.

Support for micro-ROS: An extension of ROS2 that enables running ROS2 on resource-constrained devices, such as microcontrollers, which makes it more accessible for embedded systems.

ros2_humble!

ROS2 is the next step in the evolution of the ROS framework, and it has been developed to better meet the needs of real-world robots and autonomous systems. It's more secure, more efficient

Native ROS 2

Native ROS 2 components are hardware and software components that have been specifically designed to work with the Robot Operating System 2 (ROS 2). These components are able to communicate using the new communication middleware called Fast RTPS (Real Time Publish Subscribe) and can be integrated seamlessly into a robot system that is built with ROS 2.

Examples of native ROS 2 components can include:

  • Sensors such as cameras, lidars, and IMUs
  • Actuators such as motors and servos
  • Controller boards and Single-Board Computers (SBCs) that run a ROS-compatible operating system
  • Software libraries and drivers that provide ROS 2 interfaces for interacting with the hardware
  • ROS 2 packages that provide additional functionality, such as localization, path planning, and control

Using native ROS 2 components in building a robot allows developers to leverage the powerful and flexible libraries and tools provided by ROS 2 and easily integrate their components with other parts of the robot system. It also allows them to take advantage of the large and active community of developers and researchers who use ROS 2 and to build upon the existing knowledge and resources that are available for ROS 2.

In summary, Native ROS 2 components are hardware and software components that have been specifically designed to work with the Robot Operating System 2 (ROS 2) that can communicate using the new communication middleware called Fast RTPS (Real Time Publish Subscribe) and that can be integrated seamlessly into a robot system that is built with ROS 2. They allow developers to leverage the powerful and flexible libraries and tools provided by ROS 2 and easily integrate their components with other parts of the robot system.

Installing ROS 2 on the Host PC

Installing ROS 2 Humble (the latest version of ROS 2) on your system can be done using the following general steps:

Set locale and make sure you have a locale which supports UTF-8. If you are in a minimal environment (such as a docker container), the locale may be something minimal like POSIX. We test with the following settings. However, it should be fine if you’re using a different UTF-8 supported locale.

locale  
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
locale  
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

Add the ROS 2 Humble repository to your system. Depending on your distribution, you can add the repository to your system's package manager.

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
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

Set up your system's key to allow secure communication with the ROS 2 Humble package repository by running the following

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
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

Update the package lists on your system to include the ROS 2 Foxy repository by running:

sudo apt update
sudo apt update

Install the ROS 2 Humble packages. You can install the base ROS 2 Foxy packages by running the following command:

sudo apt install ros-humble-desktop
sudo apt install ros-humble-desktop

Install the tools

sudo apt install ros-dev-tools
sudo apt install ros-dev-tools

Initialize ROS 2 environment. Before you can use ROS 2, you will need to initialize the environment.

source /opt/ros/humble/setup.bash
source /opt/ros/humble/setup.bash

Verify the installation by running some ROS 2 command like

ros2 --help
ros2 --help

or

ros2 run demo_nodes_cpp talker
ros2 run demo_nodes_cpp talker

It's also important to mention that, as with ROS1, ROS2 requires additional dependencies to be installed on the system. It's recommended to check the ROS 2 Humble installation documentation for more information on these dependencies and specific installation instructions according to your operating system, as well as the ROS 2 Humble API documentation for additional information on ROS 2 and the available packages.

Thirdparty Packages

To run RQT image viewer and IMU viewer in RViz you will need to install additional packages as follows:

sudo apt install ros-humble-perception
sudo apt install ros-humble-imu-tools
sudo apt install ros-humble-perception
sudo apt install ros-humble-imu-tools