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.
Binary packages are precompiled versions of the software that can be installed directly using a package manager (e.g. apt). nstalling from packages is the recommended method, as it installs necessary dependencies automatically and also updates alongside regular system updates.
Building from source
When you install from source, you download the raw code and compile it on your system. Building from source is recommended for platforms where binaries aren’t available or supported. Building from source also gives you the option to install the absolute latest version of the software.
The ROS 2 development environment needs to be correctly configured before use. This can be done in two ways: either sourcing the setup files in every new shell you open, or adding the source command to your startup script.
Option 1: Source the setup files in each shell manually
# Replace ".bash" with your shell if you're not using bash# Possible values are: setup.bash, setup.sh, setup.zshsource /opt/ros/humble/setup.bash
You will need to run this command in every new terminal session to access ROS 2 commands, unless you automate the sourcing.
Option 2 (Recommended): Add sourcing to your shell startup script
A workspace is a directory containing ROS 2 packages.
Commonly there is a src subdirectory. Inside that subdirectory is where the source code of ROS packages will be located. Typically the directory starts otherwise empty.
Before using ROS 2, it’s necessary to source your ROS 2 installation workspace in the terminal you plan to work in. This makes ROS 2’s packages available for you to use in that terminal.
ROS 2 relies on the notion of combining workspaces using the shell environment. “Workspace” is a ROS term for the location on your system where you’re developing with ROS 2. The core ROS 2 workspace is called the underlay. Subsequent local workspaces are called overlays. When developing with ROS 2, you will typically have several workspaces active concurrently.
It is important that we have sourced the environment for an existing ROS 2 installation that will provide our workspace with the necessary build dependencies for the example packages. This is achieved by sourcing the setup script provided by a binary installation or a source installation, i.e., another colcon workspace (see Installation). We call this environment an underlay.