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
Learning ROS for Robotics Programming Second Edition
Learning ROS for Robotics Programming Second Edition

Learning ROS for Robotics Programming Second Edition: Take control of the Linux based Robot Operating System, and discover the tools, libraries, and conventions you need to create your own robots without the hassle.

eBook
AU$14.99 AU$60.99
Paperback
AU$75.99
Subscription
Free Trial
Renews at AU$24.99p/m

What do you get with Print?

Product feature icon Instant access to your digital eBook copy whilst your Print order is Shipped
Product feature icon Paperback book shipped to your preferred address
Product feature icon Download this book in EPUB and PDF formats
Product feature icon Access this title in our online reader with advanced features
Product feature icon DRM FREE - Read whenever, wherever and however you want
OR
Modal Close icon
Payment Processing...
tick Completed

Shipping Address

Billing Address

Shipping Methods
Table of content icon View table of contents Preview book icon Preview Book

Learning ROS for Robotics Programming Second Edition

Chapter 1. Getting Started with ROS Hydro

Welcome to the first chapter of this book where you will learn how to install ROS, the new standard software framework in robotics. This book is an update on Learning ROS for Robotics Programming, based in ROS Fuerte. With ROS you will learn how to program and control your robots the easy way, using tons of examples and source code that will show you how to use sensors, devices, or add new functionalities such as autonomous navigation, visual perception, and so on to your robot. Thanks to the open source motto and a community that is developing state-of-the-art algorithms and providing new functionalities, ROS is growing every day.

Throughout this book, you will learn the following:

  • Installing ROS Hydro framework on a version of Ubuntu
  • The basic operation of ROS
  • Debugging and visualizing data
  • Programming your robot using this framework
  • Connecting sensors, actuators, and devices to create your robot
  • Creating a 3D model to use in the simulator
  • Using the navigation stack to make your robot autonomous

In this chapter, we are going to install a full version of ROS Hydro in Ubuntu. ROS is fully supported and recommended for Ubuntu, and it is experimental for other operative systems. The version used in this book is the 12.04 (Precise Pangolin) and you can download it for free from http://releases.ubuntu.com/12.04/.

Before starting with the installation, we are going to learn about the origin of the ROS and its history.

The Robot Operating System (ROS) is a framework that is widely used in Robotics. The philosophy is to make a piece of software that could work in other robots with only little changes to the code. What we get with this idea is the ability to create functionalities that can be shared and used in other robots without effort, so we do not need to reinvent the wheel.

ROS was originally developed in 2007 by the Stanford Artificial Intelligence Laboratory (SAIL) in support of the Stanford AI Robot project. As of 2008, development continues primarily at Willow Garage, a Robotics Research Institute, with more than twenty institutions collaborating within a federated development model.

A lot of research institutions have started to develop in ROS, adding hardware and sharing their code. Also, the companies have started to adapt their products to be used in ROS. In the following set of images, you can see some of the platforms which are fully supported. Normally, these platforms are published with a lot of code, examples, and simulators to permit the developers to start work easily. The first three robots are examples of robots with published code and they are humanoids. The last one is an AUV developed by the University of Las Palmas de Gran Canaria and the code has not been published yet. You can find a lot of such examples at http://wiki.ros.org/Robots.

Getting Started with ROS Hydro

The sensors and actuators used in robotics have also been adapted for use in ROS. Everyday, more devices are being supported by this framework. Furthermore, thanks to ROS and open hardware, companies are creating cheaper and more powerful sensors. The Arduino board is a good example of this, because using a cheap electronic board you can add a lot of sensors like encoders, light and temperature sensors, and so on.

ROS provides standard operating system facilities such as hardware abstraction, low-level device control, implementation of commonly used functionalities, message passing between processes, and package management.

It is based on graph architecture with a centralized topology, where processing takes place in nodes that may receive, post the multiplex sensor, control, state, planning, actuator, and so on. The library is geared towards a Unix-like system.

The *-ros-pkg is a community repository for developing high-level libraries easily. Many of the capabilities frequently associated with ROS, such as the navigation library and the rviz visualizer, are developed in this repository. These libraries give a powerful set of tools for working with ROS easily, knowing what is happening every time. Visualization, simulators, and debugging tools are the most important. In the next image you can see two of these tools, the rviz and rqt_plot. The screenshot in the center is rqt_plot where you can see the plotted data from some sensors. The other two screenshots are rviz; in the screenshot you can see a 3D representation of a real robot.

Getting Started with ROS Hydro

ROS is released under the terms of the BSD (Berkeley Software Distribution) license and is an open source software. It is free for commercial and research use. The ros-pkg contributed packages are licensed under a variety of open source licenses.

With ROS you can do this and more. You can take a code from the repositories, improve it, and share it again. This philosophy is the underlying principle of open source software.

ROS has numerous versions, the last one being Indigo. In this book, we are going to use Hydro because it is a stable version while Indigo is still experimental and may contain bugs.

Now we are going to show you how to install ROS Hydro. Although in this book we use Hydro, you may need to install older versions to use some code that works only with these versions.

As we said before, the operating system used in the book is Ubuntu, and we are going to use it throughout this book and with all the tutorials. If you use another operating system and you want to follow the book, the best option is to install a virtual machine with a copy of Ubuntu. At the end of this chapter, we will explain how to install a virtual machine to use the ROS inside it or download a virtual machine with ROS installed.

Anyway, if you want to try installing it in an operating system other than Ubuntu, you can find instructions to do so in many other operating systems at http://wiki.ros.org/hydro/Installation.

