Updated 9/12/15

Intro

description

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.

Installation

description

Installing ROS2

Installing ROS packages

Binary packages

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.


Configure ROS2 Environment

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.

description
  • 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.zsh
source /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
echo "source /opt/ros/humble/setup.bash" >> ~/.bashrc
  • Apply the changes to current terminal. From now on, ROS 2 commands will be available in all new terminal sessions automatically.
source ~/.bashrc

Create an empty workspace

A workspace is a directory containing ROS 2 packages.

description

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.

  • Source main ROS2 installation as underlay
source /opt/ros/humble/setup.bash
  • Create a training workspace and source folder
mkdir -p training_ws/src
cd training_ws/src

Build a Workspace Using Colcon


Create a package


Create publisher and subscriber node


Topics and Turtlesim


tf2