O'Reilly logo

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Effective Robotics Programming with ROS - Third Edition

Book Description

Find out everything you need to know to build powerful robots with the most up-to-date ROS

About This Book

  • This comprehensive, yet easy-to-follow guide will help you find your way through the ROS framework
  • Successfully design and simulate your 3D robot model and use powerful robotics algorithms and tools to program and set up your robots with an unparalleled experience by using the exciting new features from Robot Kinetic
  • Use the latest version of gazebo simulator, OpenCV 3.0, and C++11 standard for your own algorithms

Who This Book Is For

This book is suitable for an ROS beginner as well as an experienced ROS roboticist or ROS user or developer who is curious to learn ROS Kinetic and its features to make an autonomous Robot. The book is also suitable for those who want to integrate sensors and embedded systems with other software and tools using ROS as a framework.

What You Will Learn

  • Understand the concepts of ROS, the command-line tools, visualization GUIs, and how to debug ROS
  • Connect robot sensors and actuators to ROS
  • Obtain and analyze data from cameras and 3D sensors
  • Use Gazebo for robot/sensor and environment simulation
  • Design a robot and see how to make it map the environment, navigate autonomously, and manipulate objects in the environment using MoveIt!
  • Add vision capabilities to the robot using OpenCV 3.0
  • Add 3D perception capabilities to the robot using the latest version of PCL

In Detail

Building and programming a robot can be cumbersome and time-consuming, but not when you have the right collection of tools, libraries, and more importantly expert collaboration. ROS enables collaborative software development and offers an unmatched simulated environment that simplifies the entire robot building process.

This book is packed with hands-on examples that will help you program your robot and give you complete solutions using open source ROS libraries and tools. It also shows you how to use virtual machines and Docker containers to simplify the installation of Ubuntu and the ROS framework, so you can start working in an isolated and control environment without changing your regular computer setup.

It starts with the installation and basic concepts, then continues with more complex modules available in ROS such as sensors and actuators integration (drivers), navigation and mapping (so you can create an autonomous mobile robot), manipulation, Computer Vision, perception in 3D with PCL, and more. By the end of the book, you’ll be able to leverage all the ROS Kinetic features to build a fully fledged robot for all your needs.

Style and approach

This book is packed with hands-on examples that will help you program your robot and give you complete solutions using ROS open source libraries and tools. All the robotics concepts and modules are explained and multiple examples are provided so that you can understand them easily.

Downloading the example code for this book. You can download the example code files for all Packt books you have purchased from your account at http://www.PacktPub.com. If you purchased this book elsewhere, you can visit http://www.PacktPub.com/support and register to have the code file.