PC installation

We assume that you have a PC with a copy of Ubuntu 12.04. We are using Ubuntu because it comes with a Long-Term Support (LTS). That means the community will maintain this version for five years.

Furthermore, it is necessary to have a basic knowledge of Linux and command tools such as the terminal, vim, creating folders, and so on. If you need to learn these tools, you can find a lot of relevant resources on the Internet, or you can find books on these topics instead.

Installing ROS Hydro – using repositories

Last year, the ROS webpage was updated with a new design and a new organization of contents. You can see a screenshot of the webpage that follows:

Installing ROS Hydro – using repositories

In the menu, you can find information about ROS and whether ROS is a good choice for your system, blogs, news, and so on.

Instructions for the ROS installation can be found under the Install tab in the Getting Started section.

ROS recommends that you install the system using the repository instead of the source code, unless you are an advanced user and you want to make a customized installation; in that case, you may prefer installing ROS using the source code.

So to install ROS using the repositories, we will start by configuring the Ubuntu repository in our system.

Configuring your Ubuntu repositories

In this section, you will learn the steps for installing ROS Hydro in your computer. This process has been based on the official installation page, which can be found at http://wiki.ros.org/hydro/Installation/Ubuntu.

We assume that you know what an Ubuntu repository is, and how to manage it. If you have any doubts about it, refer to https://help.ubuntu.com/community/Repositories/Ubuntu.

Before we start the installation, we need to configure our repositories. To do that, the repositories need to allow restricted, universe, and multiverse. To check if your Ubuntu accepts these repositories, click on the Ubuntu Software Center in the menu on the left-hand side of your desktop, as shown in the following screenshot:

Configuring your Ubuntu repositories

Click on Edit | Software Sources and you will see the next window. Make sure that all the listed options are checked as shown in the following screenshot:

Configuring your Ubuntu repositories

Normally these options are marked, so you should not have any problem with this step.

Setting up your source.list file

In this step, you have to select your Ubuntu version. It is possible to install ROS Hydro in various versions of the operating system. You can use any of them, but we recommend version 12.04 to follow the chapters of this book. Keep in mind that Hydro works in the Precise Pangolin (12.04), Quantal Quetzal (12.10), and the Raring Ringtail(13.04) versions of Ubuntu.

  • If you're going follow the book with Ubuntu 12.04 (Precise Pangolin), type the following command to add the repositories:
    sudo sh -c 'echo "deb http://packages.ros.org/ros/ubuntu precise main" > /etc/apt/sources.list.d/ros-latest.list'
    
  • If you're going to follow the book with Ubuntu 12.10 (Quantal Quetzal), type the following command to add the repositories:
    sudo sh -c 'echo "deb http://packages.ros.org/ros/ubuntu quantal main" > /etc/apt/sources.list.d/ros-latest.list'
    
  • To follow the book with Ubuntu 13.04 (Raring Ringtail), type the following command to add the repositories:
    sudo sh -c 'echo "deb http://packages.ros.org/ros/ubuntu raring main" > /etc/apt/sources.list.d/ros-latest.list'
    

Tip

Downloading the example code

You can download the example code files from your account at http://www.packtpub.com for all the Packt Publishing books you have purchased. If you purchased this book elsewhere, you can visit http://www.packtpub.com/support and register to have the files e-mailed directly to you. You can also download these code files from https://github.com/AaronMR/ROS_Book_Hydro.

Once you've added the correct repository, your operating system will know where to download programs to install them into your system.

Setting up your keys

This step is 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. Normally, when you add a new repository you have to add the keys of that repository, so it is added to your system's trusted list.

$ wget http://packages.ros.org/ros.key -O - | sudo apt-key add -

Now we can be sure that the code came from an authorized site and has not been modified.

Installing ROS

We are ready to start the installation now, but before we do that it's better to make an update to avoid problems with the libraries and software with a version other than what ROS needs. This is done with the following command:

$ sudo apt-get update

ROS is huge; sometimes you will install libraries and programs that you will never use. Normally it has four different installations, but this depends on the final use. For example, if you are an advanced user, maybe you only need the basic installation for a robot without much space on the hard disc. For this book, we recommend you use the full installation because it will install everything necessary to practice the examples and tutorials.

It doesn't matter if you don't know what are you installing right now — rviz, simulators, navigation, and so on. You will learn everything in the upcoming chapters:

  • The easiest (and recommended if you have enough hard disk space) installation is known as desktop-full. It comes with ROS, the rqt tools, the rviz visualizer (for 3D), many generic robot libraries, simulator in 2D (like stage) and 3D (usually gazebo), the navigation stack (to move, localize, do mapping, and control arms), and also perception libraries using vision, lasers or RGBD cameras:
    $ sudo apt-get install ros-hydro-desktop-full
    
  • If you do not have enough disk space or you prefer to install only a few packages, install only the desktop install initially, which comes with only ROS, the rqt tools, rviz, and generic robot libraries. You can install the rest of the packages as and when you need them. For example, using aptitude and looking for ros-hydro-* packages with the following command:.
    $ sudo apt-get install ros-hydro-desktop
    
  • If you only want the bare bones, install ROS-base, which is usually recommended for the robot itself, or for computers without a screen or just a tty. It will install the ROS package with the build and communication libraries and no GUI tools at all. With BeagleBone Black (BBB), we will install the system with the following option:
    $ sudo apt-get install ros-hydro-ros-base
    
  • Finally, whichever of the previous options you choose, you can also install individual/specific ROS packages (for a given package name):
    $ sudo apt-get install ros-hydro-PACKAGE
    

