Mastering ROS for Robotics Programming

Book description

Design, build and simulate complex robots using Robot Operating System and master its out-of-the-box functionalities

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.

Publisher resources

Download Example Code

Table of contents

  1. Mastering ROS for Robotics Programming
    1. Table of Contents
    2. Mastering ROS for Robotics Programming
    3. Credits
    4. About the Author
    5. About the Reviewers
      1. Support files, eBooks, discount offers, and more
        1. Why subscribe?
        2. Free access for Packt account holders
    7. Preface
      1. What this book covers
      2. What you need for this book
      3. Who this book is for
      4. Conventions
      5. Reader feedback
      6. Customer support
        1. Downloading the example code
        2. Downloading the color images of this book
        3. Errata
        4. Piracy
        5. Questions
    8. 1. Introduction to ROS and Its Package Management
      1. Why should we learn ROS?
      2. Why we prefer ROS for robots
      3. Why some do not prefer ROS for robots
      4. Understanding the ROS file system level
        1. ROS packages
        2. ROS meta packages
        3. ROS messages
        4. The ROS services
      5. Understanding the ROS computation graph level
        1. Understanding ROS nodes
        2. ROS messages
        3. ROS topics
        4. ROS services
        5. ROS bags
        6. Understanding ROS Master
        7. Using the ROS parameter
      6. Understanding ROS community level
        1. What are the prerequisites to start with ROS?
        2. Running ROS Master and ROS parameter server
          1. Checking the roscore command output
        3. Creating a ROS package
          1. Working with ROS topics
          2. Creating ROS nodes
          3. Building the nodes
        4. Adding custom msg and srv files
        5. Working with ROS services
          1. Working with ROS actionlib
            1. Creating the ROS action server
            2. Creating the ROS action client
          2. Building the ROS action server and client
        6. Creating launch files
        7. Applications of topics, services, and actionlib
        8. Maintaining the ROS package
        9. Releasing your ROS package
          1. Preparing the ROS package for the release
          2. Releasing our package
          3. Creating a Wiki page for your ROS package
      7. Questions
      8. Summary
    9. 2. Working with 3D Robot Modeling in ROS
      1. ROS packages for robot modeling
      2. Understanding robot modeling using URDF
      3. Creating the ROS package for the robot description
      4. Creating our first URDF model
      5. Explaining the URDF file
      6. Visualizing the robot 3D model in RViz
        1. Interacting with pan and tilt joints
      7. Adding physical and collision properties to a URDF model
      8. Understanding robot modeling using xacro
        1. Using properties
        2. Using the math expression
        3. Using macros
      9. Conversion of xacro to URDF
      10. Creating the robot description for a seven DOF robot manipulator
        1. Arm specification
          1. Type of joints
      11. Explaining the xacro model of seven DOF arm
        1. Using constants
        2. Using macros
        3. Including other xacro files
        4. Using meshes in the link
        5. Working with the robot gripper
        6. Viewing the seven DOF arm in RViz
          1. Understanding joint state publisher
          2. Understanding the robot state publisher
      12. Creating a robot model for the differential drive mobile robot
      13. Questions
      14. Summary
    10. 3. Simulating Robots Using ROS and Gazebo
      1. Simulating the robotic arm using Gazebo and ROS
        1. The Robotic arm simulation model for Gazebo
          1. Adding colors and textures to the Gazebo robot model
          2. Adding transmission tags to actuate the model
          3. Adding the gazebo_ros_control plugin
          4. Adding a 3D vision sensor to Gazebo
        2. Simulating the robotic arm with Xtion Pro
          1. Visualizing the 3D sensor data
        3. Moving robot joints using ROS controllers in Gazebo
          1. Understanding the ros_control packages
          2. Different types of ROS controllers and hardware interfaces
          3. How the ROS controller interacts with Gazebo
          4. Interfacing joint state controllers and joint position controllers to the arm
          5. Launching the ROS controllers with Gazebo
          6. Moving the robot joints
        4. Simulating a differential wheeled robot in Gazebo
          1. Adding the laser scanner to Gazebo
          2. Moving the mobile robot in Gazebo
          3. Adding joint state publishers in the launch file
        5. Adding the ROS teleop node
      2. Questions
      3. Summary
    11. 4. Using the ROS MoveIt! and Navigation Stack
      1. Installing MoveIt!
        1. MoveIt! architecture
          1. The move_group node
          2. Motion planning using MoveIt!
          3. Motion planning request adapters
          4. MoveIt! planning scene
          5. MoveIt! kinematics handling
          6. MoveIt! collision checking
      2. Generating MoveIt! configuration package using Setup Assistant tool
      3. Step 1 – Launching the Setup Assistant tool
        1. Step 2 – Generating the Self-Collision matrix
        2. Step 3 – Adding virtual joints
        3. Step 4 – Adding planning groups
        4. Step 5 – Adding the robot poses
        5. Step 6 – Setup the robot end effector
        6. Step 7 – Adding passive joints
        7. Step 8 – Generating configuration files
      4. Motion planning of robot in RViz using MoveIt! configuration package
        1. Using the RViz MotionPlanning plugin
        2. Interfacing the MoveIt! configuration package to Gazebo
        3. Step 1 – Writing the controller configuration file for MoveIt!
        4. Step 2 – Creating the controller launch files
        5. Step 3 – Creating the controller configuration file for Gazebo
        6. Step 4 – Creating the launch file for Gazebo trajectory controllers
        7. Step 5 – Debugging the Gazebo- MoveIt! interface
      5. Understanding ROS Navigation stack
        1. ROS Navigation hardware requirements
        2. Working with Navigation packages
          1. Understanding the move_base node
          2. Working of Navigation stack
          3. Localizing on the map
          4. Sending a goal and path planning
          5. Collision recovery behavior
          6. Sending the command velocity
        3. Installing ROS Navigation stack
      6. Building a map using SLAM
        1. Creating a launch file for gmapping
        2. Running SLAM on the differential drive robot
        3. Implementing autonomous navigation using AMCL and a static map
        4. Creating an AMCL launch file
      7. Questions
      8. Summary
    12. 5. Working with Pluginlib, Nodelets, and Gazebo Plugins
      1. Understanding pluginlib
        1. Creating plugins for the calculator application using pluginlib
          1. Working with pluginlib_calculator package
            1. Step 1 – Creating calculator_base header file
            2. Step 2 – Creating calculator_plugins header file
            3. Step 3 – Exporting plugins using calculator_plugins.cpp
            4. Step 4 – Implementing plugin loader using calculator_loader.cpp
            5. Step 5 – Creating plugin description file: calculator_plugins.xml
            6. Step 6 – Registering plugin with the ROS package system
            7. Step 7 – Editing the CMakeLists.txt file
            8. Step 8: Querying the list of plugins in a package
            9. Step 9 – Running the plugin loader
        2. Understanding ROS nodelets
        3. Creating a nodelet
          1. Step 1 – Creating a package for nodelet
          2. Step 2 – Creating hello_world.cpp nodelet
          3. Step 3 – Explanation of hello_world.cpp
          4. Step 4 – Creating plugin description file
          5. Step 5 – Adding the export tag in package.xml
          6. Step 6 – Editing CMakeLists.txt
          7. Step 7 – Building and running nodelets
          8. Step 8 – Creating launch files for nodelets
      2. Understanding the Gazebo plugins
        1. Creating a basic world plugin
      3. Questions
      4. Summary
    13. 6. Writing ROS Controllers and Visualization Plugins
      1. Understanding pr2_mechanism packages
        1. pr2_controller_interface package
          1. Initialization of the controller
          2. Starting the ROS controller
          3. Updating ROS controller
          4. Stopping the controller
        2. pr2_controller_manager
      2. Writing a basic real-time joint controller in ROS
        1. Step 1 – Creating controller package
        2. Step 2 – Creating controller header file
        3. Step 3 – Creating controller source file
        4. Step 4 – Explanation of the controller source file
        5. Step 5 – Creating plugin description file
        6. Step 6 – Updating package.xml
        7. Step 7 – Updating CMakeLists.txt
        8. Step 8 – Building controller
        9. Step 9 – Writing controller configuration file
        10. Step 10 – Writing launch file for the controller
        11. Step 11 – Running controller along with PR2 simulation in Gazebo
      3. Understanding ros_control packages
      4. Understanding ROS visualization tool (RViz) and its plugins
        1. Displays panel
        2. RViz toolbar
        4. Time panel
        5. Dockable panels
      5. Writing a RViz plugin for teleoperation
        1. Methodology of building RViz plugin
          1. Step 1 – Creating RViz plugin package
          2. Step 2 – Creating RViz plugin header file
          3. Step 3 – Creating RViz plugin definition
          4. Step 4 – Creating plugin description file
          5. Step 5 – Adding export tags in package.xml
          6. Step 6 – Editing CMakeLists.txt
          7. Step 7 – Building and loading plugins
      6. Questions
      7. Summary
    14. 7. Interfacing I/O Boards, Sensors, and Actuators to ROS
      1. Understanding the Arduino–ROS interface
      2. What is the Arduino–ROS interface?
        1. Understanding the rosserial package in ROS
          1. Installing rosserial packages on Ubuntu 14.04/15.04
            1. Understanding ROS node APIs in Arduino
          2. ROS – Arduino Publisher and Subscriber example
        2. Arduino-ROS, example – blink LED and push button
        3. Arduino-ROS, example – Accelerometer ADXL 335
        4. Arduino-ROS, example – ultrasonic distance sensor
          1. Equations to find distance using the ultrasonic range sensor
        5. Arduino-ROS, example – Odometry Publisher
        6. Interfacing Non-Arduino boards to ROS
        7. Setting ROS on Odroid–C1 and Raspberry Pi 2
        8. How to install an OS image to Odroid-C1 and Raspberry Pi 2
          1. Installation in Windows
          2. Installation in Linux
        9. Connecting to Odroid-C1 and Raspberry Pi 2 from a PC
        10. Configuring an Ethernet hotspot for Odroid-C1 and Raspberry Pi 2
          1. Installing Wiring Pi on Odroid-C1
          2. Installing Wiring Pi on Raspberry Pi 2
        11. Blinking LED using ROS on Odroid-C1 and Raspberry Pi 2
        12. Push button + blink LED using ROS on Odroid-C1 and Raspberry Pi 2
          1. Running LED blink in Odroid-C1
          2. Running button handling and LED blink in Odroid-C1
          3. Running LED blink in Raspberry Pi 2
      3. Interfacing Dynamixel actuators to ROS
      4. Questions
      5. Summary
    15. 8. Programming Vision Sensors using ROS, Open-CV, and PCL
      1. Understanding ROS – OpenCV interfacing packages
      2. Understanding ROS – PCL interfacing packages
        1. Installing ROS perception
      3. Interfacing USB webcams in ROS
      4. Working with ROS camera calibration
        1. Converting images between ROS and OpenCV using cv_bridge
        2. Image processing using ROS and OpenCV
          1. Step 1: Creating ROS package for the experiment
          2. Step 2: Creating source files
          3. Step 3: Explanation of the code
            1. Publishing and subscribing images using image_transport
            2. Converting OpenCV-ROS images using cv_bridge
            3. Finding edges on the image
            4. Visualizing raw and edge detected image
          4. Step 4: Editing the CMakeLists.txt file
          5. Step 5: Building and running example
      5. Interfacing Kinect and Asus Xtion Pro in ROS
      6. Interfacing Intel Real Sense camera with ROS
        1. Working with point cloud to laser scan package
      7. Interfacing Hokuyo Laser in ROS
      8. Interfacing Velodyne LIDAR in ROS
      9. Working with point cloud data
        1. How to publish a point cloud
        2. How to subscribe and process the point cloud
        3. Writing a point cloud data to a PCD file
        4. Read and publish point cloud from a PCD file
      10. Streaming webcam from Odroid using ROS
      11. Questions
      12. Summary
    16. 9. Building and Interfacing Differential Drive Mobile Robot Hardware in ROS
      1. Introduction to Chefbot- a DIY mobile robot and its hardware configuration
        1. Flashing Chefbot firmware using Energia IDE
          1. Serial data sending protocol from LaunchPad to PC
          2. Serial data sending protocol from PC to Launchpad
        2. Discussing Chefbot interface packages on ROS
        3. Computing odometry from encoder ticks
        4. Computing motor velocities from ROS twist message
          1. Running robot stand alone launch file using C++ nodes
        5. Configuring the Navigation stack for Chefbot
        6. Configuring the gmapping node
        7. Configuring the Navigation stack packages
          1. Common configuration (local_costmap) and (global_costmap)
          2. Configuring global costmap parameters
          3. Configuring local costmap parameters
          4. Configuring base local planner parameters
          5. Configuring DWA local planner parameters
          6. Configuring move_base node parameters
        8. Understanding AMCL
        9. Understanding RViz for working with the Navigation stack
          1. 2D Pose Estimate button
          2. Visualizing the particle cloud
          3. The 2D Nav Goal button
          4. Displaying the static map
          5. Displaying the robot footprint
          6. Displaying the global and local cost map
          7. Displaying the global plan, local plan, and planner plan
          8. The current goal
        10. Obstacle avoidance using the Navigation stack
        11. Working with Chefbot simulation
          1. Building a room in Gazebo
          2. Adding model files to the Gazebo model folder
        12. Sending a goal to the Navigation stack from a ROS node
      2. Questions
      3. Summary
    17. 10. Exploring the Advanced Capabilities of ROS-MoveIt!
      1. Motion planning using the move_group C++ interface
        1. Motion planning a random path using MoveIt! C++ APIs
        2. Motion planning a custom path using MoveIt! C++ APIs
      2. Collision checking in robot arm using MoveIt!
        1. Adding a collision object in MoveIt!
        2. Removing a collision object from the planning scene
        3. Checking self collision using MoveIt! APIs
      3. Working with perception using MoveIt! and Gazebo
      4. Grasping using MoveIt!
      5. Working with robot pick and place task using MoveIt!
        1. Creating Grasp Table and Grasp Object in MoveIt!
      6. Pick and place action in Gazebo and real Robot
      7. Understanding Dynamixel ROS Servo controllers for robot hardware interfacing
        1. The Dynamixel Servos
        2. Dynamixel-ROS interface
      8. Interfacing seven DOF Dynamixel based robotic arm to ROS MoveIt!
        1. Creating a controller package for COOL arm robot
        2. MoveIt! configuration of the COOL Arm
      9. Questions
      10. Summary
    18. 11. ROS for Industrial Robots
      1. Understanding ROS-Industrial packages
        1. Goals of ROS-Industrial
        2. ROS-Industrial – a brief history
        3. Benefits of ROS-Industrial
      2. Installing ROS-Industrial packages
      3. Block diagram of ROS-Industrial packages
      4. Creating URDF for an industrial robot
      5. Creating MoveIt! configuration for an industrial robot
        1. Updating the MoveIt! configuration files
        2. Testing the MoveIt! configuration
      6. Installing ROS-Industrial packages of universal robotic arm
        1. Installing the ROS interface of universal robots
      7. Understanding the Moveit! configuration of a universal robotic arm
      8. Working with MoveIt! configuration of ABB robots
      9. Understanding the ROS-Industrial robot support packages
        1. Visualizing the ABB robot model in RViz
      10. ROS-Industrial robot client package
        1. Designing industrial robot client nodes
      11. ROS-Industrial robot driver package
      12. Understanding MoveIt! IKFast plugin
      13. Creating the MoveIt! IKFast plugin for the ABB-IRB6640 robot
        1. Prerequisites for developing the MoveIt! IKFast plugin
        2. OpenRave and IK Fast Module
          1. MoveIt! IK Fast
          2. Installing MoveIt! IKFast package
          3. Installing OpenRave on Ubuntu 14.04.3
      14. Creating the COLLADA file of a robot to work with OpenRave
      15. Generating the IKFast CPP file for the IRB 6640 robot
        1. Creating the MoveIt! IKFast plugin
      16. Questions
      17. Summary
    19. 12. Troubleshooting and Best Practices in ROS
      1. Setting up Eclipse IDE on Ubuntu 14.04.3
      2. Setting ROS development environment in Eclipse IDE
        1. Global settings in Eclipse IDE
          1. ROS compile script for Eclipse IDE
          2. Adding ROS Catkin package to Eclipse
          3. Adding run configurations to run ROS nodes in Eclipse
      3. Best practices in ROS
        1. ROS C++ coding style guide
          1. Standard naming conventions used in ROS
          2. Code license agreement
          3. ROS code formatting
          4. ROS code documentation
          5. Console output
      4. Best practices in the ROS package
      5. Important troubleshooting tips in ROS
        1. Usage of roswtf
      6. Questions
      7. Summary
    20. Index

Product information

  • Title: Mastering ROS for Robotics Programming
  • Author(s): Lentin Joseph
  • Release date: December 2015
  • Publisher(s): Packt Publishing
  • ISBN: 9781783551798