Search icon CANCEL
Subscription
0
Cart icon
Your Cart (0 item)
Close icon
You have no products in your basket yet
Arrow left icon
Explore Products
Best Sellers
New Releases
Books
Videos
Audiobooks
Learning Hub
Conferences
Free Learning
Arrow right icon
Arrow up icon
GO TO TOP
Robot Operating System Cookbook

You're reading from   Robot Operating System Cookbook Over 70 recipes to help you master advanced ROS concepts

Arrow left icon
Product type Paperback
Published in Jun 2018
Publisher Packt
ISBN-13 9781783987443
Length 484 pages
Edition 1st Edition
Languages
Tools
Concepts
Arrow right icon
Author (1):
Arrow left icon
Kumar Bipin Kumar Bipin
Author Profile Icon Kumar Bipin
Kumar Bipin
Arrow right icon
View More author details
Toc

Table of Contents (12) Chapters Close

Preface 1. Getting Started with ROS FREE CHAPTER 2. ROS Architecture and Concepts I 3. ROS Architecture and Concepts – II 4. ROS Visualization and Debugging Tools 5. Accessing Sensors and Actuators through ROS 6. ROS Modeling and Simulation 7. Mobile Robot in ROS 8. The Robotic Arm in ROS 9. Micro Aerial Vehicles in ROS 10. ROS-Industrial (ROS-I) 11. Other Books You May Enjoy

Installing ROS on desktop systems

We assume that you have a desktop system with Ubuntu 16.04 or Ubuntu 18.04 long-term support (LTS) installed, with an Intel Corei5 processor @3.2 GHz and 8GB of RAM, or similar. Furthermore, it is necessary to have a basic knowledge and understanding of Linux and command tools. If you need to refresh your memory or learn about these tools, you can find a lot of relevant resources on the internet, or you can find books on these topics instead.

In this section, we will discuss the ROS distribution and the corresponding supported operating system, which will guide help us in selecting the right combination, depending upon our requirements.

ROS distribution

An ROS distribution is a versioned set of ROS packages. These are very similar to Linux distributions. The purpose of the ROS distributions is to let developers work against a relatively stable code base until they are ready to set up forward. Each distribution maintains a stable set of core packages up to the end of life (EOL) of the distribution.

The latest recommended ROS distribution is Kinectic Kame, which will get support up to May 2021, however, the latest ROS distribution is Melodic Morenia, which was released on 23rd May 2018, and will be supported up to May 2023. One of the problems with this latest ROS distribution is that most of the packages will not be available on it because it will take time to migrate them from the previous distribution, so we do not recommend this.