Initializing rosdep

Before you can use ROS, you will need to initialize rosdep. The rosdep command line too enables you to easily install system dependencies for the source you want to compile and is required to run some core components in ROS. In ROS Fuerte you had to install rosdep after installing ROS, and it was known as a standalone tool. Now rosdep is installed in ROS by default. To initialize rosdep, you have to use the following commands:

$ sudo rosdep init 
$ rosdep update

Setting up the environment

Congratulations! If you are at this step, you have an installed version of ROS on your system! To start using it, the system needs to know the location of the executable or binary files as well as the other commands. To do so, normally you need to execute the next script; if you also install another ROS distro, you can work with both just by calling the script of the one you need each time, since this script simply sets your environment. Here we use the one for ROS Hydro, but just replace Hydro with Fuerte or Groovy if you want to try other distros:

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

If you type roscore in the shell, you will see something starting up. This is the best test for finding out if you have ROS, and if it is installed correctly.

Notice that if you open another shell and type roscore or other ROS commands, it does not work. This is because it is necessary to execute the script again to configure the global variables, the path where ROS is installed, and so on.

It is very easy to solve this; you just need to add the script at the end of your .bashrc script file so that when you start a new shell, the script will execute and you will have the environment configured.

The .bashrc file is within the user home (/home/USERNAME/.bashrc). It has the configuration of the shell or terminal, and each time the user opens the terminal, this file is loaded. So you can add commands or configuration to make the user's life easy. For this reason, we will add the script at the end of the .bashrc file, to avoid keying it in each time we open a terminal. We do this with the following command:

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

To see the results, you have to execute the file using the next command, or close the current terminal and open another.

$ source ~/.bashrc

Some users need more than a single ROS distribution installed in their system. Your ~/.bashrc must only source the setup.bash of the version you are currently using, since the last call will override the environment set of the others. So you have several distros living in the same system and need to switch between them.

For example, you might have the following lines in your .bashrc file:


source /opt/ros/hydro/setup.bash
source /opt/ros/fuerte/setup.bash
source /opt/ros/electric/setup.bash

The ROS Electric version will be executed in this case. So you have to make sure that the version you are running is the last one in the file.

If you want to check the version used in a terminal, you can do so easily using the echo $ROS_DISTRO command.

Getting rosinstall

Now, the next step is to install a command tool that will help us install other packages with a single command. This tool is based in Python, but don't worry, you don't need to know Python to use it. You will learn how to use this tool in the upcoming chapters:

To install this tool on Ubuntu, run the following command:

$ sudo apt-get install python-rosinstall

And that is all! You have a complete ROS system installed in your system. When I finish a new installation of ROS, I personally like to test two things: that roscore works, and turtlesim.

If you want to do the same,, type the following commands in different shells:

$ roscore
$ rosrun turtlesim turtlesim_node

And if everything is okay, you will see the following screenshot:

Getting rosinstall

How to install VirtualBox and Ubuntu

VirtualBox is a general-purpose full virtualizer for x86 hardware, targeted at server, desktop, and embedded use. VirtualBox is free and supports all the major operating systems and pretty much every Linux flavor out there.

If you don't want to change the operating system of your computer to Ubuntu, tools such as VirtualBox help us virtualize a new operating system in our computers without making any changes.

In the following section, we are going to show you how to install VirtualBox and a new installation of Ubuntu. After this virtual installation, you should have a clean installation to restart your development machine if you have any problems, or to save all the setups necessary for your robot in the machine.

Downloading VirtualBox

The first step is to download the VirtualBox installation file. The latest version at the time of writing this book is 4.3.12; you can download it from http://download.virtualbox.org/virtualbox/4.3.12/. If you're using Windows, you can download it from http://download.virtualbox.org/virtualbox/4.3.12/VirtualBox-4.3.12-93733-Win.exe.

Once installed, you need to download the image of Ubuntu; for this tutorial we will use a copy of Ubuntu with ROS Hydro installed. You can download it from http://nootrix.com/2014/04/virtualized-ros-hydro/.

For this version, the Nootrix team are using torrent to download the virtual machine; I tried this way to download the file and it works perfectly.

You can find different virtual machines with Ubuntu and ROS preinstalled, but we are going to use this version because it is referred to in the official pages of ROS.

Creating the virtual machine

Creating a new virtual machine with the downloaded file is very easy; just proceed with the following steps. Open VirtualBox and click on File | Import Appliance. Then click on Open appliance and select the ROSHydro.ova file downloaded earlier:

Creating the virtual machine

In the windows that follow, you can configure the parameters of the new virtual machine. Keep the default configuration and change only the name for the virtual system. This name is how you distinguish this virtual machine from others. Our recommendation is to put a descriptive name, in our case the name of this book:

Creating the virtual machine

Click on the Import button, and accept the software license agreement in the next window. You will see a progress bar. It means that VirtualBox is copying the file with the virtual image, and it is creating a new copy with the new name.

Notice that this process doesn't modify the original file ROS.ova, and you could create more virtual machines with different copies from the original file.

The process will take a few minutes depending on your computer. When it finishes, you can start your virtual machine by clicking on the Start button. Remember to select the right machine before you start it. In our case, we only have one but you could have more:

Creating the virtual machine

