Book Description

Build exciting robotics projects such as mobile manipulators, self-driving cars, and industrial robots powered by ROS, machine learning, and virtual reality

Key Features

  • Create and program cool robotic projects using powerful ROS libraries
  • Build industrial robots like mobile manipulators to handle complex tasks
  • Learn how reinforcement learning and deep learning are used with ROS

Book Description

Nowadays, heavy industrial robots placed in workcells are being replaced by new age robots called cobots, which don't need workcells. They are used in manufacturing, retail, banks, energy, and healthcare, among other domains. One of the major reasons for this rapid growth in the robotics market is the introduction of an open source robotics framework called the Robot Operating System (ROS).

This book covers projects in the latest ROS distribution, ROS Melodic Morenia with Ubuntu Bionic (18.04). Starting with the fundamentals, this updated edition of ROS Robotics Projects introduces you to ROS-2 and helps you understand how it is different from ROS-1. You'll be able to model and build an industrial mobile manipulator in ROS and simulate it in Gazebo 9. You'll then gain insights into handling complex robot applications using state machines and working with multiple robots at a time. This ROS book also introduces you to new and popular hardware such as Nvidia's Jetson Nano, Asus Tinker Board, and Beaglebone Black, and allows you to explore interfacing with ROS. You'll learn as you build interesting ROS projects such as self-driving cars, making use of deep learning, reinforcement learning, and other key AI concepts.

By the end of the book, you'll have gained the confidence to build interesting and intricate projects with ROS.

What you will learn

  • Grasp the basics of ROS and understand ROS applications
  • Uncover how ROS-2 is different from ROS-1
  • Handle complex robot tasks using state machines
  • Communicate with multiple robots and collaborate to build apps with them
  • Explore ROS capabilities with the latest embedded boards such as Tinker Board S and Jetson Nano
  • Discover how machine learning and deep learning techniques are used with ROS
  • Build a self-driving car powered by ROS
  • Teleoperate your robot using Leap Motion and a VR headset

Who this book is for

If you're a student, hobbyist, professional, or anyone with a passion for learning robotics and interested in learning about algorithms, motion control, and perception capabilities from scratch, this book is for you. This book is also ideal for anyone who wants to build a new product and for researchers to make the most of what's already available to create something new and innovative in the field of robotics.

