Search icon
Arrow left icon
All Products
Best Sellers
New Releases
Books
Videos
Audiobooks
Learning Hub
Newsletters
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.

$15.99 per month
Book Aug 2015 458 pages 1st Edition
eBook
$43.99 $29.99
Print
$54.99
Subscription
$15.99 Monthly
eBook
$43.99 $29.99
Print
$54.99
Subscription
$15.99 Monthly

What do you get with a Packt Subscription?

Free for first 7 days. $15.99 p/m after that. Cancel any time!
Product feature icon Unlimited ad-free access to the largest independent learning library in tech. Access this title and thousands more!
Product feature icon 50+ new titles added per month, including many first-to-market concepts and exclusive early access to books as they are being written.
Product feature icon Innovative learning tools, including AI book assistants, code context explainers, and text-to-speech.
Product feature icon Thousands of reference materials covering every tech concept you need to stay up to date.
Subscribe now
View plans & pricing

Product Details


Publication date : Aug 18, 2015
Length 458 pages
Edition : 1st Edition
Language : English
ISBN-13 : 9781783987580
Category :
Languages :
Concepts :
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.

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.

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:

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:

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:

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:

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:

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:

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:

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:

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.

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:

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:

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

Key benefits

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!

What do you get with a Packt Subscription?

Free for first 7 days. $15.99 p/m after that. Cancel any time!
Product feature icon Unlimited ad-free access to the largest independent learning library in tech. Access this title and thousands more!
Product feature icon 50+ new titles added per month, including many first-to-market concepts and exclusive early access to books as they are being written.
Product feature icon Innovative learning tools, including AI book assistants, code context explainers, and text-to-speech.
Product feature icon Thousands of reference materials covering every tech concept you need to stay up to date.
Subscribe now
View plans & pricing

Product Details


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

Table of Contents

27 Chapters
Learning ROS for Robotics Programming Second Edition Chevron down icon Chevron up icon
Credits Chevron down icon Chevron up icon
About the Author Chevron down icon Chevron up icon
Acknowledgments Chevron down icon Chevron up icon
About the Author Chevron down icon Chevron up icon
Acknowledgments Chevron down icon Chevron up icon
About the Author Chevron down icon Chevron up icon
Acknowledgments Chevron down icon Chevron up icon
About the Author Chevron down icon Chevron up icon
Acknowledgments Chevron down icon Chevron up icon
About the Reviewer Chevron down icon Chevron up icon
About the Reviewer Chevron down icon Chevron up icon
Acknowledgments Chevron down icon Chevron up icon
About the Reviewers Chevron down icon Chevron up icon
www.PacktPub.com Chevron down icon Chevron up icon
Preface Chevron down icon Chevron up icon
Getting Started with ROS Hydro Chevron down icon Chevron up icon
ROS Architecture and Concepts Chevron down icon Chevron up icon
Visualization and Debug Tools Chevron down icon Chevron up icon
Using Sensors and Actuators with ROS Chevron down icon Chevron up icon
Computer Vision Chevron down icon Chevron up icon
Point Clouds Chevron down icon Chevron up icon
3D Modeling and Simulation Chevron down icon Chevron up icon
The Navigation Stack – Robot Setups Chevron down icon Chevron up icon
The Navigation Stack – Beyond Setups Chevron down icon Chevron up icon
Manipulation with MoveIt! Chevron down icon Chevron up icon
Index Chevron down icon Chevron up icon

Customer reviews

Filter icon Filter
Top Reviews
Rating distribution
Empty star icon Empty star icon Empty star icon Empty star icon Empty star icon 0
(0 Ratings)
5 star 0%
4 star 0%
3 star 0%
2 star 0%
1 star 0%

Filter reviews by


No reviews found
Get free access to Packt library with over 7500+ books and video courses for 7 days!
Start Free Trial

FAQs

What is included in a Packt subscription? Chevron down icon Chevron up icon