Sometimes, you will get an error as shown in the following screenshot. It is because your computer doesn't have the correct drivers to use the USB 2.0 controller. You can fix this by installing the Oracle VM VirtualBox Extension Pack, but you can also choose to disable the USB support to start using the virtual machine:

Creating the virtual machine

To disable the USB support, right-click over the virtual machine and select Settings. In the General tab, click on Ports | USB and uncheck the Enable USB 2.0 (EHCI) Controller, as shown in the following screenshot. Now you can restart the virtual machine and it should start without any problems.

Creating the virtual machine

Once the virtual machine starts, you should see the next window as seen in the following screenshot. It is the Ubuntu 12.04 OS with ROS installed:

Creating the virtual machine

When you finish these steps, you will have a full copy of ROS Hydro that can be used along with this book. You can run all the examples and stacks that we are going to work with. Unfortunately, VirtualBox has problems when working with real hardware, and it's possible that you may not be able to use this copy of ROS Hydro with the examples given in Chapter 4, Using Sensors and Actuators with ROS.

Installing ROS Hydro in BeagleBone Black (BBB)

BeagleBone Black is a low-cost development platform based on an ARM Cortex A8 processor. This board is fabricated with a Linux distribution called Ångström. Ångström was developed by a small group who wanted to unify Linux distribution for embedded systems. They wanted an operating system that was stable and user-friendly.

Texas Instruments designed BeagleBone Black thinking that the community of developers needed an on-board computer with some general purpose input/output (GPIO) pins. The BeagleBone Black platform is an evolution of the original BeagleBone. The main features of the board are an ARM Cortex A8 processor at 1 GHz with 512 MB RAM, and with Ethernet, USB, and HDMI connections and two headers of 46 pins GPIO. This GPIO can be set up as digital I/O, ADC, PWM, or for communication protocol like I2C, SPI, or UART. The GPIO is an easy way to communicate with sensors and actuators directly from the BeagleBone without intermediaries. The following is a labeled image of BeagleBone:

Installing ROS Hydro in BeagleBone Black (BBB)

When the BeagleBone board came out, it was not possible to install ROS on the Ångström distribution. For this reason, it was common to install an operating system based on Ubuntu on the BeagleBone. There are different versions of Ubuntu ARM compatible with the BeagleBone Black and ROS; we recommend you use an image of Ubuntu ARM 13.04 raring armhf on the platform to work with ROS.

Now, a ROS version for Ångström distribution is ready to be installed; you can do it following the installation steps given at http://wiki.ros.org/hydro/Installation/Angstrom. Despite this possibility, 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 Gumstick.

The ARM technology is booming with the use of mobile devices such as smartphones and tablets. Apart from the increasing computer power of the ARM cortex, the great level of integration and low consumption have made this technology suitable for autonomous robotic systems. In the last few years, multiple ARM platforms for developers have been launched in the market. Some of them have features similar to the BeagleBone Black like the Raspberry PI or the Gumstick Overo. Additionally, more powerful boards like Gumstick DuoVero with a Dual Core ARM Cortex A9 or some quad core boards like Odroid U3, Odroid X2 or UDOO are now available.

Prerequisites

Before installing ROS on Beaglebone Black, we have to achieve some prerequisites. As this book is focused on ROS, we will list them without entering into detail. There is a lot of information about Beaglebone Black and Ubuntu ARM available on websites, forums, and books that you can check out.

First, we have to install an Ubuntu ARM distribution compatible with ROS. So, an image of Ubuntu ARM is needed. You can obtain an Ubuntu 13.04 Raring armhf using wget with the following command:

$ wget https://rcn-ee.net/deb/flasher/raring/BBB-eMMC-flasher-ubuntu-13.04-2013-10-08.img

Download the Ubuntu 13.04 armhf image and install it on your SD card. You can get more details on how to install Ubuntu on Bealgebone Black on eLinux at http://elinux.org/Beagleboard:Ubuntu_On_BeagleBone_Black#Ubuntu_Raring_On_Micro_SD.

The process described in the preceding webpage works fine, but we have to be careful with the version of Ubuntu used. As the website is periodically updated, they are now using Ubuntu 14.04, which is not compatible with ROS. We will use an Ubuntu 13.04 Raring armhf as mentioned earlier.

Once we have Ubuntu ARM on our platform, the Beaglebone Black network interfaces must be configured to provide access to the network. So, you will have to configure the network settings such as IP, DNS, and gateway.

Remember that the easiest way could be mounting the SD card in another computer and editing /etc/network/interfaces.

After setting up the network, we should install the packages, programs, and libraries that ROS will need such as CMake, Python, or Vim using the following commands:

$ sudo apt-get install cmake python-catkin-pkg python-empy python-nose python-setuptools libgtest-dev build-essential

$ sudo apt-get install g++ curl pkg-config libv4l-dev libjpeg-dev build-essential libssl-dev vim

The operating system for Beaglebone Black is set up for micro SD cards with 1-4 GHz. This memory space is very limited if we want to use a great part of the ROS Hydro packages. So in order to solve this situation, we can use SD cards with larger space and expand the file system to occupy all the space available with re-partitioning.

So if we want to work with a bigger memory space, it is recommended to expand the Beaglebone Black memory file system. This process is further explained at http://elinux.org/Beagleboard:Expanding_File_System_Partition_On_A_microSD.