Table of Contents

  1. Title Page
  2. Copyright and Credits
    1. ROS Robotics Projects Second Edition
  3. Dedication
  4. About Packt
    1. Why subscribe?
  5. Contributors
    1. About the authors
    2. Packt is searching for authors like you
  6. Preface
    1. Who this book is for
    2. What this book covers
    3. To get the most out of this book
      1. Download the example code files
      2. Download the color images
      3. Code in Action
      4. Conventions used
    4. Get in touch
      1. Reviews
  7. Getting Started with ROS
    1. Technical requirements
    2. Getting started with ROS 
      1. ROS distributions 
      2. Supported OSes 
      3. Robots and sensors supported by ROS 
      4. Why use ROS?
    3. Fundamentals of ROS
      1. The filesystem level
      2. The computation graph level
      3. The ROS community level 
      4. Communication in ROS 
    4. ROS client libraries 
    5. ROS tools 
      1. ROS Visualizer (RViz) 
      2. rqt_plot 
      3. rqt_graph 
    6. ROS simulators
    7. Installing ROS Melodic on Ubuntu 18.04 LTS 
      1. Getting started with the installation 
        1. Configuring Ubuntu repositories 
        2. Setting up source.list 
        3. Setting up keys 
        4. Installing ROS Melodic
        5. Initializing rosdep 
        6. Setting up the ROS environment 
        7. Getting rosinstall 
    8. Setting up ROS on VirtualBox 
    9. Introduction to Docker 
      1. Why Docker?
      2. Installing Docker 
        1. Installing from the Ubuntu repository
        2. Removing Docker
        3. Installing from the Docker repository
        4. Working with Docker
    10. Setting up the ROS workspace 
    11. Opportunities for ROS in industries and research 
    12. Summary 
  8. Introduction to ROS-2 and Its Capabilities
    1. Technical requirements
    2. Getting started with ROS-2
      1. ROS-2 distributions
      2. Supported operating systems
      3. Robots and sensors supported in ROS-2
      4. Why ROS-2?
    3. Fundamentals of ROS-2
      1. What is DDS?
      2. How is DDS implemented?
      3. Computational graph
      4. ROS-2 community level
      5. Communication in ROS-2
      6. Changes between ROS-1 and ROS-2
    4. ROS-2 client libraries (RCL)
    5. ROS-2 tools
      1. Rviz2
      2. Rqt
    6. Installing ROS-2
      1. Getting started with the installation
        1. Setting up the system locale
        2. Adding ROS-2 repositories
        3. Installing development and ROS tools
      2. Getting the ROS-2 source code
        1. Installing dependencies using rosdep
        2. Installing DDS implementations (optional)
        3. Building code
      3. Setting up ROS-1, ROS-2, or both environments
      4. Running test nodes
    7. Setting up the ROS-2 workspace
    8. Writing ROS-2 nodes
      1. ROS-1 example code
      2. ROS-2 example code
      3. Differences between ROS-1 and ROS-2 talker nodes
    9. Bridging ROS-1 and ROS-2
      1. Testing the ros1_bridge package
    10. Summary
  9. Building an Industrial Mobile Manipulator
    1. Technical requirements
    2. Understanding available mobile manipulators
    3. Applications of mobile manipulators
    4. Getting started building mobile manipulators
      1. Units and coordinate system
      2. Gazebo and ROS assumptions
    5. Building the robot base
      1. Robot base prerequisites
        1. Robot base specifications
        2. Robot base kinematics
      2. Software parameters
        1. ROS message format
        2. ROS controllers
      3. Modeling the robot base
        1. Initializing the workspace
        2. Defining the links
        3. Defining the joints
      4. Simulating the robot base
        1. Defining collisions
        2. Defining actuators
        3. Defining ROS_CONTROLLERS
      5. Testing the robot base
    6. Getting started building the robot arm
      1. Robot arm prerequisites
        1. Robot arm specifications
        2. Robot arm kinematics
      2. Software parameters
        1. The ROS message format
        2. ROS controllers
      3. Modeling the robot arm
        1. Initializing the workspace
        2. Defining the links
        3. Defining the joints
      4. Simulating the robot arm 
        1. Defining collisions
        2. Defining actuators
        3. Defining ROS_CONTROLLERS
      5. Testing the robot arm
    7. Putting things together
      1. Modeling the mobile manipulator
      2. Simulating and testing the mobile manipulator
    8. Summary
  10. Handling Complex Robot Tasks Using State Machines
    1. Technical requirements
    2. Introduction to ROS actions
      1. The client-server concept
      2. An actionlib example – robot arm client
      3. An actionlib example – battery simulator server-client
        1. Creating a package and a folder action inside it
        2. Creating an action file that has the goal, result, and feedback
        3. Modifying the package files and compiling the package
        4. Defining a server
        5. Defining a client
    3. Waiter robot analogy
    4. Introduction to state machines
    5. Introduction to SMACH
      1. SMACH concepts
        1. Outcome
        2. User data
        3. Preemption
        4. Introspection
    6. Getting started with SMACH examples
      1. Installing and using SMACH-ROS
      2. Simple example
      3. Restaurant robot analogy
    7. Summary
  11. Building an Industrial Application
    1. Technical requirements
    2. Application use case – robot home delivery
      1. Setting up the environment in Gazebo
    3. Making our robot base intelligent
      1. Adding a laser sensor
      2. Configuring the navigation stack
      3. Mapping the environment
      4. Localizing the robot base
    4. Making our robot arm intelligent
      1. Introduction to Moveit
      2. Installing and configuring Moveit for our mobile robot
        1. Installing Moveit
        2. Configuring the Moveit setup assistant wizard
        3. Loading the robot model
        4. Setting up self-collisions
        5. Setting up planning groups
        6. Setting up arm poses
        7. Setting up passive joints
        8. Setting up ROS controllers
        9. Finalizing the Moveitconfig package
      3. Controlling the robot arm using Moveit
    5. Simulating the application
      1. Mapping and saving the environment
      2. Choosing the points on the environment
      3. Adding the points to our library
      4. Completing the state machine
    6. Improvements to the robot
    7. Summary
  12. Multi-Robot Collaboration
    1. Technical requirements
    2. Understanding the swarm robotics application
    3. Swarm robot classification
    4. Multiple robot communication in ROS
      1. Single roscore and common networks
        1. Issues with a common network
      2. Using groups/namespaces
      3. Example – multi-robot spawn using groups/namespaces
        1. Issues with using groups/namespaces
    5. Introduction to the multimaster concept
      1. Introduction to the multimaster_fkie package
      2. Installing the multimaster_fkie package
      3. Setting up the multimaster_fkie package
        1. Setting up hostnames and IPs
        2. Checking and enabling the multicast feature
        3. Testing the setup
    6. A multi-robot use case
    7. Summary
  13. ROS on Embedded Platforms and Their Control
    1. Technical requirements
    2. Understanding embedded boards
      1. Important concepts
      2. How different are microcontrollers and microprocessors in robotics?
      3. What matters while choosing such boards
    3. Introduction to microcontroller boards
      1. Arduino Mega
        1. How to choose an Arduino board for your robot
      2. STM32
      3. ESP8266
      4. ROS-supported embedded boards 
        1. OpenCR
        2. Arbotix-Pro
      5. Comparison table
    4. Introduction to single-board computers
      1. CPU boards
        1. Tinkerboard S
        2. BeagleBone Black
        3. Raspberry Pi
      2. Comparison table
      3. GPU boards
        1. Jetson TX2
        2. Jetson Nano
      4. Comparison table
    5. Debian versus Ubuntu
    6. Setting up ROS on Tinkerboard S
      1. Prerequisites
      2. Installing the Tinkerboard Debian OS
      3. Installing Armbian and ROS
      4. Installing using an available ROS image
    7. Setting up ROS on BeagleBone Black
      1. Prerequisites
      2. Installing the Debian OS
      3. Installing Ubuntu and ROS
    8. Setting up ROS on Raspberry Pi 3/4
      1. Prerequisites
      2. Installing Raspbian and ROS
      3. Installing Ubuntu and ROS
    9. Setting up ROS on Jetson Nano
    10. Controlling GPIOS from ROS
      1. Tinkerboard S
      2. BeagleBone Black
      3. Raspberry Pi 3/4
      4. Jetson Nano
    11. Benchmarking embedded boards
    12. Getting started with Alexa and connecting with ROS
      1. Alexa skill-building requirements
      2. Creating a skill
    13. Summary
  14. Reinforcement Learning and Robotics
    1. Technical requirements
    2. Introduction to machine learning
      1. Supervised learning
      2. Unsupervised learning
      3. Reinforcement learning
    3. Understanding reinforcement learning
      1. Explore versus exploit
      2. Reinforcement learning formula
      3. Reinforcement learning platforms
      4. Reinforcement learning in robotics
    4. MDP and the Bellman equation
    5. Reinforcement learning algorithms
      1. Taxi problem analogy
      2. TD prediction
        1. Algorithm explanation
      3. TD control
        1. Off-policy learning – the Q-learning algorithm
          1. Algorithm explanation
        2. On-policy learning – the SARSA algorithm
          1. Algorithm explanation
        3. Installing OpenAI Gym, NumPy, and pandas
        4. Q-learning and SARSA in action
    6. Reinforcement learning in ROS
      1. gym-gazebo
        1. TurtleBot and its environment
        2. Installing gym-gazebo and its dependencies
        3. Testing the TurtleBot-2 environment
      2. gym-gazebo2
        1. MARA and its environment
        2. Installing gym-gazebo2 and dependencies
        3. Testing the MARA environment
    7. Summary
  15. Deep Learning Using ROS and TensorFlow
    1. Technical requirements
    2. Introduction to deep learning and its applications
    3. Deep learning for robotics
    4. Deep learning libraries
    5. Getting started with TensorFlow
      1. Installing TensorFlow on Ubuntu 18.04 LTS
      2. TensorFlow concepts
        1. Graph
        2. Session
        3. Variables
        4. Fetches
        5. Feeds
      3. Writing our first code in TensorFlow
    6. Image recognition using ROS and TensorFlow
      1. Prerequisites
      2. The ROS image recognition node
        1. Running the ROS image recognition node
    7. Introducing to scikit-learn
      1. Installing scikit-learn on Ubuntu 18.04 LTS
    8. Introduction to SVM and its application in robotics
      1. Implementing an SVM-ROS application
    9. Summary
  16. Creating a Self-Driving Car Using ROS
    1. Technical requirements
    2. Getting started with self-driving cars
      1. The history of autonomous vehicles
        1. Levels of autonomy
    3. Components of a typical self-driving car
      1. GPS, IMU, and wheel encoders
        1. Xsens MTi IMU
      2. Camera
      3. Ultrasonic sensors
      4. LIDAR and RADAR
        1. Velodyne HDL-64 LIDAR
        2. SICK LMS 5xx/1xx and Hokuyo LIDAR
        3. Continental ARS 300 radar (ARS)
        4. The Delphi radar
        5. Onboard computer
      5. Software block diagram of self-driving cars
    4. Simulating and interfacing self-driving car sensors in ROS
      1. Simulating the Velodyne LIDAR
      2. Interfacing Velodyne sensors with ROS
      3. Simulating a laser scanner
      4. Explaining the simulation code
      5. Interfacing laser scanners with ROS
      6. Simulating stereo and mono cameras in Gazebo
      7. Interfacing cameras with ROS
      8. Simulating GPS in Gazebo
      9. Interfacing GPS with ROS
      10. Simulating IMU on Gazebo
      11. Interfacing IMUs with ROS
      12. Simulating an ultrasonic sensor in Gazebo
      13. Low-cost LIDAR sensors
        1. Sweep LIDAR
        2. RPLIDAR
    5. Simulating a self-driving car with sensors in Gazebo
      1. Installing prerequisites
        1. Visualizing robotic car sensor data
        2. Moving a self-driving car in Gazebo
        3. Running hector SLAM using a robotic car
    6. Interfacing a DBW car with ROS
      1. Installing packages
      2. Visualizing the self-driving car and sensor data
      3. Communicating with DBW from ROS
    7. Introducing the Udacity open source self-driving car project
      1. Open source self-driving car simulator from Udacity
      2. MATLAB ADAS Toolbox
    8. Summary
  17. Teleoperating Robots Using a VR Headset and Leap Motion
    1. Technical requirements
    2. Getting started with a VR headset and Leap Motion
    3. Designing and working on the project
    4. Installing the Leap Motion SDK on Ubuntu 14.04.5
      1. Visualizing the Leap Motion controller data
      2. Playing with the Leap Motion Visualizer tool
      3. Installing the ROS driver for the Leap Motion controller
        1. Testing the Leap Motion ROS driver
    5. Visualizing Leap Motion data in RViz
    6. Creating a teleoperation node using the Leap Motion controller
    7. Building a ROS-VR Android application
    8. Working with the ROS-VR application and interfacing with Gazebo
    9. TurtleBot simulation in VR
      1. Installing the Turtlebot simulator
      2. Working with TurtleBot in VR
    10. Troubleshooting the ROS-VR application
    11. Integrating the ROS-VR application and Leap Motion teleoperation
    12. Summary
  18. Face Detection and Tracking Using ROS, OpenCV, and Dynamixel Servos
    1. Technical requirements
    2. Overview of the project
    3. Hardware and software prerequisites
      1. Installing the usb_cam ROS package
        1. Creating an ROS workspace for dependencies
        2. Configuring a webcam on Ubuntu 18.04
        3. Interfacing the webcam with ROS
    4. Configuring a Dynamixel servo using RoboPlus
      1. Setting up the USB-to-Dynamixel driver on the PC
    5. Interfacing Dynamixel with ROS
      1. Installing the ROS dynamixel_motor packages
    6. Creating face tracker ROS packages
      1. The interface between ROS and OpenCV
    7. Working with the face-tracking ROS package
      1. Understanding the face tracker code
      2. Understanding CMakeLists.txt
      3. The track.yaml file
      4. Launch files
      5. Running the face tracker node
      6. The face_tracker_control package
        1. The start_dynamixel launch file
        2. The pan controller launch file
      7. The pan controller configuration file
      8. The servo parameters configuration file
      9. The face tracker controller node
      10. Creating CMakeLists.txt
      11. Testing the face tracker control package
      12. Bringing all of the nodes together
      13. Fixing the bracket and setting up the circuit
      14. The final run
    8. Summary
  19. Other Books You May Enjoy
    1. Leave a review - let other readers know what you think