A subscription provides you with full access to view all Packt and licnesed content online, this includes exclusive access to Early Access titles. Depending on the tier chosen you can also earn credits and discounts to use for owning content

How can I cancel my subscription? Chevron down icon Chevron up icon

To cancel your subscription with us simply go to the account page - found in the top right of the page or at https://subscription.packtpub.com/my-account/subscription - From here you will see the ‘cancel subscription’ button in the grey box with your subscription information in.

What are credits? Chevron down icon Chevron up icon

Credits can be earned from reading 40 section of any title within the payment cycle - a month starting from the day of subscription payment. You also earn a Credit every month if you subscribe to our annual or 18 month plans. Credits can be used to buy books DRM free, the same way that you would pay for a book. Your credits can be found in the subscription homepage - subscription.packtpub.com - clicking on ‘the my’ library dropdown and selecting ‘credits’.

What happens if an Early Access Course is cancelled? Chevron down icon Chevron up icon

Projects are rarely cancelled, but sometimes it's unavoidable. If an Early Access course is cancelled or excessively delayed, you can exchange your purchase for another course. For further details, please contact us here.

Where can I send feedback about an Early Access title? Chevron down icon Chevron up icon

If you have any feedback about the product you're reading, or Early Access in general, then please fill out a contact form here and we'll make sure the feedback gets to the right team. 

Can I download the code files for Early Access titles? Chevron down icon Chevron up icon

We try to ensure that all books in Early Access have code available to use, download, and fork on GitHub. This helps us be more agile in the development of the book, and helps keep the often changing code base of new versions and new technologies as up to date as possible. Unfortunately, however, there will be rare cases when it is not possible for us to have downloadable code samples available until publication.

When we publish the book, the code files will also be available to download from the Packt website.

How accurate is the publication date? Chevron down icon Chevron up icon

The publication date is as accurate as we can be at any point in the project. Unfortunately, delays can happen. Often those delays are out of our control, such as changes to the technology code base or delays in the tech release. We do our best to give you an accurate estimate of the publication date at any given time, and as more chapters are delivered, the more accurate the delivery date will become.

How will I know when new chapters are ready? Chevron down icon Chevron up icon

We'll let you know every time there has been an update to a course that you've bought in Early Access. You'll get an email to let you know there has been a new chapter, or a change to a previous chapter. The new chapters are automatically added to your account, so you can also check back there any time you're ready and download or read them online.

I am a Packt subscriber, do I get Early Access? Chevron down icon Chevron up icon

Yes, all Early Access content is fully available through your subscription. You will need to have a paid for or active trial subscription in order to access all titles.

How is Early Access delivered? Chevron down icon Chevron up icon

Early Access is currently only available as a PDF or through our online reader. As we make changes or add new chapters, the files in your Packt account will be updated so you can download them again or view them online immediately.

How do I buy Early Access content? Chevron down icon Chevron up icon

Early Access is a way of us getting our content to you quicker, but the method of buying the Early Access course is still the same. Just find the course you want to buy, go through the check-out steps, and you’ll get a confirmation email from us with information and a link to the relevant Early Access courses.

What is Early Access? Chevron down icon Chevron up icon

Keeping up to date with the latest technology is difficult; new versions, new frameworks, new techniques. This feature gives you a head-start to our content, as it's being created. With Early Access you'll receive each chapter as it's written, and get regular updates throughout the product's development, as well as the final course as soon as it's ready.We created Early Access as a means of giving you the information you need, as soon as it's available. As we go through the process of developing a course, 99% of it can be ready but we can't publish until that last 1% falls in to place. Early Access helps to unlock the potential of our content early, to help you start your learning when you need it most. You not only get access to every chapter as it's delivered, edited, and updated, but you'll also get the finalized, DRM-free product to download in any format you want when it's published. As a member of Packt, you'll also be eligible for our exclusive offers, including a free course every day, and discounts on new and popular titles.