You can do this by following the commands listed next:

  1. We need to become a super user, so we will type the following command and our password:
    $ sudo su
    
  2. We will look at the partitions of our SD card:
    $ fdisk /dev/mmcblk0
    
  3. On typing p, the two partitions of the SD card will be shown:
    $ p
    
  4. After this, we will delete one partition by typing 'd' and then, we will type 2 to indicate that we want to delete /dev/mmcblk0p2:
    $ d
    $ 2
    
  5. On typing n, a new partition will be created; if we type p it will be a primary partition. We will indicate that we want to number it as the second partition by typing 2:
    $ n
    $ p
    $ 2
    
  6. You can write these changes by typing w if everything is right, or eliminate the changes with Ctrl + Z:
    $ w
    
  7. We should reboot the board after finishing:
    $ reboot
    
  8. Once again, become a super user once the reboot is complete:
    $ sudo su
    
  9. And finally, run the following command to execute the expansion of the memory file system of the operating system.
    $ resize2fs /dev/mmcblk0p2
    

Now we should be ready to install ROS. At this point, the process of installation is pretty similar to the PC installation previously explained in this chapter. So, we should be familiar with it. We will see that the main difference when installing ROS on BeagleBone Black is that we can't install the ROS full-desktop; we must install it package by package.

Setting up the local machine and source.list file

Now you will start setting up your local machine:

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

After this, we will configure the source lists depending on the Ubuntu version that we have installed in BeagleBone Black. The number of Ubuntu versions compatible with BeagleBone Black are limited, and only active builds can be found for Ubuntu 13.04 raring armhf, the most popular version of Ubuntu ARM.

  • Ubuntu 13.04 Raring armhf:
    $ sudo sh -c 'echo "deb http://packages.namniart.com/repos/ros raring main" > /etc/apt/sources.list.d/ros-latest.list'
    
  • Ubuntu 12.10 Quantal armhf:
    $ sudo sh -c 'echo "deb http://packages.namniart.com/repos/ros quantal main" > /etc/apt/sources.list.d/ros-latest.list'
    
  • Ubuntu 12.04 Precise armhf:
    $ sudo sh -c 'echo "deb http://packages.namniart.com/repos/ros precise main" > /etc/apt/sources.list.d/ros-latest.list'
    

Setting up your keys

As explained 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:

$ wget http://packages.namniart.com/repos/namniart.key -O - | sudo apt-key add –

Installing the ROS packages

Before the installation of ROS packages, we must update the system to avoid problems of library dependencies.

$ sudo apt-get update

This part of the installation is slightly different for the Beaglebone Black. There are a lot of libraries and packages in ROS and not all of them compile fully on an ARM. So, it is not possible to make a full-desktop installation. It is recommended to install package by package to ensure that they will work on an ARM platform.

You can try to install ROS-base, known as ROS Bare Bones. ROS-base installs the ROS package along with the build and communications libraries but does not include the GUI tools:

$ sudo apt-get install ros-hydro-ros-base

We can install specific ROS packages by using the following command:

$ sudo apt-get install ros-hydro-PACKAGE

If we need to find the ROS packages available for BeagleBone Black, you can run the following command:

$ apt-cache search ros-hydro

For example, the following packages are the basics that work with ROS and can be installed individually using apt-get install:

$ sudo apt-get install ros-hydro-ros
$ sudo apt-get install ros-hydro-roslaunch
$ sudo apt-get install ros-hydro-rosparam
$ sudo apt-get install ros-hydro-rosservice

Although theoretically, not all the packages of ROS are supported by BeagleBone Black, in practice, we have been able to migrate entire projects developed on PC to BeagleBone Black. We tried a lot of packages, and we could only not install rviz.

Initializing rosdep for ROS

The rosdep command-line tool must be installed and initialized before you can use ROS. This allows you to easily install libraries and solving system dependencies for the source you want to compile, and is required to run some core components in ROS. You can use the following commands to install and initialize rosdep:

$ sudo apt-get install python-rosdep
$ sudo rosdep init
$ rosdep update

Setting up the environment in BeagleBone Black

If you have arrived at this step, congratulations because you have installed ROS in your BeagleBone Black. The ROS environment variables can be added to your bash, so they will be added every time a shell is launched:

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

We have to be careful if we have more than one version of ROS in our system. The bashrc setup must use the variables of the version being used only.

If we want to set up the environment in the current shell, we will run the following command:

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

Getting rosinstall for BeagleBone Black

Rosinstall is a common command-line tool in ROS that helps us to install packages easily. It can be installed on Ubuntu with the following command line:

$ sudo apt-get install python-rosinstall

Summary

In this chapter, we have installed ROS Hydro on different devices (PC, VirtualBox, and BeagleBone Black) in Ubuntu. With these steps, you have everything necessary installed on your system to start working with ROS and you can also practice the examples in this book. You also have the option of installing ROS using the source code. This option is for advanced users and we recommend you use only the repository as installation as it is more common and normally does not give errors or problems.

It is a good idea to play around with ROS and its installation on a virtual machine. That way, if you have problems with the installation or with something else, you can reinstall a new copy of your operating system and start again.

Normally, with virtual machines, you will not have access to real hardware, for example, sensors or actuators. Anyway, you can use it for testing the algorithms.

Left arrow icon Right arrow icon
Download code icon Download Code

Description

