Beginners guide to ROS 2 Humble Installation

The Robot Operating System (ROS) is a set of software libraries and tools for building robot applications. From drivers and state-of-the-art algorithms to powerful developer tools, ROS has the open source tools you need for your next robotics project. Since ROS was started in 2007, a lot has changed in the robotics and ROS community. The goal of the ROS 2 project is to adapt to these changes, leveraging what is great about ROS 1 and improving what isn’t.

ROS 2 Humble is the eighth release of ROS 2. ROS, in its various iterations or “distributions,” is regularly released, with multiple “distros” supported at the same time, although they do not all have the same lifetimes. 

On Windows, WSL (Windows Subsystem for Linux) improves the user experience with ROS 2 compared to native Windows installation, as it runs on a Linux platform. Install WSL with an Ubuntu version which is compatible with your ROS distribution and upgrade to WSL2 following the official Microsoft tutorial. 

1. Installing WSL

  1. Open PowerShell in Admin Mode

  2. Run

    wsl --install

You might run into the below error. This is related to Windows Subsystem for Linux (WSL) and specifically means that the Windows Hyper-V or virtualization services required by WSL 2 are not available or not running.

Check if virtualization is enabled

  • Open Task Manager → Performance → CPU tab

  • Look for “Virtualization: Enabled

    • If Disabled, enable it in the BIOS/UEFI settings

Error code: Wsl/InstallDistro/Service/RegisterDistro/CreateVm/HCS/HCS_E_SERVICE_NOT_AVAILABLE

If NO error continue with setting the username and password

Restart

  1. Run

    wsl --list --online

    to see available linux distros

  2. Install distro

    wsl --install Ubuntu-22.04
  3. Create username and password

  4. Verify version by running

    wsl -l -v
  5. Install WSL in VS Code Extension

  6. Open Ubuntu App (Windows Key > Ubuntu)

  7. Run

    code .
  8. Right click explorer to reveal in folder and save folder path

2. Setting Up Github in WSL

  1. Set up credentials on VS Code

git config --global user.name “yourusername” git config --global user.email “youremail@gmail.com”

3. ROS2 Humble Installation

  1. Locale configuration

locale # check for UTF-8 sudo apt update && sudo apt install locales
  1. Locale # check for UTF-8

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
  1. Software properties and Universe Repository

sudo apt install software-properties-common sudo add-apt-repository universe
  1. Curl installation and ROS Key

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
  1. ROS2 Sources Configuration

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
  1. Update and Upgrade

sudo apt update && sudo apt install -y \ python3-flake8-docstrings \ python3-pip \ python3-pytest-cov \ ros-dev-tools
  1. ROS Desktop Installation

sudo apt install ros-humble-desktop
  1. ROS Environment Setup

source /opt/ros/humble/setup.bash
  1. ROS2 Command check

ros2

4. ROS2 Command not found

This is a common error when running any ros2 commands

Run

echo “source /opt/ros/humble/setup.bash" >> ~/.bashrc

to automatically source. This lets your ros2 command work.

5. Running Executables

  1. Prerequisites

sudo apt update sudo apt install ros-humble-turtlesim
  1. See list of packages

ros2 pkg list
  1. See list of <packages, executables>

ros2 pkg executables
  1. See list of executables from turtlesim package

ros2 pkg executables turtlesim
  1. Run turtlesim. Do ros2 run -h to see options

# ros2 run <package_name> <executable_name> ros2 run turtlesim turtlesim_node
  1. In other terminal, run the teleop mode

ros2 run turtlesim turtle_teleop_key

6. Other Examples to try:

  1. In one terminal, run a C++ talker:

ros2 run demo_nodes_cpp talker
  1. In another terminal run a Python listener:

ros2 run demo_nodes_py listener

You should see the talker saying that it’s Publishing messages and the listener saying I heard those messages. This verifies both the C++ and Python APIs are working properly. Hooray!


Screenshot of the terminals (Talker and listener) 

Comments

Popular posts from this blog

Getting Started with ROS2 Humble: Workspace, Packages, and Nodes

Introduction to ROS 2: The Future of Robotics Software

CREATING A PUBLISHER AND SUBSCRIBER NODES USING PYTHON