Book Image

Mastering ROS for Robotics Programming - Second Edition

By : Jonathan Cacace, Lentin Joseph
Book Image

Mastering ROS for Robotics Programming - Second Edition

By: Jonathan Cacace, Lentin Joseph

Overview of this book

In this day and age, robotics has been gaining a lot of traction in various industries where consistency and perfection matter. Automation is achieved via robotic applications and various platforms that support robotics. The Robot Operating System (ROS) is a modular software platform to develop generic robotic applications. This book focuses on the most stable release of ROS (Kinetic Kame), discusses advanced concepts, and effectively teaches you programming using ROS. We begin with aninformative overview of the ROS framework, which will give you a clear idea of how ROS works. During the course of this book, you’ll learn to build models of complex robots, and simulate and interface the robot using the ROS MoveIt! motion planning library and ROS navigation stacks. Learn to leverage several ROS packages to embrace your robot models. After covering robot manipulation and navigation, you’ll get to grips with the interfacing I/O boards, sensors, and actuators of ROS. Vision sensors are a key component of robots, and an entire chapter is dedicated to the vision sensor and image elaboration, its interface in ROS and programming. You’ll also understand the hardware interface and simulation of complex robots to ROS and ROS Industrial. At the end of this book, you’ll discover the best practices to follow when programming using ROS.
Table of Contents (22 chapters)
Title Page
Copyright and Credits
www.PacktPub.com
Contributors
Preface
Index

Preface

Robot Operating System is robotic middleware that helps developers to program robotic applications, and is widely used in robotics companies, research centers, and universities. Mastering ROS for Robotics Programming, Second Edition presents advanced concepts of the ROS framework and is particularly suitable for users who are already familiar with the basic concepts of ROS. However, a brief introduction of the basic ROS concepts is proposed in the first chapter in order to help new developers start with the examples in the book. Readers will be guided through the creation, the modeling model and design, new robots, as well as simulating and interfacing them with the ROS framework. They will use advanced simulation software to use ROS tools that allow robot navigation, manipulation, and sensor elaboration. Finally, the reader will learn how to handle important concepts such as ROS low-level controllers, nodelets, and plugins. The readers can work with almost all of the examples of the book using only a standard computer without any special hardware requirements. However, additional hardware components will be used in some chapters of the book to discuss how to use ROS with external sensors, actuators, and I/O boards.

The book is organized as follows. After an introduction to the basic concepts of ROS, how to model and simulate a robot is discussed. Gazebo and the V-REP software simulator will be used to control and interact with the modeled robot. These simulators will be used to connect the robots with MoveIt! and navigation ROS package. ROS plugins, controllers, and nodelets are then discussed. Finally, the book discusses how to connect Matlab and Simulink software with ROS.

Who this book is for

This book is meant to be used by passionate robotics developers or researchers who want to fully exploit the features of ROS. The book is also good for all the users who already are familiar with typical robotics applications or who want to start learning how to develop the world of ROS in an advanced manner, learning how to model, build, and control their own robots. A basic knowledge of GNU/Linux and C++ programming is strongly recommended if you want to easily comprehend the contents of the book.

What this book covers

Chapter 1, Introduction to ROS, gives you an understanding of the core underlying concepts of ROS. 

Chapter 2Getting Started with ROS Programming, explains how to work with ROS packages.

Chapter 3, Working with 3D Robot Modeling in ROS, discusses the design of two robots; one is a seven Degree of Freedom (DOF) manipulator and the other is a differential drive robot.

Chapter 4, Simulating Robots Using ROS and Gazebo, discusses the simulation of a seven DOF arm, differential wheeled robots, and ROS controllers that help control robot joints in Gazebo.

Chapter 5, Simulating Robots Using ROS and V-REP, introduces using the V-REP simulator and vrep_plugin to connect ROS with the simulation scene. Then the control of a seven DOF arm and a differential mobile robot is discussed.

Chapter 6, Using the ROS MoveiIt! and Navigation Stack, interfaces out-of-the-box functionalities such as robot manipulation and autonomous navigation using ROS MoveIt! and Navigation stack.

Chapter 7, Working with Pluginlib, Nodelets, and Gazebo Plugins, shows some of the advanced concepts in ROS, such as ROS pluginlib, nodelets, and Gazebo plugins. We will discuss the functionalities and application of each concept and can practice one example to demonstrate its working.

Chapter 8, Writing ROS Controllers and Visualization Plugins, shows how to write a basic ROS controller for PR2 robots and robots similar to PR2. After creating the controller, we will run the controller using the PR2 simulation in Gazebo. We will also see how to create plugin for RViz.

Chapter 9, Interfacing I/O Boards, Sensor, and Actuators to ROS, discusses interfacing some hardware components, such as sensors and actuators, with ROS. We will see the interfacing of sensors using I/O boards, such as Arduino, Raspberry Pi, and Odroid-XU4, with ROS.

Chapter 10Programming Vision Sensors Using ROS, Open-CV and PCL, discusses how to interface various vision sensors with ROS and program it using libraries such as Open Source Computer Vision (OpenCV) and Point Cloud Library (PCL), and working with AR Markers.