If you have ever tried building a robot, then you know how cumbersome programming everything from scratch can be. This is where ROS comes into the picture. It is a collection of tools, libraries, and conventions that simplifies the robot building process. What’s more, ROS encourages collaborative robotics software development, allowing you to connect with experts in various fields to collaborate and build upon each other's work. Packed full of examples, this book will help you understand the ROS framework to help you build your own robot applications in a simulated environment and share your knowledge with the large community supporting ROS. Starting at an introductory level, this book is a comprehensive guide to the fascinating world of robotics, covering sensor integration, modeling, simulation, computer vision, navigation algorithms, and more. You will then go on to explore concepts like topics, messages, and nodes. Next, you will learn how to make your robot see with HD cameras, or navigate obstacles with range sensors. Furthermore, thanks to the contributions of the vast ROS community, your robot will be able to navigate autonomously, and even recognize and interact with you in a matter of minutes. What’s new in this updated edition? First and foremost, we are going to work with ROS Hydro this time around. You will learn how to create, visualize, and process Point Cloud information from different sensors. This edition will also show you how to control and plan motion of robotic arms with multiple joints using MoveIt! By the end of this book, you will have all the background you need to build your own robot and get started with ROS.

Who is this book for?

In order to make the most of the book, you should have a C++ programming background, knowledge of GNU/Linux systems, and general skills in computer science. No previous background in ROS is required, as this book takes you from the ground up.

What you will learn

  • Install a complete ROS Hydro system
  • Create ROS packages and metapackages, using and debugging them in real time
  • Build, handle, and debug ROS nodes
  • Design your 3D robot model and simulate it in a virtual environment within Gazebo
  • Generate and adapt the navigation stack to work with your robot
  • Integrate different sensors such as Range Laser, Arduino, and Kinect with your robot
  • Visualize and process Point Cloud information from different sensors
  • Control and plan the motion of robotic arms with multiple joints using MoveIt!
Estimated delivery fee Deliver to Australia

Economy delivery 7 - 10 business days

AU$19.95

Product Details

Country selected
Publication date, Length, Edition, Language, ISBN-13
Publication date : Aug 18, 2015
Length: 458 pages
Edition : 1st
Language : English
ISBN-13 : 9781783987580
Category :
Languages :
Concepts :
Tools :

What do you get with Print?

Product feature icon Instant access to your digital eBook copy whilst your Print order is Shipped
Product feature icon Paperback book shipped to your preferred address
Product feature icon Download this book in EPUB and PDF formats
Product feature icon Access this title in our online reader with advanced features
Product feature icon DRM FREE - Read whenever, wherever and however you want
OR
Modal Close icon
Payment Processing...
tick Completed

Shipping Address

Billing Address

Shipping Methods
Estimated delivery fee Deliver to Australia

Economy delivery 7 - 10 business days

AU$19.95

Product Details

Publication date : Aug 18, 2015
Length: 458 pages
Edition : 1st
Language : English
ISBN-13 : 9781783987580
Category :
Languages :
Concepts :
Tools :

Packt Subscriptions

See our plans and pricing
Modal Close icon
AU$24.99 billed monthly
Feature tick icon Unlimited access to Packt's library of 7,000+ practical books and videos
Feature tick icon Constantly refreshed with 50+ new titles a month
Feature tick icon Exclusive Early access to books as they're written
Feature tick icon Solve problems while you work with advanced search and reference features
Feature tick icon Offline reading on the mobile app
Feature tick icon Simple pricing, no contract
AU$249.99 billed annually
Feature tick icon Unlimited access to Packt's library of 7,000+ practical books and videos
Feature tick icon Constantly refreshed with 50+ new titles a month
Feature tick icon Exclusive Early access to books as they're written
Feature tick icon Solve problems while you work with advanced search and reference features
Feature tick icon Offline reading on the mobile app
Feature tick icon Choose a DRM-free eBook or Video every month to keep
Feature tick icon PLUS own as many other DRM-free eBooks or Videos as you like for just AU$5 each
Feature tick icon Exclusive print discounts
AU$349.99 billed in 18 months
Feature tick icon Unlimited access to Packt's library of 7,000+ practical books and videos
Feature tick icon Constantly refreshed with 50+ new titles a month
Feature tick icon Exclusive Early access to books as they're written
Feature tick icon Solve problems while you work with advanced search and reference features
Feature tick icon Offline reading on the mobile app
Feature tick icon Choose a DRM-free eBook or Video every month to keep
Feature tick icon PLUS own as many other DRM-free eBooks or Videos as you like for just AU$5 each
Feature tick icon Exclusive print discounts

Frequently bought together


Stars icon
Total AU$ 227.97
Learning ROS for Robotics Programming Second Edition
AU$75.99
Learning Robotics using Python
AU$67.99
Mastering ROS for Robotics Programming
AU$83.99
Total AU$ 227.97 Stars icon
Banner background image

Table of Contents

11 Chapters
1. Getting Started with ROS Hydro Chevron down icon Chevron up icon
2. ROS Architecture and Concepts Chevron down icon Chevron up icon
3. Visualization and Debug Tools Chevron down icon Chevron up icon
4. Using Sensors and Actuators with ROS Chevron down icon Chevron up icon
5. Computer Vision Chevron down icon Chevron up icon
6. Point Clouds Chevron down icon Chevron up icon
7. 3D Modeling and Simulation Chevron down icon Chevron up icon
8. The Navigation Stack – Robot Setups Chevron down icon Chevron up icon
9. The Navigation Stack – Beyond Setups Chevron down icon Chevron up icon
10. Manipulation with MoveIt! Chevron down icon Chevron up icon
Index Chevron down icon Chevron up icon

Customer reviews

