Book Image

Robot Operating System Cookbook

By : Kumar Bipin
Book Image

Robot Operating System Cookbook

By: Kumar Bipin

Overview of this book

This book will leverage the power of ROS with an introduction to its core and advanced concepts through exciting recipes. You will get acquainted with the use of different synchronous and asynchronous communication methods, including messages, services, and actions. You will learn how to use the various debugging and visualization tools used in development and how to interface sensors and actuators with the ROS framework. Firstly, you will get to grips with ROS simulation frameworks, such as Gazebo and RotorS for modeling and simulating any physical robot and virtual environment. You will also cover mobile robotics, micro-aerial vehicles, and robotic arms, which are the leading branches of robotic applications. Robot Operating System Cookbook will also guide you in the development of an autonomous navigation framework for both mobile robots and micro-aerial vehicles. Finally, you will explore ROS-Industrial, an open source project that extends the advanced capabilities of ROS software to manufacturing industries.
Table of Contents (12 chapters)

Installing ROS on an ARM-based board

There is high demand from industries that are working on commercial robotic products for ROS that runs on an embedded platform, mostly on the ARM platform. Finally, OSRF, which maintains the open source ROS, has announced its formal support for an ARM target.

Getting ready

There are two streams to support ROS on an ARM target:

  • Ubuntu ARM

  • OpenEmbedded (meta-ros)

Ubuntu ARM is the most popular among researchers since it is easy to install and a lot of ARM boards are already supporting it; a few of them are shown in the following diagram. In addition, many ROS packages are already supported or could be ported with minimal changes:

Supported platforms

However, OpenEmbedded is used by professional developers for commercial products in industries. The following table shows a comparison of both:

Ubuntu ARM

OpenEmbedded

Binary ROS packages

A cross-compilation tool chain for ROS packages based on catkin

Is compiled for a generic ARM architecture

Compiles all packages from their source

Installation with usual Ubuntu tools (dpkg, APT, and so on)

Supports many architectures: ARM, MIPS, PowerPC, and more

Easy and quick installation

Easy to adjust to new machines and architectures

No need to compile the basic ROS packages from source

Allows changes to the basic ROS packages

Common Ubuntu feel

Small Linux kernels and images

Additional compilation is onboard

Requires a powerful system setup to get the build machine and tool chain running

Despite several possibilities, we have chosen to install ROS on Ubuntu ARM because these distributions are more common and can be used on other ARM-based boards such as UDOO, ODROID-U3, ODROID-X2, or Gumstix Overo. It is recommended to use an image of Ubuntu ARM 16.04 Xenial armhf on the platform to work with ROS.

Before installing ROS on the specific ARM platform, we have to complete a few prerequisites. As this book is focused on ROS, we will list them without going into detail. However, there is a lot of information about Ubuntu ARM for specific ARM platforms available on websites, forums, and books that could be reviewed.

When we have Ubuntu ARM on our selected platform, the network interfaces must be installed to provide access to the network by configuring the network settings, such as the IP, DNS, and gateway.

An Ubuntu image for most of the ARM platform will be set up for MicroSD cards with 1-4 GB size. This is not sufficient to use a large part of the ROS Kinetic packages. In order to solve this problem, we can use SD cards with more space and expand the file system to occupy all the space available with re-partitioning:

GParted

We could use the GParted utility, an open source graphical tool that is used for creating, deleting, resizing, moving, checking, and copying disk partitions and their file systems (http://gparted.org/).

How to do it...

Good! We should be ready to install ROS. After this, the process of installation is pretty similar to the desktop installation discussed in the previous section. The major difference when installing ROS on the Ubuntu ARM platform is that it will not be possible to go for the full desktop installation. We install the selected package that is required for our application. Nevertheless, it will be nice to work with source building and installation for a package not present in the ROS repository:

  • ROS Kinectic <ros_version> is compatible with Ubuntu 16.04 Xenial Xerus

  • ROS Melodic <ros_versions> is compatible with Ubuntu 18.04 Bionic Beaver

Configuring repositories

The first step consists of configuring our Ubuntu repositories to allow "restricted," "universe," and "multiverse":

$ sudo vi /etc/apt/sources.list

We have something like this for Ubuntu 16.04:

deb http://ports.ubuntu.com/ubuntu-ports/ xenial main restricted universe multiverse 
#deb-src http://ports.ubuntu.com/ubuntu-ports/ xenial main restricted universe multiverse deb http://ports.ubuntu.com/ubuntu-ports/ xenial-updates main restricted universe multiverse
#deb-src http://ports.ubuntu.com/ubuntu-ports/ xenial-updates main restricted universe multiverse
#Kernel source (repos.rcn-ee.com) : https://github.com/RobertCNelson/linux-stable-rcn-ee
#
#git clone https://github.com/RobertCNelson/linux-stable-rcn-ee
#cd ./linux-stable-rcn-ee #git checkout `uname -r` -b tmp
# deb [arch=armhf] http://repos.rcn-ee.com/ubuntu/ xenial main
#deb-src [arch=armhf] http://repos.rcn-ee.com/ubuntu/ xenial main

Similarly, the following is for Ubuntu 18.04:

deb http://ports.ubuntu.com/ubuntu-ports/ bionic main restricted universe multiverse 
#deb-src http://ports.ubuntu.com/ubuntu-ports/ bionic main restricted universe multiverse deb http://ports.ubuntu.com/ubuntu-ports/ bionic-updates main restricted universe multiverse
#deb-src http://ports.ubuntu.com/ubuntu-ports/ bionic-updates main restricted universe multiverse
#Kernel source (repos.rcn-ee.com) : https://github.com/RobertCNelson/linux-stable-rcn-ee
#
#git clone https://github.com/RobertCNelson/linux-stable-rcn-ee
#cd ./linux-stable-rcn-ee
#git checkout `uname -r` -b tmp
# deb [arch=armhf] http://repos.rcn-ee.com/ubuntu/ bionic main
#deb-src [arch=armhf] http://repos.rcn-ee.com/ubuntu/ bionic main

Then, use the following to update the sources:

$ sudo apt-get update

Setting system locale

Some ROS tools, such as Boost, require that the system locale be set. This can be set with the following:

$ sudo update-locale LANG=C LANGUAGE=C LC_ALL=C LC_MESSAGES=POSIX

Setting up sources.list

Next, we will configure the source lists depending on the Ubuntu version installed in our ARM platform. Run the following command to install the Ubuntu armhf repositories:

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

Setting up keys

As discussed previously, this step is needed to confirm that the origin of the code is correct and that no one has modified the code or programs without the knowledge of the owner:

$ sudo apt-key adv --keyserver hkp://ha.pool.sks-keyservers.net --recv-key 0xB01FA116