Link Search Menu Expand Document

ROS

Installing ROS

Table of contents

  1. Getting started with ROS
  2. Installing ROS
    1. Setup repositories
    2. Installation
    3. Environment setup
    4. Dependencies for building packages
    5. Initialization

Getting started with ROS

The Robot Operating System (ROS) is a crucial middleware (a.k.a. collection of software packages) that enables roboticists all over the world to implement their algorithms in a clean and modular fashion and share their work effectively with the community.

In addition, it is at the very core of our class, so we’d better start playing with it!

Installing ROS

By now, you should have a working (preferably fresh) install of Ubuntu 20.04 and have become accustomed with the basics of Linux, Git and C++. The most efficient way to install ros is through the Debian (binary) packages.

To install ROS Noetic on it, we will follow the official guide to install the Desktop-Full Install option.

Setup repositories

Let’s add the packages.ros.org repository to our system

sudo sh -c 'echo "deb http://packages.ros.org/ros/ubuntu $(lsb_release -sc) main" > /etc/apt/sources.list.d/ros-latest.list'

and setup the keys (install curl if you haven’t already via sudo apt install curl)

curl -s https://raw.githubusercontent.com/ros/rosdistro/master/ros.asc | sudo apt-key add -

Installation

Before installing ROS we need to update the apt index

sudo apt update

Now let’s install ROS 🤖

sudo apt install ros-noetic-desktop-full

Note: if you encounter the following problem when running the command line above:

Reading package lists... Done
Building dependency tree       
Reading state information... Done
Some packages could not be installed. This may mean that you have
requested an impossible situation or if you are using the unstable
distribution that some required packages have not yet been created
or been moved out of Incoming.
The following information may help to resolve the situation:

The following packages have unmet dependencies:
 ros-noetic-desktop-full : Depends: ros-noetic-perception but it is not going to be installed
E: Unable to correct problems, you have held broken packages.

Then a solution is to instead of running sudo apt install ros-noetic-desktop-full, perform the following:

sudo apt install aptitude
sudo aptitude install ros-noetic-desktop-full

Environment setup

It’s convenient if the ROS environment variables are automatically loaded as soon a new shell is launched, let’s edit ~/.bashrc to do so

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

Keep in mind.

If you use a different shell (such as zsh), make sure you configure your shell to source the correct setup file!

Dependencies for building packages

Up to now you have installed what you need to run the core ROS packages. To create and manage your own ROS workspaces, there are various tools and requirements that are distributed separately. For example, rosinstall is a frequently used command-line tool that enables you to easily download many source trees for ROS packages with one command.

To install this tool and other dependencies for building ROS packages, run:

sudo apt install python3-rosdep python3-rosinstall python3-rosinstall-generator python3-vcstool build-essential python3-catkin-tools python-is-python3

Initialization

Before using ROS, we need to initialize rosdep.

sudo rosdep init
rosdep update

Copyright © 2018-2022 MIT. This work is licensed under CC BY 4.0