Top Reviews
Rating distribution
Full star icon Full star icon Full star icon Full star icon Empty star icon 4
(8 Ratings)
5 star 50%
4 star 25%
3 star 12.5%
2 star 0%
1 star 12.5%
Filter icon Filter
Top Reviews

Filter reviews by




Jesús Andrés Jara Puelles May 16, 2016
Full star icon Full star icon Full star icon Full star icon Full star icon 5
The excellent book.
Amazon Verified review Amazon
Akihiko HONDA Sep 25, 2015
Full star icon Full star icon Full star icon Full star icon Full star icon 5
I'm one of the technical reviewers of this book. As far as I read, I recommend this book to new challengers to intelligent robots and highly motivated people who want to extend the capabilities of their own robot. As I myself am working in the field of space robotics, this book will surely solve some of my colleagues’ technical problems.Robot Operating System (ROS) is middleware to operate robots. It provides essential functions to develop complicated system. The famous examples of using ROS are DARPA Robotics Challenge and Robonaut 2.This book starts with how to set up ROS on your computer. In later chapters, you can learn how to connect sensors and actuators, process image (mono/stereo ) and point cloud data using OpenCV and PCL, use dynamics simulator (GAZEBO), and navigate or manipulate robots.Each chapter provides explanations, one by one, and has sample programs and links to the repository. This point is very important because ROS and its programs are developed and maintained by open source community. This book can provide reader with comprehensive view and a good foothold to start with this technology.Finally, though ROS version Hydro is mainly discussed in this book, the differences between Hydro and Indigo (the newer and long-term supported one) is quite small. Therefore, this book will be useful for a long time.
Amazon Verified review Amazon
Juan J. Garcia Montaño Sep 24, 2015
Full star icon Full star icon Full star icon Full star icon Full star icon 5
Very good book, I have learned to use some robots as Turtlebot, and understand concepts such as topics, nodes and services.
Amazon Verified review Amazon
James A Herd Oct 05, 2015
Full star icon Full star icon Full star icon Full star icon Full star icon 5
This book is the best way I've seen for those wanting to get started with ROS. Unlike official ROS tutorials, instead of talking about somewhat abstract concepts behind ROS it uses concrete examples that most robotics beginners can relate to.This book has the first instance of an end to end tutorial (that I've come across) that shows how to get a custom robot arm set up with the MoveIt! toolkit to allow for inverse kinematics, trajectory planning and object collisions.Given how much easier ROS is to understand with this book I've started recommending it to people at the local robotics meetup!
Amazon Verified review Amazon
Marco Nov 24, 2015
Full star icon Full star icon Full star icon Full star icon Empty star icon 4
some instructions in the book are not clear
Amazon Verified review Amazon
Get free access to Packt library with over 7500+ books and video courses for 7 days!
Start Free Trial

FAQs

What is the delivery time and cost of print book? Chevron down icon Chevron up icon

Shipping Details

USA:

'

Economy: Delivery to most addresses in the US within 10-15 business days

Premium: Trackable Delivery to most addresses in the US within 3-8 business days

UK:

Economy: Delivery to most addresses in the U.K. within 7-9 business days.
Shipments are not trackable

Premium: Trackable delivery to most addresses in the U.K. within 3-4 business days!
Add one extra business day for deliveries to Northern Ireland and Scottish Highlands and islands

EU:

Premium: Trackable delivery to most EU destinations within 4-9 business days.

Australia:

Economy: Can deliver to P. O. Boxes and private residences.
Trackable service with delivery to addresses in Australia only.
Delivery time ranges from 7-9 business days for VIC and 8-10 business days for Interstate metro
Delivery time is up to 15 business days for remote areas of WA, NT & QLD.

Premium: Delivery to addresses in Australia only
Trackable delivery to most P. O. Boxes and private residences in Australia within 4-5 days based on the distance to a destination following dispatch.

India:

Premium: Delivery to most Indian addresses within 5-6 business days

Rest of the World:

Premium: Countries in the American continent: Trackable delivery to most countries within 4-7 business days

Asia:

Premium: Delivery to most Asian addresses within 5-9 business days

Disclaimer:
All orders received before 5 PM U.K time would start printing from the next business day. So the estimated delivery times start from the next day as well. Orders received after 5 PM U.K time (in our internal systems) on a business day or anytime on the weekend will begin printing the second to next business day. For example, an order placed at 11 AM today will begin printing tomorrow, whereas an order placed at 9 PM tonight will begin printing the day after tomorrow.


Unfortunately, due to several restrictions, we are unable to ship to the following countries:

  1. Afghanistan
  2. American Samoa
  3. Belarus
  4. Brunei Darussalam
  5. Central African Republic
  6. The Democratic Republic of Congo
  7. Eritrea
  8. Guinea-bissau
  9. Iran
  10. Lebanon
  11. Libiya Arab Jamahriya
  12. Somalia
  13. Sudan
  14. Russian Federation
  15. Syrian Arab Republic
  16. Ukraine
  17. Venezuela
What is custom duty/charge? Chevron down icon Chevron up icon

Customs duty are charges levied on goods when they cross international borders. It is a tax that is imposed on imported goods. These duties are charged by special authorities and bodies created by local governments and are meant to protect local industries, economies, and businesses.

Do I have to pay customs charges for the print book order? Chevron down icon Chevron up icon

The orders shipped to the countries that are listed under EU27 will not bear custom charges. They are paid by Packt as part of the order.

List of EU27 countries: www.gov.uk/eu-eea:

