Mastering ROS for Robotics Programming
4/5
()
About this ebook
About This Book
- Develop complex robotic applications using ROS for interfacing robot manipulators and mobile robots with the help of high end robotic sensors
- Gain insights into autonomous navigation in mobile robot and motion planning in robot manipulators
- Discover the best practices and troubleshooting solutions everyone needs when working on ROS
Who This Book Is For
If you are a robotics enthusiast or researcher who wants to learn more about building robot applications using ROS, this book is for you. In order to learn from this book, you should have a basic knowledge of ROS, GNU/Linux, and C++ programming concepts. The book will also be good for programmers who want to explore the advanced features of ROS.
What You Will Learn
- Create a robot model of a Seven-DOF robotic arm and a differential wheeled mobile robot
- Work with motion planning of a Seven-DOF arm using MoveIt!
- Implement autonomous navigation in differential drive robots using SLAM and AMCL packages in ROS
- Dig deep into the ROS Pluginlib, ROS nodelets, and Gazebo plugins
- Interface I/O boards such as Arduino, Robot sensors, and High end actuators with ROS
- Simulation and motion planning of ABB and Universal arm using ROS Industrial
- Explore the ROS framework using its latest version
In Detail
The area of robotics is gaining huge momentum among corporate people, researchers, hobbyists, and students. The major challenge in robotics is its controlling software. The Robot Operating System (ROS) is a modular software platform to develop generic robotic applications.
This book discusses the advanced concepts in robotics and how to program using ROS. It starts with 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.
After discussing robot manipulation and navigation in robots, you will get to grips with the interfacing I/O boards, sensors, and actuators of ROS. One of the essential ingredients of robots are vision sensors, and an entire chapter is dedicated to the vision sensor, its interfacing in ROS, and its programming.
You will discuss the hardware interfacing and simulation of complex robot to ROS and ROS Industrial (Package used for interfacing industrial robots).
Finally, you will get to know the best practices to follow when programming using ROS.
Style and approach
This is a simplified guide to help you learn and master advanced topics in ROS using hands-on examples.
Read more from Lentin Joseph
Learning Robotics Using Python Rating: 0 out of 5 stars0 ratingsMastering ROS for Robotics Programming, Third edition: Best practices and troubleshooting solutions when working with ROS Rating: 0 out of 5 stars0 ratingsROS Robotics Projects: Make your robots see, sense, and interact with cool and engaging projects with Robotic Operating System Rating: 0 out of 5 stars0 ratingsRobot Operating System (ROS) for Absolute Beginners: Robotics Programming Made Easy Rating: 0 out of 5 stars0 ratingsMastering ROS for Robotics Programming.: Design, build, and simulate complex robots using the Robot Operating System Rating: 0 out of 5 stars0 ratings
Related to Mastering ROS for Robotics Programming
Related ebooks
Effective Robotics Programming with ROS - Third Edition Rating: 0 out of 5 stars0 ratingsLearning ROS for Robotics Programming - Second Edition Rating: 0 out of 5 stars0 ratingsROS Robotics By Example Rating: 0 out of 5 stars0 ratingsPython Programming for Arduino Rating: 5 out of 5 stars5/5Raspberry Pi: Amazing Projects from Scratch Rating: 0 out of 5 stars0 ratingsLearning Raspberry Pi Rating: 0 out of 5 stars0 ratingsROS Robotics Projects Rating: 0 out of 5 stars0 ratingsPractical Robotics in C++: Build and Program Real Autonomous Robots Using Raspberry Pi (English Edition) Rating: 0 out of 5 stars0 ratingsArduino Robotic Projects Rating: 4 out of 5 stars4/5Raspberry Pi Mechatronics Projects HOTSHOT Rating: 5 out of 5 stars5/5Python for Microcontrollers: Getting Started with MicroPython Rating: 0 out of 5 stars0 ratingsArduino Essentials Rating: 5 out of 5 stars5/5Qt 5 Blueprints Rating: 4 out of 5 stars4/5Getting Started with Raspberry Pi Zero Rating: 5 out of 5 stars5/5Robotics: from Mechanical to Sentient Machines: Thinking Machines, #1 Rating: 0 out of 5 stars0 ratingsC Programming for Arduino Rating: 4 out of 5 stars4/5OpenCV: Computer Vision Projects with Python Rating: 0 out of 5 stars0 ratingsPython Programming with Raspberry Pi Rating: 0 out of 5 stars0 ratingsYocto for Raspberry Pi Rating: 0 out of 5 stars0 ratingsRaspberry Pi :Raspberry Pi Guide On Python & Projects Programming In Easy Steps Rating: 3 out of 5 stars3/5A Welder’s Handbook to Robotic Programming Rating: 5 out of 5 stars5/5Robotics and Automation Rating: 0 out of 5 stars0 ratingsLearning C for Arduino Rating: 0 out of 5 stars0 ratingsBuilding Multicopter Video Drones Rating: 5 out of 5 stars5/5Programming the Raspberry Pi, Third Edition: Getting Started with Python Rating: 5 out of 5 stars5/5Mastering OpenCV with Practical Computer Vision Projects Rating: 0 out of 5 stars0 ratingsGetting Started with Electronic Projects Rating: 5 out of 5 stars5/5Arduino Networking Rating: 4 out of 5 stars4/5
Hardware For You
CompTIA A+ Complete Review Guide: Exam Core 1 220-1001 and Exam Core 2 220-1002 Rating: 5 out of 5 stars5/5Exploring Apple iPad: iPadOS 15 Edition: The Illustrated, Practical Guide to Using your iPad Rating: 0 out of 5 stars0 ratingsUnlock Any Roku Device: Watch Shows, TV, & Download Apps Rating: 0 out of 5 stars0 ratingsMacBook For Dummies Rating: 4 out of 5 stars4/5CompTIA A+ Complete Review Guide: Core 1 Exam 220-1101 and Core 2 Exam 220-1102 Rating: 5 out of 5 stars5/5Chip War: The Fight for the World's Most Critical Technology Rating: 4 out of 5 stars4/5Switching to a Mac For Dummies Rating: 0 out of 5 stars0 ratingsElectrical Engineering | Step by Step Rating: 0 out of 5 stars0 ratingsmacOS Sonoma For Dummies Rating: 0 out of 5 stars0 ratingsBuilding Confidence Using Your iPhone: Book I — THE ULTIMATE GUIDE Rating: 0 out of 5 stars0 ratingsiPhone For Dummies Rating: 0 out of 5 stars0 ratingsHelp! iOS 17 - iPhone: How to Use iOS17 Rating: 0 out of 5 stars0 ratingsRaspberry Pi Electronics Projects for the Evil Genius Rating: 3 out of 5 stars3/5Exploring Arduino: Tools and Techniques for Engineering Wizardry Rating: 4 out of 5 stars4/5After Steve: How Apple Became a Trillion-Dollar Company and Lost Its Soul Rating: 4 out of 5 stars4/5iPhone For Seniors For Dummies: Updated for iPhone 12 models and iOS 14 Rating: 4 out of 5 stars4/5Tor Darknet Bundle: Master the Art of Invisibility Rating: 0 out of 5 stars0 ratingsChromebook For Dummies Rating: 5 out of 5 stars5/5Amazon Web Services (AWS) Interview Questions and Answers Rating: 5 out of 5 stars5/5Raspberry Pi Cookbook for Python Programmers Rating: 0 out of 5 stars0 ratingsBuild Your Own PC Do-It-Yourself For Dummies Rating: 4 out of 5 stars4/5M2 Mac Book Air User Guide: Features, Tips, and Tricks With Pictures Rating: 0 out of 5 stars0 ratingsiPhone X Hacks, Tips and Tricks: Discover 101 Awesome Tips and Tricks for iPhone XS, XS Max and iPhone X Rating: 3 out of 5 stars3/5Linux All-In-One For Dummies Rating: 2 out of 5 stars2/5Building a Home Security System with Raspberry Pi Rating: 0 out of 5 stars0 ratingsWindows 11 For Seniors For Dummies Rating: 0 out of 5 stars0 ratingsiMac For Dummies Rating: 0 out of 5 stars0 ratings
Reviews for Mastering ROS for Robotics Programming
2 ratings0 reviews
Book preview
Mastering ROS for Robotics Programming - Lentin Joseph
Table of Contents
Mastering ROS for Robotics Programming
Credits
About the Author
About the Reviewers
www.PacktPub.com
Support files, eBooks, discount offers, and more
Why subscribe?
Free access for Packt account holders
Preface
What this book covers
What you need for this book
Who this book is for
Conventions
Reader feedback
Customer support
Downloading the example code
Downloading the color images of this book
Errata
Piracy
Questions
1. Introduction to ROS and Its Package Management
Why should we learn ROS?
Why we prefer ROS for robots
Why some do not prefer ROS for robots
Understanding the ROS file system level
ROS packages
ROS meta packages
ROS messages
The ROS services
Understanding the ROS computation graph level
Understanding ROS nodes
ROS messages
ROS topics
ROS services
ROS bags
Understanding ROS Master
Using the ROS parameter
Understanding ROS community level
What are the prerequisites to start with ROS?
Running ROS Master and ROS parameter server
Checking the roscore command output
Creating a ROS package
Working with ROS topics
Creating ROS nodes
Building the nodes
Adding custom msg and srv files
Working with ROS services
Working with ROS actionlib
Creating the ROS action server
Creating the ROS action client
Building the ROS action server and client
Creating launch files
Applications of topics, services, and actionlib
Maintaining the ROS package
Releasing your ROS package
Preparing the ROS package for the release
Releasing our package
Creating a Wiki page for your ROS package
Questions
Summary
2. Working with 3D Robot Modeling in ROS
ROS packages for robot modeling
Understanding robot modeling using URDF
Creating the ROS package for the robot description
Creating our first URDF model
Explaining the URDF file
Visualizing the robot 3D model in RViz
Interacting with pan and tilt joints
Adding physical and collision properties to a URDF model
Understanding robot modeling using xacro
Using properties
Using the math expression
Using macros
Conversion of xacro to URDF
Creating the robot description for a seven DOF robot manipulator
Arm specification
Type of joints
Explaining the xacro model of seven DOF arm
Using constants
Using macros
Including other xacro files
Using meshes in the link
Working with the robot gripper
Viewing the seven DOF arm in RViz
Understanding joint state publisher
Understanding the robot state publisher
Creating a robot model for the differential drive mobile robot
Questions
Summary
3. Simulating Robots Using ROS and Gazebo
Simulating the robotic arm using Gazebo and ROS
The Robotic arm simulation model for Gazebo
Adding colors and textures to the Gazebo robot model
Adding transmission tags to actuate the model
Adding the gazebo_ros_control plugin
Adding a 3D vision sensor to Gazebo
Simulating the robotic arm with Xtion Pro
Visualizing the 3D sensor data
Moving robot joints using ROS controllers in Gazebo
Understanding the ros_control packages
Different types of ROS controllers and hardware interfaces
How the ROS controller interacts with Gazebo
Interfacing joint state controllers and joint position controllers to the arm
Launching the ROS controllers with Gazebo
Moving the robot joints
Simulating a differential wheeled robot in Gazebo
Adding the laser scanner to Gazebo
Moving the mobile robot in Gazebo
Adding joint state publishers in the launch file
Adding the ROS teleop node
Questions
Summary
4. Using the ROS MoveIt! and Navigation Stack
Installing MoveIt!
MoveIt! architecture
The move_group node
Motion planning using MoveIt!
Motion planning request adapters
MoveIt! planning scene
MoveIt! kinematics handling
MoveIt! collision checking
Generating MoveIt! configuration package using Setup Assistant tool
Step 1 – Launching the Setup Assistant tool
Step 2 – Generating the Self-Collision matrix
Step 3 – Adding virtual joints
Step 4 – Adding planning groups
Step 5 – Adding the robot poses
Step 6 – Setup the robot end effector
Step 7 – Adding passive joints
Step 8 – Generating configuration files
Motion planning of robot in RViz using MoveIt! configuration package
Using the RViz MotionPlanning plugin
Interfacing the MoveIt! configuration package to Gazebo
Step 1 – Writing the controller configuration file for MoveIt!
Step 2 – Creating the controller launch files
Step 3 – Creating the controller configuration file for Gazebo
Step 4 – Creating the launch file for Gazebo trajectory controllers
Step 5 – Debugging the Gazebo- MoveIt! interface
Understanding ROS Navigation stack
ROS Navigation hardware requirements
Working with Navigation packages
Understanding the move_base node
Working of Navigation stack
Localizing on the map
Sending a goal and path planning
Collision recovery behavior
Sending the command velocity
Installing ROS Navigation stack
Building a map using SLAM
Creating a launch file for gmapping
Running SLAM on the differential drive robot
Implementing autonomous navigation using AMCL and a static map
Creating an AMCL launch file
Questions
Summary
5. Working with Pluginlib, Nodelets, and Gazebo Plugins
Understanding pluginlib
Creating plugins for the calculator application using pluginlib
Working with pluginlib_calculator package
Step 1 – Creating calculator_base header file
Step 2 – Creating calculator_plugins header file
Step 3 – Exporting plugins using calculator_plugins.cpp
Step 4 – Implementing plugin loader using calculator_loader.cpp
Step 5 – Creating plugin description file: calculator_plugins.xml
Step 6 – Registering plugin with the ROS package system
Step 7 – Editing the CMakeLists.txt file
Step 8: Querying the list of plugins in a package
Step 9 – Running the plugin loader
Understanding ROS nodelets
Creating a nodelet
Step 1 – Creating a package for nodelet
Step 2 – Creating hello_world.cpp nodelet
Step 3 – Explanation of hello_world.cpp
Step 4 – Creating plugin description file
Step 5 – Adding the export tag in package.xml
Step 6 – Editing CMakeLists.txt
Step 7 – Building and running nodelets
Step 8 – Creating launch files for nodelets
Understanding the Gazebo plugins
Creating a basic world plugin
Questions
Summary
6. Writing ROS Controllers and Visualization Plugins
Understanding pr2_mechanism packages
pr2_controller_interface package
Initialization of the controller
Starting the ROS controller
Updating ROS controller
Stopping the controller
pr2_controller_manager
Writing a basic real-time joint controller in ROS
Step 1 – Creating controller package
Step 2 – Creating controller header file
Step 3 – Creating controller source file
Step 4 – Explanation of the controller source file
Step 5 – Creating plugin description file
Step 6 – Updating package.xml
Step 7 – Updating CMakeLists.txt
Step 8 – Building controller
Step 9 – Writing controller configuration file
Step 10 – Writing launch file for the controller
Step 11 – Running controller along with PR2 simulation in Gazebo
Understanding ros_control packages
Understanding ROS visualization tool (RViz) and its plugins
Displays panel
RViz toolbar
Views
Time panel
Dockable panels
Writing a RViz plugin for teleoperation
Methodology of building RViz plugin
Step 1 – Creating RViz plugin package
Step 2 – Creating RViz plugin header file
Step 3 – Creating RViz plugin definition
Step 4 – Creating plugin description file
Step 5 – Adding export tags in package.xml
Step 6 – Editing CMakeLists.txt
Step 7 – Building and loading plugins
Questions
Summary
7. Interfacing I/O Boards, Sensors, and Actuators to ROS
Understanding the Arduino–ROS interface
What is the Arduino–ROS interface?
Understanding the rosserial package in ROS
Installing rosserial packages on Ubuntu 14.04/15.04
Understanding ROS node APIs in Arduino
ROS – Arduino Publisher and Subscriber example
Arduino-ROS, example – blink LED and push button
Arduino-ROS, example – Accelerometer ADXL 335
Arduino-ROS, example – ultrasonic distance sensor
Equations to find distance using the ultrasonic range sensor
Arduino-ROS, example – Odometry Publisher
Interfacing Non-Arduino boards to ROS
Setting ROS on Odroid–C1 and Raspberry Pi 2
How to install an OS image to Odroid-C1 and Raspberry Pi 2
Installation in Windows
Installation in Linux
Connecting to Odroid-C1 and Raspberry Pi 2 from a PC
Configuring an Ethernet hotspot for Odroid-C1 and Raspberry Pi 2
Installing Wiring Pi on Odroid-C1
Installing Wiring Pi on Raspberry Pi 2
Blinking LED using ROS on Odroid-C1 and Raspberry Pi 2
Push button + blink LED using ROS on Odroid-C1 and Raspberry Pi 2
Running LED blink in Odroid-C1
Running button handling and LED blink in Odroid-C1
Running LED blink in Raspberry Pi 2
Interfacing Dynamixel actuators to ROS
Questions
Summary
8. Programming Vision Sensors using ROS, Open-CV, and PCL
Understanding ROS – OpenCV interfacing packages
Understanding ROS – PCL interfacing packages
Installing ROS perception
Interfacing USB webcams in ROS
Working with ROS camera calibration
Converting images between ROS and OpenCV using cv_bridge
Image processing using ROS and OpenCV
Step 1: Creating ROS package for the experiment
Step 2: Creating source files
Step 3: Explanation of the code
Publishing and subscribing images using image_transport
Converting OpenCV-ROS images using cv_bridge
Finding edges on the image
Visualizing raw and edge detected image
Step 4: Editing the CMakeLists.txt file
Step 5: Building and running example
Interfacing Kinect and Asus Xtion Pro in ROS
Interfacing Intel Real Sense camera with ROS
Working with point cloud to laser scan package
Interfacing Hokuyo Laser in ROS
Interfacing Velodyne LIDAR in ROS
Working with point cloud data
How to publish a point cloud
How to subscribe and process the point cloud
Writing a point cloud data to a PCD file
Read and publish point cloud from a PCD file
Streaming webcam from Odroid using ROS
Questions
Summary
9. Building and Interfacing Differential Drive Mobile Robot Hardware in ROS
Introduction to Chefbot- a DIY mobile robot and its hardware configuration
Flashing Chefbot firmware using Energia IDE
Serial data sending protocol from LaunchPad to PC
Serial data sending protocol from PC to Launchpad
Discussing Chefbot interface packages on ROS
Computing odometry from encoder ticks
Computing motor velocities from ROS twist message
Running robot stand alone launch file using C++ nodes
Configuring the Navigation stack for Chefbot
Configuring the gmapping node
Configuring the Navigation stack packages
Common configuration (local_costmap) and (global_costmap)
Configuring global costmap parameters
Configuring local costmap parameters
Configuring base local planner parameters
Configuring DWA local planner parameters
Configuring move_base node parameters
Understanding AMCL
Understanding RViz for working with the Navigation stack
2D Pose Estimate button
Visualizing the particle cloud
The 2D Nav Goal button
Displaying the static map
Displaying the robot footprint
Displaying the global and local cost map
Displaying the global plan, local plan, and planner plan
The current goal
Obstacle avoidance using the Navigation stack
Working with Chefbot simulation
Building a room in Gazebo
Adding model files to the Gazebo model folder
Sending a goal to the Navigation stack from a ROS node
Questions
Summary
10. Exploring the Advanced Capabilities of ROS-MoveIt!
Motion planning using the move_group C++ interface
Motion planning a random path using MoveIt! C++ APIs
Motion planning a custom path using MoveIt! C++ APIs
Collision checking in robot arm using MoveIt!
Adding a collision object in MoveIt!
Removing a collision object from the planning scene
Checking self collision using MoveIt! APIs
Working with perception using MoveIt! and Gazebo
Grasping using MoveIt!
Working with robot pick and place task using MoveIt!
Creating Grasp Table and Grasp Object in MoveIt!
Pick and place action in Gazebo and real Robot
Understanding Dynamixel ROS Servo controllers for robot hardware interfacing
The Dynamixel Servos
Dynamixel-ROS interface
Interfacing seven DOF Dynamixel based robotic arm to ROS MoveIt!
Creating a controller package for COOL arm robot
MoveIt! configuration of the COOL Arm
Questions
Summary
11. ROS for Industrial Robots
Understanding ROS-Industrial packages
Goals of ROS-Industrial
ROS-Industrial – a brief history
Benefits of ROS-Industrial
Installing ROS-Industrial packages
Block diagram of ROS-Industrial packages
Creating URDF for an industrial robot
Creating MoveIt! configuration for an industrial robot
Updating the MoveIt! configuration files
Testing the MoveIt! configuration
Installing ROS-Industrial packages of universal robotic arm
Installing the ROS interface of universal robots
Understanding the Moveit! configuration of a universal robotic arm
Working with MoveIt! configuration of ABB robots
Understanding the ROS-Industrial robot support packages
Visualizing the ABB robot model in RViz
ROS-Industrial robot client package
Designing industrial robot client nodes
ROS-Industrial robot driver package
Understanding MoveIt! IKFast plugin
Creating the MoveIt! IKFast plugin for the ABB-IRB6640 robot
Prerequisites for developing the MoveIt! IKFast plugin
OpenRave and IK Fast Module
MoveIt! IK Fast
Installing MoveIt! IKFast package
Installing OpenRave on Ubuntu 14.04.3
Creating the COLLADA file of a robot to work with OpenRave
Generating the IKFast CPP file for the IRB 6640 robot
Creating the MoveIt! IKFast plugin
Questions
Summary
12. Troubleshooting and Best Practices in ROS
Setting up Eclipse IDE on Ubuntu 14.04.3
Setting ROS development environment in Eclipse IDE
Global settings in Eclipse IDE
ROS compile script for Eclipse IDE
Adding ROS Catkin package to Eclipse
Adding run configurations to run ROS nodes in Eclipse
Best practices in ROS
ROS C++ coding style guide
Standard naming conventions used in ROS
Code license agreement
ROS code formatting
ROS code documentation
Console output
Best practices in the ROS package
Important troubleshooting tips in ROS
Usage of roswtf
Questions
Summary
Index
Mastering ROS for Robotics Programming
Mastering ROS for Robotics Programming
Copyright © 2015 Packt Publishing
All rights reserved. No part of this book may be reproduced, stored in a retrieval system, or transmitted in any form or by any means, without the prior written permission of the publisher, except in the case of brief quotations embedded in critical articles or reviews.
Every effort has been made in the preparation of this book to ensure the accuracy of the information presented. However, the information contained in this book is sold without warranty, either express or implied. Neither the author, nor Packt Publishing, and its dealers and distributors will be held liable for any damages caused or alleged to be caused directly or indirectly by this book.
Packt Publishing has endeavored to provide trademark information about all of the companies and products mentioned in this book by the appropriate use of capitals. However, Packt Publishing cannot guarantee the accuracy of this information.
First published: December 2015
Production reference: 1141215
Published by Packt Publishing Ltd.
Livery Place
35 Livery Street
Birmingham B3 2PB, UK.
ISBN 978-1-78355-179-8
www.packtpub.com
Credits
Author
Lentin Joseph
Reviewers
Jonathan Cacace
Ruixiang Du
Acquisition Editor
Vivek Anantharaman
Content Development Editor
Athira Laji
Technical Editor
Ryan Kochery
Copy Editor
Merilyn Pereira
Alpha Singh
Project Coordinator
Harshal Ved
Proofreader
Safis Editing
Indexer
Tejal Daruwale Soni
Production Coordinator
Melwyn D'sa
Cover Work
Melwyn D'sa
About the Author
Lentin Joseph is an author, entrepreneur, electronics engineer, robotics enthusiast, machine vision expert, embedded programmer, and the founder and CEO of Qbotics Labs (http://www.qboticslabs.com) from India. He completed his bachelor's degree in electronics and communication engineering at the Federal Institute of Science and Technology (FISAT), Kerala. For his final year engineering project, he made a social robot that can interact with people. The project was a huge success and was mentioned in many forms of visual and print media. The main features of this robot were that it can communicate with people and reply intelligently and has some image processing capabilities such as face, motion, and color detection. The entire project was implemented using the Python programming language. His interest in robotics, image processing, and Python started with that project.
After his graduation, for 3 years he worked in a start-up company focusing on robotics and image processing. In the meantime, he learned famous robotic software platforms such as Robot Operating System (ROS), V-REP, Actin (a robotic simulation tool), and image processing libraries such as OpenCV, OpenNI, and PCL. He also knows robot 3D designing and embedded programming on Arduino and Tiva Launchpad.
After 3 years of work experience, he started a new company called Qbotics Labs, which mainly focuses on research to build up some great products in domains such as robotics and machine vision. He maintains a personal website (http://www.lentinjoseph.com) and a technology blog called technolabsz (http://www.technolabsz.com). He publishes his works on his tech blog. He was also a speaker at PyCon2013, India, on the topic Learning Robotics using Python.
Lentin is the author of the book Learning Robotics Using Python (refer to http://learn-robotics.com to know more) by Packt Publishing. The book was about building an autonomous mobile robot using ROS and OpenCV. The book was launched in ICRA 2015 and was featured in the ROS blog, Robohub, OpenCV, the Python website, and various other such forums.
Lentin was a finalist in the ICRA 2015 challenge, HRATC (http://www2.isr.uc.pt/~embedded/events/HRATC2015/Welcome.html).
I dedicate this book to my parents because they gave me the inspiration to write this book. I also convey my regards to my friends who helped and inspired me to write this book.
About the Reviewers
Jonathan Cacace was born in Naples, Italy, on December 13, 1987. He received has a bachelor's and master's degree in computer science from the University of Naples Federico II. Currently, he is attending a PhD Scholar Course in Information and Automation Engineering at the Department of Electrical Engineering and Information Technology (DIETI) in the same institution. His research is focused on autonomous action planning and execution by mobile robots, high-level and low-level control of UAV platforms, and human-robot interaction with humanoid robots in service task execution. He is the author and coauthor of several scientific publications in the robotics field, published at international conferences and scientific journals.
Jonathan is a member of the PRISMA Laboratory (http://prisma.dieti.unina.it/) of the University of Naples Federico II. With his research group, he is involved in different EU-funded collaborative research projects focused on several topics, such as the use of unmanned aerial vehicles for search and rescue operations or service task execution (http://www.sherpa-project.eu/sherpa/ and http://www.arcas-project.eu/) and the dynamic manipulation of elastic objects using humanoid robotic platforms (http://www.rodyman.eu/).
Ruixiang Du is currently a PhD student studying Robotics at Worcester Polytechnic Institute (WPI). He received his bachelor's degree in Automation from North China Electric Power University in 2011 and a master's degree in Robotics Engineering from WPI in 2013.
Ruixiang has worked on various robotic projects with robot platforms ranging from medical robots, UAV/UGV, to humanoid robots. He was an active member of Team WPI-CMU for the DARPA Robotics Challenge.
Ruixiang has general interests in robotics and in real-time and embedded systems. His research focus is on the control and motion planning of mobile robots in cluttered and dynamic environments.
www.PacktPub.com
Support files, eBooks, discount offers, and more
For support files and downloads related to your book, please visit www.PacktPub.com.
Did you know that Packt offers eBook versions of every book published, with PDF and ePub files available? You can upgrade to the eBook version at www.PacktPub.com and as a print book customer, you are entitled to a discount on the eBook copy. Get in touch with us at
At www.PacktPub.com, you can also read a collection of free technical articles, sign up for a range of free newsletters and receive exclusive discounts and offers on Packt books and eBooks.
https://www2.packtpub.com/books/subscription/packtlib
Do you need instant solutions to your IT questions? PacktLib is Packt's online digital book library. Here, you can search, access, and read Packt's entire library of books.
Why subscribe?
Fully searchable across every book published by Packt
Copy and paste, print, and bookmark content
On demand and accessible via a web browser
Free access for Packt account holders
If you have an account with Packt at www.PacktPub.com, you can use this to access PacktLib today and view 9 entirely free books. Simply use your login credentials for immediate access.
Preface
Mastering ROS for Robotics Programming is an advanced guide of ROS that is very suitable for readers who already have a basic knowledge in ROS. ROS is widely used in robotics companies, universities, and robotics research institutes for designing, building, and simulating a robot model and interfacing it into real hardware. ROS is now an essential requirement for Robotic engineers; this guide can help you acquire knowledge of ROS and can also help you polish your skills in ROS using interactive examples. Even though it is an advanced guide, you can see the basics of ROS in the first chapter to refresh the concepts. It also helps ROS beginners. The book mainly focuses on the advanced concepts of ROS, such as ROS Navigation stack, ROS MoveIt!, ROS plugins, nodelets, controllers, ROS Industrial, and so on.
You can work with the examples in the book without any special hardware; however, in some sections you can see the interfacing of I/O boards, vision sensors, and actuators to ROS. To work with this hardware, you will need to buy it.
The book starts with an introduction to ROS and then discusses how to build a robot model in ROS for simulating and visualizing. After the simulation of robots using Gazebo, we can see how to connect the robot to Navigation stack and MoveIt!. In addition to this, we can see ROS plugins, controllers, nodelets, and interfacing of I/O boards and vision sensors. Finally, we can see more about ROS Industrial and troubleshooting and best practices in ROS.
What this book covers
Chapter 1, Introduction to ROS and Its Package Management, gives you an understanding of the core underlying concepts of ROS and how to work with ROS packages.
Chapter 2, Working with 3D Robot Modeling in ROS, discusses the design of two robots; one is a seven-DOF (Degree of Freedom) manipulator and the other is a differential drive robot.
Chapter 3, Simulating Robots Using ROS and Gazebo, discusses the simulation of seven-DOF arms, differential wheeled robots, and ROS controllers that help control robot joints in Gazebo.
Chapter 4, Using the ROS MoveIt! and Navigation Stack, interfaces out-of-the-box functionalities such as robot manipulation and autonomous navigation using ROS MoveIt! and Navigation stack.
Chapter 5, 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 6, 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 can also see how to create plugin for RViz.
Chapter 7, Interfacing I/O Boards, Sensors, 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-C1, with ROS.
Chapter 8, Programming 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 (Open-CV) and Point Cloud Library (PCL).
Chapter 9, 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 at giving you an idea of building a custom mobile robot and interfacing it with ROS.
Chapter 10, 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 the interfacing of a robotic manipulator hardware with MoveIt!
Chapter 11, 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 12, 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.
What you need for this book
You should have a good PC running Linux distribution, preferably Ubuntu 14.04.3 or Ubuntu 15.04.
Readers can use a laptop or PC with a graphics card, and a RAM of 4 GB to 8 GB is preferred. This is actually for running high-end simulation in Gazebo and also for processing Point cloud and for computer vision.
The readers should have sensors, actuators, and the I/O board mentioned in the book and should have the provision to connect them all to their PC.
The readers also need a Git tool installed to clone the packages files.
If you are a Windows user, then it will be good to download Virtual box and set up Ubuntu in that. Working with Virtual box can have issues when we try to interface real hardware with ROS, so it would be good if you could work with the real system itself.
Who this book is for
If you are a robotics enthusiast or a researcher who wants to learn more about building robot applications using ROS, this book is for you. In order to learn from this book, you should have a basic knowledge of ROS, GNU/Linux, and C++ programming concepts. The book will also be good for programmers who want to explore the advanced features of ROS.
Conventions
In this book, you will find a number of text styles that distinguish between different kinds of information. Here are some examples of these styles and an explanation of their meaning.
Code words in text, database table names, folder names, filenames, file extensions, pathnames, dummy URLs, user input, and Twitter handles are shown as follows: Create a folder called launch and inside this folder create the following launch file called start_laser.launch.
A block of code is set as follows:
#include
#include
#include
When we wish to draw your attention to a particular part of a code block, the relevant lines or items are set in bold:
robot_model_loader::RobotModelLoader robot_model_loader(robot_description
);
robot_model::RobotModelPtr
kinematic_model =
robot_model_loader.getModel();
planning_scene::PlanningScene planning_scene(kinematic_model);
Any command-line input or output is written as follows:
$ sudo apt-get update $ sudo apt-get install ros-indigo-perception
New terms and important words are shown in bold. Words that you see on the screen, for example, in menus or dialog boxes, appear in the text like this: Click on camera | driver and tickColor Transformer.
Note
Warnings or important notes appear in a box like this.
Tip
Tips and tricks appear like this.
Reader feedback
Feedback from our readers is always welcome. Let us know what you think about this book—what you liked or disliked. Reader feedback is important for us as it helps us develop titles that you will really get the most out of.
To send us general feedback, simply e-mail <feedback@packtpub.com> or
If there is a topic that you have expertise in and you are interested in either writing or contributing to a book, see our author guide at www.packtpub.com/authors.
Customer support
Now that you are the proud owner of a Packt book, we have a number of things to help you to get the most from your purchase.
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 chapter codes from https://github.com/qboticslabs/mastering_ros.git.
Downloading the color images of this book
We also provide you with a PDF file that has color images of the screenshots/diagrams used in this book. The color images will help you better understand the changes in the output. You can download this file from https://www.packtpub.com/sites/default/files/downloads/B04782_ColoredImages.pdf.
Errata
Although we have taken every care to ensure the accuracy of our content, mistakes do happen. If you find a mistake in one of our books—maybe a mistake in the text or the code—we would be grateful if you could report this to us. By doing so, you can save other readers from frustration and help us improve subsequent versions of this book. If you find any errata, please report them by visiting http://www.packtpub.com/submit-errata, selecting your book, clicking on the Errata Submission Form link, and entering the details of your errata. Once your errata are verified, your submission will be accepted and the errata will be uploaded to our website or added to any list of existing errata under the Errata section of that title.
To view the previously submitted errata, go to https://www.packtpub.com/books/content/support and enter the name of the book in the search field. The required information will appear under the Errata section.
Piracy
Piracy of copyrighted material on the Internet is an ongoing problem across all media. At Packt, we take the protection of our copyright and licenses very seriously. If you come across any illegal copies of our works in any form on the Internet, please provide us with the location address or website name immediately so that we can pursue a remedy.
Please contact us at <copyright@packtpub.com> with a link to the suspected pirated material.
We appreciate your help in protecting our authors and our ability to bring you valuable content.
Questions
If you have a problem with any aspect of this book, you can contact us at <questions@packtpub.com>, and we will do our best to address the problem.
Chapter 1. Introduction to ROS and Its Package Management
This is an introductory chapter that gives you an understanding of the core underlying concepts of ROS and how to work with ROS packages. We will also go through the ROS concepts such as ROS master, nodes, parameter server, topic, message, service, and actionlib to refresh your memory of the concepts you already know.
The basic building blocks of the ROS software framework are ROS packages. We will see how to create, build, and maintain a ROS package. We will also see how to create a wiki page for our package on the ROS website to contribute to the ROS community.
In this chapter, we will cover the following topics:
Why should we learn ROS?
Why we prefer ROS for robot
Why we do not prefer ROS for robot
Understanding the ROS file system level
Understanding the ROS computation graph level
Understanding ROS nodes, messages, topics, services, bags
Understanding ROS Master
Using ROS