Table of Contents

  1. Effective Robotics Programming with ROS Third Edition
    1. Table of Contents
    2. Effective Robotics Programming with ROS Third Edition
    3. Credits
    4. About the Authors
    5. About the Reviewer
    6. www.PacktPub.com
      1. eBooks, discount offers, and more
        1. Why subscribe?
    7. Customer Feedback
    8. 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
    9. 1. Getting Started with ROS
      1. PC installation
      2. Installing ROS Kinetic using repositories
        1. Configuring your Ubuntu repositories
        2. Setting up your source.list file
        3. Setting up your keys
        4. Installing ROS
        5. Initializing rosdep
        6. Setting up the environment
        7. Getting rosinstall
      3. How to install VirtualBox and Ubuntu
        1. Downloading VirtualBox
        2. Creating the virtual machine
      4. Using ROS from a Docker image
        1. Installing Docker
        2. Getting and using ROS Docker images and containers
      5. Installing ROS in BeagleBone Black
        1. Prerequisites
        2. Setting up the local machine and source.list file
        3. Setting up your keys
        4. Installing the ROS packages
        5. Initializing rosdep for ROS
        6. Setting up the environment in the BeagleBone Black
        7. Getting rosinstall for BeagleBone Black
        8. Basic ROS example on the BeagleBone Black
      6. Summary
    10. 2. ROS Architecture and Concepts
      1. Understanding the ROS Filesystem level
        1. The workspace
        2. Packages
        3. Metapackages
        4. Messages
        5. Services
      2. Understanding the ROS Computation Graph level
        1. Nodes and nodelets
        2. Topics
        3. Services
        4. Messages
        5. Bags
        6. The ROS master
        7. Parameter Server
      3. Understanding the ROS Community level
      4. Tutorials to practise with ROS
        1. Navigating through the ROS filesystem
        2. Creating our own workspace
        3. Creating an ROS package and metapackage
        4. Building an ROS package
        5. Playing with ROS nodes
        6. Learning how to interact with topics
        7. Learning how to use services
        8. Using Parameter Server
        9. Creating nodes
        10. Building the node
        11. Creating msg and srv files
        12. Using the new srv and msg files
        13. The launch file
        14. Dynamic parameters
      5. Summary
    11. 3. Visualization and Debugging Tools
      1. Debugging ROS nodes
        1. Using the GDB debugger with ROS nodes
        2. Attaching a node to GDB while launching ROS
        3. Profiling a node with valgrind while launching ROS
        4. Enabling core dumps for ROS nodes
      2. Logging messages
        1. Outputting logging messages
        2. Setting the debug message level
        3. Configuring the debugging level of a particular node
        4. Giving names to messages
        5. Conditional and filtered messages
        6. Showing messages once, throttling, and other combinations
        7. Using rqt_console and rqt_logger_level to modify the logging level on the fly
      3. Inspecting the system
        1. Inspecting the node's graph online with rqt_graph
      4. Setting dynamic parameters
      5. Dealing with the unexpected
      6. Visualizing nodes diagnostics
      7. Plotting scalar data
        1. Creating a time series plot with rqt_plot
      8. Image visualization
        1. Visualizing a single image
      9. 3D visualization
        1. Visualizing data in a 3D world using rqt_rviz
        2. The relationship between topics and frames
        3. Visualizing frame transformations
      10. Saving and playing back data
        1. What is a bag file?
        2. Recording data in a bag file with rosbag
        3. Playing back a bag file
        4. Inspecting all the topics and messages in a bag file
      11. Using the rqt_gui and rqt plugins
      12. Summary
    12. 4. 3D Modeling and Simulation
      1. A 3D model of our robot in ROS
      2. Creating our first URDF file
        1. Explaining the file format
        2. Watching the 3D model on rviz
        3. Loading meshes to our models
        4. Making our robot model movable
        5. Physical and collision properties
      3. Xacro – a better way to write our robot models
        1. Using constants
        2. Using math
        3. Using macros
        4. Moving the robot with code
        5. 3D modeling with SketchUp
      4. Simulation in ROS
        1. Using our URDF 3D model in Gazebo
        2. Adding sensors to Gazebo
        3. Loading and using a map in Gazebo
        4. Moving the robot in Gazebo
      5. Summary
    13. 5. The Navigation Stack – Robot Setups
      1. The navigation stack in ROS
      2. Creating transforms
        1. Creating a broadcaster
        2. Creating a listener
        3. Watching the transformation tree
      3. Publishing sensor information
        1. Creating the laser node
      4. Publishing odometry information
        1. How Gazebo creates the odometry
        2. Using Gazebo to create the odometry
        3. Creating our own odometry
      5. Creating a base controller
        1. Creating our base controller
      6. Creating a map with ROS
        1. Saving the map using map_server
        2. Loading the map using map_server
      7. Summary
    14. 6. The Navigation Stack – Beyond Setups
      1. Creating a package
      2. Creating a robot configuration
      3. Configuring the costmaps – global_costmap and local_costmap
        1. Configuring the common parameters
        2. Configuring the global costmap
        3. Configuring the local costmap
        4. Base local planner configuration
      4. Creating a launch file for the navigation stack
      5. Setting up rviz for the navigation stack
        1. The 2D pose estimate
        2. The 2D nav goal
        3. The static map
        4. The particle cloud
        5. The robot's footprint
        6. The local costmap
        7. The global costmap
        8. The global plan
        9. The local plan
        10. The planner plan
        11. The current goal
      6. Adaptive Monte Carlo Localization
      7. Modifying parameters with rqt_reconfigure
      8. Avoiding obstacles
      9. Sending goals
      10. Summary
    15. 7. Manipulation with MoveIt!
      1. The MoveIt! architecture
        1. Motion planning
        2. The planning scene
        3. World geometry monitor
        4. Kinematics
        5. Collision checking
      2. Integrating an arm in MoveIt!
        1. What's in the box?
        2. Generating a MoveIt! package with the Setup Assistant
        3. Integration into RViz
        4. Integration into Gazebo or a real robotic arm
      3. Simple motion planning
        1. Planning a single goal
        2. Planning a random target
        3. Planning a predefined group state
        4. Displaying the target motion
      4. Motion planning with collisions
        1. Adding objects to the planning scene
        2. Removing objects from the planning scene
        3. Motion planning with point clouds
      5. The pick and place task
        1. The planning scene
        2. The target object to grasp
        3. The support surface
        4. Perception
        5. Grasping
        6. The pickup action
        7. The place action
        8. The demo mode
        9. Simulation in Gazebo
      6. Summary
    16. 8. Using Sensors and Actuators with ROS
      1. Using a joystick or a gamepad
        1. How does joy_node send joystick movements?
        2. Using joystick data to move our robot model
      2. Using Arduino to add sensors and actuators
        1. Creating an example program to use Arduino
        2. Robot platform controlled by ROS and Arduino
          1. Connecting your robot motors to ROS using Arduino
          2. Connecting encoders to your robot
          3. Controlling the wheel velocity
      3. Using a low-cost IMU – 9 degrees of freedom
        1. Installing Razor IMU ROS library
        2. How does Razor send data in ROS?
        3. Creating an ROS node to use data from the 9DoF sensor in our robot
        4. Using robot localization to fuse sensor data in your robot
      4. Using the IMU – Xsens MTi
        1. How does Xsens send data in ROS?
      5. Using a GPS system
        1. How GPS sends messages
        2. Creating an example project to use GPS
      6. Using a laser rangefinder – Hokuyo URG-04lx
        1. Understanding how the laser sends data in ROS
        2. Accessing the laser data and modifying it
      7. Creating a launch file
      8. Using the Kinect sensor to view objects in 3D
        1. How does Kinect send data from the sensors, and how do we see it?
        2. Creating an example to use Kinect
      9. Using servomotors – Dynamixel
        1. How does Dynamixel send and receive commands for the movements?
        2. Creating an example to use the servomotor
      10. Summary
    17. 9. Computer Vision
      1. ROS camera drivers support
        1. FireWire IEEE1394 cameras
        2. USB cameras
        3. Making your own USB camera driver with OpenCV
      2. ROS images
        1. Publishing images with ImageTransport
      3. OpenCV in ROS
        1. Installing OpenCV 3.0
        2. Using OpenCV in ROS
      4. Visualizing the camera input images with rqt_image_view
      5. Camera calibration
        1. How to calibrate a camera
        2. Stereo calibration
      6. The ROS image pipeline
        1. Image pipeline for stereo cameras
      7. ROS packages useful for Computer Vision tasks
        1. Visual odometry
        2. Using visual odometry with viso2
        3. Camera pose calibration
        4. Running the viso2 online demo
        5. Performing visual odometry with viso2 with a stereo camera
      8. Performing visual odometry with an RGBD camera
        1. Installing fovis
        2. Using fovis with the Kinect RGBD camera
      9. Computing the homography of two images
      10. Summary
    18. 10. Point Clouds
      1. Understanding the Point Cloud Library
        1. Different point cloud types
        2. Algorithms in PCL
        3. The PCL interface for ROS
      2. My first PCL program
        1. Creating point clouds
        2. Loading and saving point clouds to the disk
        3. Visualizing point clouds
        4. Filtering and downsampling
        5. Registration and matching
        6. Partitioning point clouds
      3. Segmentation
      4. Summary
    19. Index