A custom duty or localized taxes may be applicable on the shipment and would be charged by the recipient country outside of the EU27 which should be paid by the customer and these duties are not included in the shipping charges been charged on the order.

How do I know my custom duty charges? Chevron down icon Chevron up icon

The amount of duty payable varies greatly depending on the imported goods, the country of origin and several other factors like the total invoice amount or dimensions like weight, and other such criteria applicable in your country.

For example:

  • If you live in Mexico, and the declared value of your ordered items is over $ 50, for you to receive a package, you will have to pay additional import tax of 19% which will be $ 9.50 to the courier service.
  • Whereas if you live in Turkey, and the declared value of your ordered items is over € 22, for you to receive a package, you will have to pay additional import tax of 18% which will be € 3.96 to the courier service.
How can I cancel my order? Chevron down icon Chevron up icon

Cancellation Policy for Published Printed Books:

You can cancel any order within 1 hour of placing the order. Simply contact customercare@packt.com with your order details or payment transaction id. If your order has already started the shipment process, we will do our best to stop it. However, if it is already on the way to you then when you receive it, you can contact us at customercare@packt.com using the returns and refund process.

Please understand that Packt Publishing cannot provide refunds or cancel any order except for the cases described in our Return Policy (i.e. Packt Publishing agrees to replace your printed book because it arrives damaged or material defect in book), Packt Publishing will not accept returns.

What is your returns and refunds policy? Chevron down icon Chevron up icon

Return Policy:

We want you to be happy with your purchase from Packtpub.com. We will not hassle you with returning print books to us. If the print book you receive from us is incorrect, damaged, doesn't work or is unacceptably late, please contact Customer Relations Team on customercare@packt.com with the order number and issue details as explained below:

  1. If you ordered (eBook, Video or Print Book) incorrectly or accidentally, please contact Customer Relations Team on customercare@packt.com within one hour of placing the order and we will replace/refund you the item cost.
  2. Sadly, if your eBook or Video file is faulty or a fault occurs during the eBook or Video being made available to you, i.e. during download then you should contact Customer Relations Team within 14 days of purchase on customercare@packt.com who will be able to resolve this issue for you.
  3. You will have a choice of replacement or refund of the problem items.(damaged, defective or incorrect)
  4. Once Customer Care Team confirms that you will be refunded, you should receive the refund within 10 to 12 working days.
  5. If you are only requesting a refund of one book from a multiple order, then we will refund you the appropriate single item.
  6. Where the items were shipped under a free shipping offer, there will be no shipping costs to refund.

On the off chance your printed book arrives damaged, with book material defect, contact our Customer Relation Team on customercare@packt.com within 14 days of receipt of the book with appropriate evidence of damage and we will work with you to secure a replacement copy, if necessary. Please note that each printed book you order from us is individually made by Packt's professional book-printing partner which is on a print-on-demand basis.

What tax is charged? Chevron down icon Chevron up icon

Currently, no tax is charged on the purchase of any print book (subject to change based on the laws and regulations). A localized VAT fee is charged only to our European and UK customers on eBooks, Video and subscriptions that they buy. GST is charged to Indian customers for eBooks and video purchases.

What payment methods can I use? Chevron down icon Chevron up icon

You can pay with the following card types:

  1. Visa Debit
  2. Visa Credit
  3. MasterCard
  4. PayPal
What is the delivery time and cost of print books? Chevron down icon Chevron up icon

Shipping Details

USA:

'

Economy: Delivery to most addresses in the US within 10-15 business days

Premium: Trackable Delivery to most addresses in the US within 3-8 business days

UK:

Economy: Delivery to most addresses in the U.K. within 7-9 business days.
Shipments are not trackable

Premium: Trackable delivery to most addresses in the U.K. within 3-4 business days!
Add one extra business day for deliveries to Northern Ireland and Scottish Highlands and islands

EU:

Premium: Trackable delivery to most EU destinations within 4-9 business days.

Australia:

Economy: Can deliver to P. O. Boxes and private residences.
Trackable service with delivery to addresses in Australia only.
Delivery time ranges from 7-9 business days for VIC and 8-10 business days for Interstate metro
Delivery time is up to 15 business days for remote areas of WA, NT & QLD.

Premium: Delivery to addresses in Australia only
Trackable delivery to most P. O. Boxes and private residences in Australia within 4-5 days based on the distance to a destination following dispatch.

India:

Premium: Delivery to most Indian addresses within 5-6 business days

Rest of the World:

Premium: Countries in the American continent: Trackable delivery to most countries within 4-7 business days

Asia:

Premium: Delivery to most Asian addresses within 5-9 business days

Disclaimer:
All orders received before 5 PM U.K time would start printing from the next business day. So the estimated delivery times start from the next day as well. Orders received after 5 PM U.K time (in our internal systems) on a business day or anytime on the weekend will begin printing the second to next business day. For example, an order placed at 11 AM today will begin printing tomorrow, whereas an order placed at 9 PM tonight will begin printing the day after tomorrow.


Unfortunately, due to several restrictions, we are unable to ship to the following countries:

  1. Afghanistan
  2. American Samoa
  3. Belarus
  4. Brunei Darussalam
  5. Central African Republic
  6. The Democratic Republic of Congo
  7. Eritrea
  8. Guinea-bissau
  9. Iran
  10. Lebanon
  11. Libiya Arab Jamahriya
  12. Somalia
  13. Sudan
  14. Russian Federation
  15. Syrian Arab Republic
  16. Ukraine
  17. Venezuela