The list of distributions to use can be found on the ROS website (http://wiki.ros.org/distributions):

List of distributions

Supported operating systems

ROS is fully compatible with the Ubuntu operating system by design. Moreover, the ROS distributions are planned according to Ubuntu releases. Nevertheless, they are partially supported by Ubuntu ARM, Gentoo, macOS X, Arch Linux, and OpenEmbedded. The following table shows ROS distributions and the corresponding versions of the supported operating systems:

ROS Distribution

Supported OS

Experimental OS

Melodic Morenia

Ubuntu 18.04 (LTS); Debian9

OS X (Homebrew), Gentoo, Ubuntu ARM, and OpenEmbedded/Yocto

Kinetic Kame (LTS)

Ubuntu 16.04 (LTS) and 15.10; Debian 8

OS X (Homebrew), Gentoo, Ubuntu ARM, and OpenEmbedded/Yocto

Jade Turtle

Ubuntu 15.04, 14.10, and 14.04; Debian 8

OS X (Homebrew), Gentoo, Arch Linux, Android NDK, Ubuntu ARM, and OpenEmbedded/Yocto

Indigo Igloo (LTS)

Ubuntu 14.04 (LTS) and 13.10; Debian 7

OS X (Homebrew), Gentoo, Arch Linux, Android NDK, Ubuntu ARM, and OpenEmbedded/Yocto

As we have discussed in the previous section, there are several ROS distributions available to download and install. Therefore, we recommend you select the LTS release, which is stable and getting maximum support.

However, if the latest features of ROS are required, you could go for the latest version, but you will not get the latest complete packages immediately after release because of the migration period from one distribution to another.

In this book, we are using two LTS distributions, ROS Kinetic and ROS Melodic, for all experiments.

The following screenshot shows a choice of ROS installations:

ROS installation

We can get the complete installation instructions for each distribution from the ROS website (http://www.ros.org/). Afterward, navigate to Getting Started | Install. It will show a screen listing, as shown in the preceding diagram, for the latest ROS distributions.

How to do it...

In the following section, we will go through the instructions for installing the latest ROS distribution.

Configuring Ubuntu repositories

To configure the Ubuntu repository, first search for Software & Updates in the Ubuntu Search Toolbar and enable the restricted, universe, and multiverse Ubuntu repositories, as shown in the following screenshot:

Software & Updates

Setting up the source.list file

The next step is to set up the desktop system to accept software from packages.ros.org. The details of the ROS repository server have to be added into /etc/apt/source.list:

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

Setting up keys

Whenever a new repository is added to the Ubuntu repository manager, we have to make it trusted to validate the origin of the packages by adding the keys. The following key should be added to Ubuntu before starting the installation, which will ensure the download comes from an authorized server:

$ sudo apt-key adv --keyserver hkp://ha.pool.sks-keyservers.net:80 --recv-key 421C365BD9FF1F717815A3895523BAEEB01FA116

ROS Kinetic Installation

Now, we are prepared to install the ROS packages on Ubuntu. The first step is to update the list of packages by using the following command:

$ sudo apt-get update

There are many different libraries and tools in ROS, however, we will provide four default configurations to get you started:

  • Desktop-Full install (recommended):
$ sudo apt-get install ros-kinetic-desktop-full
  • Desktop install:
$ sudo apt-get install ros-kinetic-desktop
  • ROS-Base:
$ sudo apt-get install ros-kinetic-ros-base
  • Individual Package:
$ sudo apt-get install ros-kinetic-PACKAGE

ROS Melodic installation

Now, we are ready to install the ROS packages on Ubuntu 18.04 LTS. The first step is to update the list of packages by using the following command:

$ sudo apt-get update

There are many different libraries and tools in ROS, however, we will provide four default configurations to get you started:

  • Desktop-Full Install (recommended):
$ sudo apt-get install ros-melodic-desktop-full
  • Desktop Install:
$ sudo apt-get install ros-melodic-desktop
  • ROS-Base:
$ sudo apt-get install ros-melodic-ros-base
  • Individual Package:
$ sudo apt-get install ros-melodic-PACKAGE

Initializing rosdep

Before using ROS, you have to initialize rosdep, which enables you to easily install system dependencies for sources you want to compile, and also is required to run some core components in ROS:

$ sudo rosdep init
$ rosdep update

Setting up the environment

Good! We have completed the ROS installation. The ROS scripts and executables are mostly installed to /opt/ros/<ros_version>.

To get access to these scripts and executables, the ROS environment variables need to be added to the bash session. We have to source the following bash file for ROS Kinetic:

$ source /opt/ros/kinetic/setup.bash

ROS Melodic requires the following:

$ source /opt/ros/melodic/setup.bash

It's convenient if the ROS environment variables are automatically added to the bash session every time a new shell is launched.

For ROS Kinetic, use the following:

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

For ROS Melodic, use the following:

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

If we have more than one ROS distribution installed, ~/.bashrc must only source setup.bash for the version we are currently using:

$ source /opt/ros/<ros_version>/setup.bash

Getting rosinstall

Moreover, rosinstall is a frequently used command-line tool in ROS that is distributed separately. It enables us to easily download several source trees for the ROS packages with the single command.

This tool is based on Python, and can be installed using the following command:

$ sudo apt-get install python-rosinstall

Build Farm Status

The ROS packages are built by the ROS build farm. We can check the status of individual packages at http://repositories.ros.org/status_page/.

Congratulations! We are done with the ROS installation. We will execute the following command to check whether the installation is correct.

Open a new terminal to run roscore:

$ roscore

This is followed by a turtlesim node in another terminal:

$ rosrun turtlesim turtlesim_node

If everything is correct, we will get the following screen:

ROS execution demo
You have been reading a chapter from
Robot Operating System Cookbook
Published in: Jun 2018
Publisher: Packt
ISBN-13: 9781783987443
Register for a free Packt account to unlock a world of extra content!
A free Packt account unlocks extra newsletters, articles, discounted offers, and much more. Start advancing your knowledge today.
Unlock this book and the full library FREE for 7 days
Get unlimited access to 7000+ expert-authored eBooks and videos courses covering every tech area you can think of
Renews at $19.99/month. Cancel anytime
Banner background image