How To Install ROS2 Humble Desktop On PC (FULL INSTALL)
Learn how to install ros-humble-desktop on your PC running Ubuntu 22.04 LTS OS

Setting up a ROS development environment is crucial for building advanced robotics applications. In this tutorial will walk you through the complete process of installing ROS2 Humble Desktop on a PC running Ubuntu 22.04 LTS. From the initial setup to configuring essential development tools, you'll have everything you need to prototype, simulate, and deploy robotics solutions. Whether you're a robotics maker, student, or engineer, this guide will get your PC fully equipped for powerful robotics development with ROS2.
Prerequisite
Ensure you have the Ubuntu 22.04 LTS installed on your PC (it could be with virtual box also)
Installing ROS Humble Desktop
Follow the instructions (step by step) to install ros-humble-desktop on your PC.
Set locale
Setup sources
Install ros humble desktop
Install all the necessary ROS2 development tools - rosdep, colcon, vcs-tool, etc.
Next, add the following command to the
.bashrcfile to enable automatic sourcing of the ros humble environment and installed whenever you open a new terminal.
Setting up colcon for Building ROS2 packages
colcon is a build tool required to build your ROS2 packages created in your ros workspace. It was already installed when you ran the sudo apt install ros-dev-tools command prevoiusly. but you can also install it using sudo apt install python3-colcon-common-extensions
But we need to set it up for things like tab completion. Run the following command in your terminal.
Setup colcon_cd
Setup colcon tab completion
With all the above added to the .bashrc file, the colcon environment and functions will be automatically activated whenever you open a new terminal as well as automatic sourcing of the ros-humble environment.
you should see the following highlighted text (in the image below) at the bottom of your .bashrc file. Run this command: sudo nano ~/.bashrc

Intializing rosdep
rosdep is a dependency management utility that can work with packages and external libraries. It is a command line utility for identifying and installing dependencies to build or install a package.
It is most often invoked before before building a package with colcon. It will basiclally download and installing the necessary dependencies a specified in the package.xmlfile so you don't have to manually install each dependencies again.
rosdep was already installed when you ran the sudo apt install ros-dev-tools command previously. but you can also install it using sudo apt install python3-rosdep
Follow the instructions below to instialize rosdep:
Install setuptools For Building ROS2 Python Packages
Creating A ROS2 Workspace

In the root folder of your PC (i.e the home directory)
In the root folder of your PC (i.e the home directory), create a ros workspace folder. I would be using this workspace name -
ros-ws.change directory into the root ros workspace folder
build the ros workspace initially with colcon (while still in the root workspace folder)
you should now see three other folders - build, install, and log - apart from the src folder already created earlier. Run
lsto see them in terminalLet's setup automatic sourcing for the created workspace -
ros-ws- in the.bashrcfile so that it is automatically sourced whenever you open a new terminal. Run this in terminal:
Test with helloworld package
Open a new terminal (to auto source your ros2 environment and workspace) and cd into your ros workspace's src folder
Clone this ros2 helloworld cpp and python package
Change directory into the root ros workspace folder
Optionally, run rosdep to install the packge dependencies specified in the package's
package.xmlfileBuild the package with colcon
Open two seperate terminals. In one of the terminals, run a c++ node:
In the other terminal, run a python node:
Optional (Install Cyclone DDS)
If you would be using ROS2 for navigation and some other high speed data transfer, install and use the Cyclone DDS in place of the default Fast DDS.
Last updated