Chapter 11, Building and Interfacing Differential Drive Mobile Robot Hardware in ROS, helps you to build autonomous mobile robot hardware with differential drive configuration and interface it with ROS. This chapter aims to give you an idea of building a custom mobile robot and interfacing it with ROS.

Chapter 12, Exploring the Advanced Capabilities of ROS-MoveIt!, discusses the capabilities of MoveIt! such as collision avoidance, perception using 3D sensors, grasping, picking, and placing. After that, we can see how to interface of a robotic manipulator hardware with MoveIt!

Chapter 13, Using ROS in Matlab and Simulink, discusses how to connect Matlab and Simulink software with ROS.

Chapter 14, ROS for Industrial Robots, helps you understand and install ROS-Industrial packages in ROS. We can see how to develop an MoveIt! IKFast plugin for an industrial robot.

Chapter 15, Troubleshooting and Best Practices in ROS, discusses how to set the ROS development environment in Eclipse IDE, best practices in ROS, and troubleshooting tips in ROS.

To get the most out of this book

In order to run the examples in this book, you need a standard PC running Linux OS. Ubuntu 16.04 is the suggested Linux distribution, but Debian 8 is supported as well. The suggested PC configuration requires at least 4 GB of RAM and a modern processor (Intel i-family) to execute Gazebo simulations and image processing algorithms.

Readers can even work in a virtual environment setup installing Linux OS on a virtual machine, using Virtual box or VMware software hosted on a Windows system. The disadvantage of this choice is that more computational power is needed to work with the examples and the reader could face issues when interfacing ROS with real hardware.

The software needed to follow the book is ROS and Kinetic Kame. Additional software required is V-REP simulator, Git, Matlab, and Simulink.

Finally, some chapters help readers to interface ROS with commercial hardware such as I/O boards (Arduino, Odroid, and Raspberry Pi computers), vison sensors (Kinect/Asus Xition Pro), and actuators. These are special hardware components that must be bought to run some examples of the book but are not strictly required to learn ROS.

Download the example code files

You can download the example code files for this book from your account at www.packtpub.com. If you purchased this book elsewhere, you can visit www.packtpub.com/support and register to have the files emailed directly to you.

You can download the code files by following these steps:

  1. Log in or register at www.packtpub.com.
  2. Select the SUPPORT tab.
  3. Click on Code Downloads & Errata.
  4. Enter the name of the book in the Search box and follow the onscreen instructions.

Once the file is downloaded, please make sure that you unzip or extract the folder using the latest version of:

  • WinRAR/7-Zip for Windows
  • Zipeg/iZip/UnRarX for Mac
  • 7-Zip/PeaZip for Linux

The code bundle for the book is also hosted on GitHub at https://github.com/PacktPublishing/Mastering-ROS-for-Robotics-Programming-Second-Edition. In case there's an update to the code, it will be updated on the existing GitHub repository.

We also have other code bundles from our rich catalog of books and videos available at https://github.com/PacktPublishing/. Check them out!

Download the color images

We also provide a PDF file that has color images of the screenshots/diagrams used in this book. You can download it here: http://www.packtpub.com/sites/default/files/downloads/MasteringROSforRoboticsProgrammingSecondEdition_ColorImages.pdf.

Conventions used

There are a number of text conventions used throughout this book.

CodeInText: Indicates code words in text, database table names, folder names, filenames, file extensions, pathnames, dummy URLs, user input, and Twitter handles. Here is an example: "Mount the downloaded WebStorm-10*.dmg disk image file as another disk in your system."

A block of code is set as follows:

<launch> 
 <group ns="/"> 
  <param name="rosversion" command="rosversion roslaunch" /> 
  <param name="rosdistro" command="rosversion -d" /> 
  <node pkg="rosout" type="rosout" name="rosout" respawn="true"/> 
 </group> 
</launch>

Any command-line input or output is written as follows:

$ rostopic list
$ cd 

Bold: Indicates a new term, an important word, or words that you see onscreen. For example, words in menus or dialog boxes appear in the text like this. Here is an example: "On the main toolbar, select File | Open Workspace, and choose the directory representing the ROS workspace."

Note

Warnings or important notes appear like this.

Note

Tips and tricks appear like this.

Get in touch

Feedback from our readers is always welcome.

General feedback: Email [email protected] and mention the book title in the subject of your message. If you have questions about any aspect of this book, please email us at [email protected].

Errata: Although we have taken every care to ensure the accuracy of our content, mistakes do happen. If you have found a mistake in this book, we would be grateful if you would report this to us. Please visit www.packtpub.com/submit-errata, selecting your book, clicking on the Errata Submission Form link, and entering the details.

Piracy: If you come across any illegal copies of our works in any form on the Internet, we would be grateful if you would provide us with the location address or website name. Please contact us at [email protected] with a link to the material.

If you are interested in becoming an author: If there is a topic that you have expertise in and you are interested in either writing or contributing to a book, please visit authors.packtpub.com.

Reviews

Please leave a review. Once you have read and used this book, why not leave a review on the site that you purchased it from? Potential readers can then see and use your unbiased opinion to make purchase decisions, we at Packt can understand what you think about our products, and our authors can see your feedback on their book. Thank you!

For more information about Packt, please visit packtpub.com.