ROS2 Installation

_images/humble.png

The ROS driver for the robots is initially supported for the ROS2 Humble. All of ROS related software should be installed in a remote Husky-PC as well as the Remote-PC. The steps for shown below are for Remote-PC as the Husky is pre-installed with the required drivers and ROS distribution.

Warning

Care should be taken when installing ROS so that it matches with your CPU’s architecture (i.e. armhf, amd64, arm6, etc.)

Note

All the ROS related software should be installed/run on remote PC/Rasberry Pi/Nvidia board, nothing needed to be installed on robots control board if bought with the ROS pkg.

PC Setup

ROS2 Humble installation requires Ubutnu 22.04.

  1. Download Ubuntu 22.04

  2. Follow the Ubuntu 22.04 installation guide

ROS Humble Installation

The ROS driver provided can be run either on a remote PC or on board robot computer. Typically, the on-board computer already has a pre-installed ROS distribution, so the instructions below will be applicable to a remote computer. You may execute the following commands to install ROS Humble, or you can simply follow the instructions from the ROS Wiki.

Set Locale

Ensure that your system supports UTF-8 locale. Verify your locale settings with the following command:

locale

If necessary, set up a UTF-8 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

Setup Sourcess

Add the ROS2 apt repository to your system. First, make sure that the Ubuntu Universe repository Ubuntu Universe repository is enabled:

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

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

Install ROS2 Packages

Update your apt repository caches after setting up the repositories:

sudo apt update

Ensure your system is up to date before installing new packages:

sudo apt upgrade

Warning

Due to early updates in Ubuntu 22.04 it is important that systemd and udev-related packages are updated before installing ROS2. The installation of ROS2’s dependencies on a freshly installed system without upgrading can trigger the removal of critical system packages.

Please refer to ros2/ros2#1272 and Launchpad #1974196 for more information.

ROS-Base Install (Bare Bones)

Install communication libraries, message packages, and command line tools without GUI tools:

sudo apt install ros-humble-ros-base

Development Tools

Install compilers and other tools to build ROS packages:

sudo apt install ros-dev-tools

Environment Setup

Source the setup script to set up your environment:

# Replace ".bash" with your shell if you're not using bash
# Possible values are: setup.bash, setup.sh, setup.zsh
source /opt/ros/humble/setup.bash

Try Some Examples

If you installed Desktop Install (Recommended) above, try some examples:

Run a C++ talker in one terminal:

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

Run a Python listener in another terminal:

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

This verifies both the C++ and Python APIs are working properly.

Next Steps After Installing

Continue with the tutorials and demos to configure your environment, create your own workspace and packages, and learn ROS2 core concepts.

Using the ROS1 Bridge

Connect topics from ROS1 to ROS2 and vice-versa using the ROS1 bridge. See the dedicated documentation on how to build and use the ROS1 bridge.

Additional RMW Implementations (Optional)

ROS2 uses Fast DDS as the default middleware (RMW), but you can replace it at runtime. See the guide on how to work with multiple RMWs.

Troubleshooting

Refer to the troubleshooting techniques found here if you encounter any issues.

Uninstall

If you need to uninstall ROS2 or switch to a source-based install once you have already installed from binaries, run the following command:

sudo apt remove ~nros-humble-* && sudo apt autoremove

You may also want to remove the repository:

sudo rm /etc/apt/sources.list.d/ros2.list
sudo apt update
sudo apt autoremove
# Consider upgrading for packages previously shadowed.
sudo apt upgrade