Book Image

ROS Programming: Building Powerful Robots

By : Anil Mahtani, Aaron Martinez, Enrique Fernandez Perdomo, Luis Sánchez, Lentin Joseph
Book Image

ROS Programming: Building Powerful Robots

By: Anil Mahtani, Aaron Martinez, Enrique Fernandez Perdomo, Luis Sánchez, Lentin Joseph

Overview of this book

This learning path is designed to help you program and build your robots using open source ROS libraries and tools. We start with the installation and basic concepts, then continue with the more complex modules available in ROS, such as sensor and actuator integration (drivers), navigation and mapping (so you can create an autonomous mobile robot), manipulation, computer vision, perception in 3D with PCL, and more. We then discuss advanced concepts in robotics and how to program using ROS. You'll get a deep overview of the ROS framework, which will give you a clear idea of how ROS really works. During the course of the book, you will learn how to build models of complex robots, and simulate and interface the robot using the ROS MoveIt motion planning library and ROS navigation stacks. We'll go through great projects such as building a self-driving car, an autonomous mobile robot, and image recognition using deep learning and ROS. You can find beginner, intermediate, and expert ROS robotics applications inside! It includes content from the following Packt products: ? Effective Robotics Programming with ROS - Third Edition ? Mastering ROS for Robotics Programming ? ROS Robotics Projects
Table of Contents (37 chapters)
Title page
Copyright and Credits
Packt Upsell
Preface
Bibliography
Index

Chapter 1. Getting Started with ROS

Welcome to the first chapter of this section, where you will learn how to install ROS, the new standard software framework in robotics. This section is an update on Learning ROS for Robotics Programming - Second Edition, based in ROS Hydro/Indigo. 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 and devices, or how to add new functionalities, such as autonomous navigation, visual perception, and others, to your robot. Thanks to the open source ethos and a community that is developing state-of-the-art algorithms and providing new functionalities, ROS is growing every day.

This section will cover the following topics:

  • Installing ROS Kinetic framework on a compatible 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
  • Using the navigation stack to make your robot autonomous

In this chapter, we are going to install a full version of ROS Kinetic in Ubuntu. ROS is fully supported and recommended for Ubuntu, and it is experimental for other operative systems. The version used in this section is the 15.10 (Wily Werewolf), and you can download it for free from http://releases.ubuntu.com/15.10. Note that you can also use Ubuntu 16.04 (Xenial), following the same steps shown here; indeed, for the BeagleBone Black installation we will use Ubuntu Xenial.

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

The Robot Operating System (ROS) is a framework that, nowadays, is widely accepted and used in the robotics community. Its main goal is to make the multiple components of a robotics system easy to develop and share so they can work on other robots with minimal changes. This basically allows for code reuse, and improves the quality of the code by having it tested by a large number of users and platforms. ROS was originally developed in 2007 by the Stanford Artificial Intelligence Laboratory (SAIL) in support of the Stanford AI Robot project. Since 2008, Willow Garage continued the development, and recently Open Source Robotics Foundation (OSRF) began to oversee the maintenance of ROS and partner projects, like Gazebo, including the development of new features.

A lot of research institutions have started to develop in ROS, adding hardware and sharing their code. Also, 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 that 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 humanoid robots are examples of robots with published code. 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 many other examples at http://wiki.ros.org/Robots.

Most of the sensors and actuators used in robotics are supported by ROS as drivers.

Furthermore, some companies benefit from ROS and open hardware to create cheaper and easier to use sensors, as existing software can be used for them at zero cost. The Arduino board is a good example because you can add many different kinds of sensors to this cheap electronic board, such as encoders, light and temperature sensors, and many others, and then expose their measurements to ROS to develop robotic applications.

ROS provides a hardware abstraction, low-level device control with ROS control, implementations of commonly used functionalities and libraries, message passing between processes, and package management with catkin and cmake.

It uses graph architecture with a centralized topology, where processing takes place in nodes that may receive and send messages to communicate with other nodes on the graph net. A node is any process that can read data from a sensor, control an actuator, or run high level, complex robotic or vision algorithms for mapping or navigating autonomously in the environment.

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 provide a powerful set of tools for working with ROS easily; visualization, simulators, and debugging tools are among the most important features that they have to offer. In the following 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 Berkeley Software Distribution (BSD) license and is an open source software. It is free for commercial and research use. Theros-pkg contributed packages are licensed under a variety of open source licenses.

With ROS, 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 section, we are going to use Kinetic because it is the latest version. Now we are going to show you how to install ROS Kinetic. As we mentioned before, the operating system used in the section is Ubuntu, and we are going to use it throughout this section and with all the tutorials. If you use another operating system and you want to follow the section, 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.

If you want to try installing it on an operating system other than Ubuntu, you can find instructions on how to do so with many other operating systems at http://wiki.ros.org/kinetic/Installation.