ebook img

Mastering ROS for Robotics Programming - Second Edition: Design, build, and simulate complex robots using the Robot Operating System PDF

570 Pages·2018·43.368 MB·English
Save to my drive
Quick download
Download
Most books are stored in the elastic cloud where traffic is expensive. For this reason, we have a limit on daily download.

Preview Mastering ROS for Robotics Programming - Second Edition: Design, build, and simulate complex robots using the Robot Operating System

Mastering ROS for Robotics Programming Second Edition Design, build, and simulate complex robots using the Robot Operating System Lentin Joseph Jonathan Cacace BIRMINGHAM - MUMBAI Mastering ROS for Robotics Programming Second Edition Copyright © 2018 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 or its dealers and distributors, will be held liable for any damages caused or alleged to have been 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. Commissioning Editor: Vijin Boricha Acquisition Editor: Divya Poojari Content Development Editor: Eisha Dsouza Technical Editor: Naveenkumar Jain Copy Editor: Safis Editing Project Coordinator: Kinjal Bari Proofreader: Safis Editing Indexer: Pratik Shirodkar Graphics: Jisha Chirayil Production Coordinator: Arvindkumar Gupta First published: December 2015 Second edition: February 2018 Production reference: 1220218 Published by Packt Publishing Ltd. Livery Place 35 Livery Street Birmingham B3 2PB, UK. ISBN 978-1-78847-895-3 www.packtpub.com mapt.io Mapt is an online digital library that gives you full access to over 5,000 books and videos, as well as industry leading tools to help you plan your personal development and advance your career. For more information, please visit our website. Why subscribe? Spend less time learning and more time coding with practical eBooks and Videos from over 4,000 industry professionals Improve your learning with Skill Plans built especially for you Get a free eBook or video every month Mapt is fully searchable Copy and paste, print, and bookmark content 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 [email protected] for more details. 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. Contributors About the authors Lentin Joseph is an author and robotics entrepreneur from India. He runs a robotics software company called Qbotics Labs in India. He has 7 years of experience in the robotics domain especially in Robot Operating System, Open-CV, and PCL. He has authored three books in ROS, namely, Learning Robotics using Python, Mastering ROS for Robotics Programming, and ROS Robotics Projects. He is currently pursuing his masters in Robotics from India and is also doing research in Robotics Institute, CMU, USA. Jonathan Cacace was born in Naples, Italy, on December 13, 1987. He received his Master’s degree in computer science, and a Ph.D. degree in Information and Automation Engineering, from the University of Naples Federico II. Currently, he is a postdoc at the PRISMA Lab of the University of Naples Federico II. He is involved in different research projects focused on industrial and service robotics in which he has developed several ROS-based applications integrating robot perception and control. I would like to express my thanks and gratitude to my friends, my parents and all the people I met during my life who contributed to enrich my life and my knowledge. About the reviewer Ruixiang Du is a PhD candidate in Mechanical Engineering at Worcester Polytechnic Institute (WPI). He currently works in the Autonomy, Control and Estimation Laboratory with a research focus on the motion planning and control of autonomous mobile robots. He received a 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 general interests in robotics and in real-time and embedded systems. He has worked on various robotic projects with robot platforms ranging from medical robots, unmanned aerial/ground vehicles, to humanoid robots. He was a member of Team WPI- CMU for the DARPA Robotics Challenge. Packt is searching for authors like you If you're interested in becoming an author for Packt, please visit authors.packtpub.com and apply today. We have worked with thousands of developers and tech professionals, just like you, to help them share their insight with the global tech community. You can make a general application, apply for a specific hot topic that we are recruiting an author for, or submit your own idea. Table of Contents Preface 1 Chapter 1: Introduction to ROS 7 Why should we learn ROS? 7 Why we prefer ROS for robots 8 Why some do not prefer ROS for robots 10 Understanding the ROS filesystem level 11 ROS packages 13 ROS metapackages 15 ROS messages 16 The ROS services 18 Understanding the ROS computation graph level 19 ROS nodes 21 ROS messages 22 ROS topics 23 ROS services 24 ROS bags 25 The ROS Master 26 Using the ROS parameter 28 ROS community level 29 What are the prerequisites for starting with ROS? 30 Running the ROS Master and the ROS parameter server 30 Checking the roscore command output 32 Questions 33 Summary 34 Chapter 2: Getting Started with ROS Programming 35 Creating a ROS package 35 Working with ROS topics 38 Creating ROS nodes 38 Building the nodes 41 Adding custom msg and srv files 44 Table of Contents Working with ROS services 47 Working with ROS actionlib 52 Creating the ROS action server 53 Creating the ROS action client 55 Building the ROS action server and client 56 Creating launch files 59 Applications of topics, services, and actionlib 62 Maintaining the ROS package 62 Releasing your ROS package 63 Preparing the ROS package for the release 64 Releasing our package 64 Creating a Wiki page for your ROS package 67 Questions 70 Summary 71 Chapter 3: Working with 3D Robot Modeling in ROS 72 ROS packages for robot modeling 73 Understanding robot modeling using URDF 74 Creating the ROS package for the robot description 78 Creating our first URDF model 78 Explaining the URDF file 81 Visualizing the 3D robot model in RViz 83 Interacting with pan-and-tilt joints 84 Adding physical and collision properties to a URDF model 85 Understanding robot modeling using xacro 86 Using properties 87 Using the math expression 87 Using macros 87 Converting xacro to URDF 88 Creating the robot description for a seven DOF robot manipulator 89 Arm specification 90 Type of joints 90 Explaining the xacro model of the seven DOF arm 91 Using constants 91 Using macros 91 [ ii ] Table of Contents Including other xacro files 92 Using meshes in the link 93 Working with the robot gripper 93 Viewing the seven DOF arm in RViz 94 Understanding joint state publisher 96 Understanding robot state publisher 96 Creating a robot model for the differential drive mobile robot 98 Questions 103 Summary 103 Chapter 4: Simulating Robots Using ROS and Gazebo 104 Simulating the robotic arm using Gazebo and ROS 105 Creating the robotic arm simulation model for Gazebo 106 Adding colors and textures to the Gazebo robot model 109 Adding transmission tags to actuate the model 109 Adding the gazebo_ros_control plugin 110 Adding a 3D vision sensor to Gazebo 110 Simulating the robotic arm with Xtion Pro 112 Visualizing the 3D sensor data 113 Moving robot joints using ROS controllers in Gazebo 115 Understanding the ros_control packages 116 Different types of ROS controllers and hardware interfaces 116 How the ROS controller interacts with Gazebo 117 Interfacing joint state controllers and joint position controllers to the arm 119 Launching the ROS controllers with Gazebo 120 Moving the robot joints 122 Simulating a differential wheeled robot in Gazebo 123 Adding the laser scanner to Gazebo 125 Moving the mobile robot in Gazebo 126 Adding joint state publishers in the launch file 128 Adding the ROS teleop node 128 Questions 130 Summary 131 Chapter 5: Simulating Robots Using ROS and V-REP 132 Setting up V-REP with ROS 133 Understanding the vrep_plugin 137 [ iii ] Table of Contents Interacting with V-REP using ROS services 139 Interacting with V-REP using ROS topics 141 Simulating the robotic arm using V-REP and ROS 146 Adding the ROS interface to V-REP joint controllers 149 Simulating a differential wheeled robot in V-REP 153 Adding a laser sensor to V-REP 156 Adding a 3D vision sensor to V-REP 159 Questions 161 Summary 161 Chapter 6: Using the ROS MoveIt! and Navigation Stack 162 Installing MoveIt! 163 MoveIt! architecture 163 The move_group node 164 Motion planning using MoveIt! 166 Motion planning request adapters 168 MoveIt! planning scene 168 MoveIt! kinematics handling 169 MoveIt! collision checking 170 Generating MoveIt! configuration package using the Setup Assistant tool 171 Step 1 – Launching the Setup Assistant tool 171 Step 2 – Generating the Self-Collision matrix 173 Step 3 – Adding virtual joints 174 Step 4 – Adding planning groups 175 Step 5 – Adding the robot poses 176 Step 6 – Setting up the robot end effector 177 Step 7 – Adding passive joints 178 Step 8 – Author information 178 Step 9 – Generating configuration files 178 Motion planning of robot in RViz using MoveIt! configuration package 180 Using the RViz Motion Planning plugin 181 Interfacing the MoveIt! configuration package to Gazebo 184 Step 1 – Writing the controller configuration file for MoveIt! 185 Step 2 – Creating the controller launch files 186 Step 3 – Creating the controller configuration file for Gazebo 186 [ iv ]

See more

The list of books you might like

Most books are stored in the elastic cloud where traffic is expensive. For this reason, we have a limit on daily download.