ROS Robotics By Example - Second Edition

Book description

Learning how to build and program your own robots with the most popular open source robotics programming framework

About This Book

  • Get to know the fundamentals of ROS and apply its concepts to real examples
  • Learn how to write robotics applications without getting bogged down in hardware problems
  • Learn to implement best practices in ROS development

Who This Book Is For

This book is for robotic enthusiasts, researchers and professional robotics engineers who would like to build robot applications using ROS. It gives the robotics beginner and the ROS newbie an immensely practical introduction to robot building and robotics application coding. Basic knowledge of GNU/Linux and the ability to write simple applications is assumed, but no robotics knowledge, practical or theoretical, is needed.

What You Will Learn

  • Control a robot without requiring a PhD in robotics
  • Simulate and control a robot arm
  • Control a flying robot
  • Send your robot on an independent mission
  • Learning how to control your own robots with external devices
  • Program applications running on your robot
  • Extend ROS itself
  • Extend ROS with the MATLAB Robotics System Toolbox

In Detail

ROS is a robust robotics framework that works regardless of hardware architecture or hardware origin. It standardizes most layers of robotics functionality from device drivers to process control and message passing to software package management.

But apart from just plain functionality, ROS is a great platform to learn about robotics itself and to simulate, as well as actually build, your first robots. This does not mean that ROS is a platform for students and other beginners; on the contrary, ROS is used all over the robotics industry to implement flying, walking and diving robots, yet implementation is always straightforward, and never dependent on the hardware itself.

ROS Robotics has been the standard introduction to ROS for potential professionals and hobbyists alike since the original edition came out; the second edition adds a gradual introduction to all the goodness available with the Kinetic Kame release.

By providing you with step-by-step examples including manipulator arms and flying robots, the authors introduce you to the new features. The book is intensely practical, with space given to theory only when absolutely necessary. By the end of this book, you will have hands-on experience on controlling robots with the best possible framework.

Style and approach

ROS Robotics By Example, Second Edition gives the robotics beginner as well as the ROS newbie an immensely practical introduction to robot building and robotics application coding. ROS translates as "robot operating system"; you will learn how to control a robot via devices and configuration files, but you will also learn how to write robot applications on the foundation of this operating system.

Table of contents

  1. ROS Robotics By Example Second Edition
    1. Table of Contents
    2. ROS Robotics By Example Second Edition
    3. Credits
    4. About the Authors
    5. About the Reviewer
      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. What does ROS do and what are the benefits of learning ROS?
        1. Who controls ROS?
      2. Which robots are using ROS?
      3. Installing and launching ROS
        1. Configuring your Ubuntu repositories
        2. Setting up your sources.list file
        3. Setting up your keys
        4. Installing ROS Kinetic
        5. Initialize rosdep
        6. Environment setup
        7. Getting rosinstall
        8. Troubleshooting – examining your ROS environment
      4. Creating a catkin workspace
      5. ROS packages and manifest
        1. ROS manifest
        2. Exploring the ROS packages
          1. rospack find packages
          2. rospack list
      6. ROS nodes, topics, and messages
        1. ROS nodes
        2. ROS topics
        3. ROS messages
        4. ROS Master
          1. Invoking the ROS Master using roscore
            1. Parameter Server
        5. ROS commands to determine the nodes and topics
      7. Turtlesim – the first ROS robot simulation
        1. Starting turtlesim nodes
          1. rosrun command
        2. Turtlesim nodes
        3. Turtlesim topics and messages
          1. rostopic list
          2. rostopic type
          3. rosmsg list
          4. rosmsg show
          5. rostopic echo
        4. Move the turtle by publishing /turtle1/cmd_vel
        5. Move the turtle using the keyboard or joystick
        6. Parameter Server of Turtlesim
          1. rosparam help
          2. rosparam list for the /turtlesim node
          3. Change parameters for the color of the turtle's background
            1. rosparam get
            2. rosparam set
        7. ROS services to move turtle
          1. rosservice call
      8. ROS commands summary
      9. Summary
    10. 2. Creating Your First Two-Wheeled ROS Robot (in Simulation)
      1. Introducing rviz
        1. Installing and launching rviz
        2. Getting familiar with rviz
          1. Displays panel
          2. Views and Time panels
            1. Mouse control
          3. Toolbar
          4. Main window menu bar
      2. Creating and building a ROS package
      3. Building a differential drive robot URDF
        1. Creating a robot chassis
        2. Using roslaunch
        3. Adding wheels
        4. Adding a caster
        5. Adding color
        6. Adding collisions
        7. Moving the wheels
        8. A word about tf and robot_state_publisher
        9. Adding physical properties
        10. Trying URDF tools
          1. check_urdf
          2. urdf_to_graphiz
      4. Gazebo
        1. Installing and launching Gazebo
        2. Using roslaunch with Gazebo
        3. Getting familiar with Gazebo
          1. Environment toolbar
          2. World, Insert and Layers panels
          3. Joints panel
          4. Main window menu bar
          5. Simulation panel
        4. Modifications to the robot URDF
          1. Adding the Gazebo tag
          2. Specifying color in Gazebo
          3. A word about the <visual> and <collision> elements in Gazebo
        5. Verifying a Gazebo model
        6. Viewing the URDF in Gazebo
        7. Tweaking your model
        8. Moving your model around
        9. Other ROS simulation environments
      5. Summary
    11. 3. Driving Around with TurtleBot
      1. Introducing TurtleBot 2
      2. Loading TurtleBot 2 simulator software
      3. Launching TurtleBot 2 simulator in Gazebo
        1. Problems and troubleshooting
        2. ROS commands and Gazebo
        3. Keyboard teleoperation of TurtleBot 2 in simulation
      4. Setting up to control a real TurtleBot 2
        1. TurtleBot 2 standalone test
      5. Networking the netbook and remote computer
        1. Types of networks
        2. Network addresses
        3. Remote computer network setup
        4. Netbook network setup
        5. Secure Shell (SSH) connection
        6. Summary of network setup
        7. Troubleshooting your network connection
        8. Testing the TurtleBot 2 system
      6. TurtleBot 2 hardware specifications
        1. TurtleBot 2 dashboard
      7. Moving the real TurtleBot 2
        1. Using keyboard teleoperation to move TurtleBot 2
        2. Using ROS commands to move TurtleBot 2 around
        3. Writing your first Python script to control TurtleBot 2
      8. Introducing rqt tools
        1. rqt_graph
        2. rqt message publisher and topic monitor
      9. TurtleBot's odometry
        1. Odom for the simulated TurtleBot 2
        2. Real TurtleBot 2's odometry display in rviz
      10. TurtleBot 2 automatic docking
      11. Introducing TurtleBot 3
      12. Loading TurtleBot 3 simulation software
      13. Launching TurtleBot 3 simulation in rviz
      14. Launching TurtleBot 3 simulation in Gazebo
      15. Hardware assembly and testing
      16. Loading TurtleBot 3 software
        1. Installing remote computer software
        2. Installing SBC software
          1. Loading Ubuntu MATE
          2. Loading ROS packages
          3. Loading TurtleBot 3 packages
          4. Setting up udev rules for TurtleBot 3
      17. Networking TurtleBot 3 and the remote computer
        1. Remote computer network setup
        2. TurtleBot 3 network setup
          1. SSH connection
        3. Testing the SSH communication
        4. Troubleshooting your network connection
      18. Moving the real TurtleBot 3
        1. Using keyboard teleoperation to move TurtleBot 3
      19. Summary
    12. 4. Navigating the World with TurtleBot
      1. 3D vision systems for TurtleBot
        1. How these 3D vision sensors work
        2. Comparison of 3D sensors
          1. Microsoft Kinect
          2. ASUS
          3. PrimeSense Carmine
          4. Intel RealSense
          5. Hitachi-LG LDS
          6. Obstacle avoidance drawbacks
      2. Configuring TurtleBot and installing the 3D sensor software
        1. Kinect
        2. ASUS and PrimeSense
        3. Intel RealSense
        4. Camera software structure
        5. Defining terms
      3. Testing the 3D sensor in standalone mode
      4. Running ROS nodes for visualization
        1. Visual data using Image Viewer
        2. Visual data using rviz
      5. Navigating with TurtleBot
        1. Mapping a room with TurtleBot 2
          1. Defining terms
          2. Building a map
          3. How does TurtleBot accomplish this mapping task?
        2. Autonomous navigation with TurtleBot 2
          1. Defining terms
          2. Driving without steering TurtleBot 2
          3. rviz control
          4. How does TurtleBot accomplish this navigation task?
        3. Navigating to a designated location
        4. Navigating to waypoints with a Python script using a map
          1. Defining TurtleBot's position on a map
          2. Defining waypoints on a map
          3. Using Python code to move TurtleBot
          4. TurtleBot at final goal point
        5. SLAM for TurtleBot 3
        6. Autonomous navigation with TurtleBot 3
        7. rqt_reconfigure
        8. Exploring ROS navigation further
      6. Summary
    13. 5. Creating Your First Robot Arm (in Simulation)
      1. Features of Xacro
      2. Building an articulated robot arm URDF using Xacro
        1. Specifying a namespace
        2. Using the Xacro property tag
        3. Expanding Xacro
          1. Using roslaunch for rrbot
        4. Using the Xacro include and macro tags
        5. Adding mesh to the robot arm
      3. Controlling an articulated robot arm in Gazebo
        1. Adding Gazebo-specific elements
        2. Fixing the robot arm to the world
        3. Viewing the robot arm in Gazebo
        4. Adding controls to Xacro
          1. Defining transmission elements for joints
          2. Adding a Gazebo ROS control plugin
          3. Creating a YAML configuration file
          4. Creating a control launch file
        5. Controlling your robot arm with the ROS command line
        6. Controlling your robot arm with rqt
          1. Trying more things in rqt
      4. Summary
    14. 6. Wobbling Robot Arms Using Joint Control
      1. Introducing Baxter
        1. Baxter, the research robot
        2. Baxter Simulator
      2. Baxter's arms
        1. Baxter's bend joints
        2. Baxter's twist joints
        3. Baxter's coordinate frame
        4. Control modes for Baxter's arms
        5. Baxter's grippers
        6. Baxter's arm sensors
      3. Loading Baxter software
        1. Installing Baxter SDK software
        2. Installing Baxter Simulator
        3. Configuring the Baxter shell
        4. Installing MoveIt!
      4. Launching Baxter Simulator in Gazebo
        1. Bringing Baxter Simulator to life
        2. Warm-up exercises
        3. Flexing Baxter's arms
          1. Untucking Baxter's arms
          2. Wobbling arms
          3. Controlling arms and grippers with a keyboard
          4. Controlling arms and grippers with a joystick
          5. Controlling arms with a Python script
          6. Recording and replaying arm movements
      5. Baxter's arms and forward kinematics
        1. Joints and joint state publisher
        2. Understanding tf
          1. A program to move Baxter's arms to a zero angle position
        3. Commanding the joint angles directly
        4. rviz tf frames
        5. Viewing a tf tree of robot elements
      6. Introducing MoveIt!
        1. Planning a move of Baxter's arms with MoveIt!
        2. Adding objects to a scene
          1. Position of objects
        3. Planning a move to avoid obstacles with MoveIt!
      7. Configuring a real Baxter setup
      8. Controlling a real Baxter
        1. Commanding joint position waypoints
        2. Commanding joint torque springs
        3. Demonstrating joint velocity
        4. Additional examples
        5. Visual servoing and grasping
      9. Inverse kinematics
        1. Moving Baxter's arms with IK
      10. Using a state machine to perform YMCA
      11. Summary
    15. 7. Making a Robot Fly
      1. Introducing quadrotors
        1. Why are quadrotors so popular?
        2. Defining roll, pitch, and yaw
        3. How do quadrotors fly?
        4. Components of a quadrotor
        5. Adding sensors
        6. Quadrotor communications
      2. Understanding quadrotor sensors
        1. Inertial measurement unit
        2. Quadrotor condition sensors
      3. Preparing to fly your quadrotor
        1. Testing your quadrotor
        2. Pre-flight checklist
        3. Precautions when flying your quadrotor
        4. Following the rules and regulations
      4. Using ROS with UAVs
      5. Introducing Hector Quadrotor
        1. Loading Hector Quadrotor
        2. Launching Hector Quadrotor in Gazebo
          1. Flying Hector outdoors
          2. Flying Hector indoors
      6. Introducing Crazyflie 2.0
        1. Controlling Crazyflie without ROS
        2. Communicating using Crazyradio PA
        3. Loading Crazyflie ROS software
          1. Setting up udev rules for Crazyradio
        4. Pre-flight check
        5. Flying Crazyflie with teleop
          1. Details of teleop_xbox360.launch
        6. Flying with a motion capture system
        7. Flying multiple Crazyflies
      7. Introducing Bebop
        1. Loading bebop_autonomy software
          1. Testing Bebop communications
        2. Flying Bebop using commands
          1. Take off
          2. Landing
      8. Summary
    16. 8. Controlling Your Robots with External Devices
      1. Creating a custom ROS game controller interface
        1. Testing a game controller
          1. Alternative test of a game controller
        2. Using the ROS joy package
        3. Controlling Turtlesim with a custom game controller interface
      2. Creating a custom ROS Android device interface
        1. Installing Android Studio and tools
        2. Installing a ROS–Android development environment
        3. Defining terms
        4. Introducing ROS–Android development
      3. Creating ROS nodes on Arduino or Raspberry Pi
        1. Using Arduino
          1. Installing Arduino IDE software
          2. Installing ROS–Arduino software
          3. Ultrasonic sensor control using ROS and Arduino
            1. Connecting the Arduino to the HC-SR04 ultrasonic sensor
            2. Programming the Arduino to sense distance
            3. Executing the ultrasonic sensor program
          4. Other applications using ROS and Arduino
        2. Using Raspberry Pi
          1. Installing ROS on the Raspberry Pi
      4. Summary
    17. 9. Flying a Mission with Crazyflie
      1. Mission components
        1. Kinect for Windows v2
        2. Crazyflie operation
        3. Mission software structure
        4. OpenCV and ROS
      2. Loading software for the mission
        1. Installing libfreenect2
        2. Installing iai_kinect2
        3. Using the iai_kinect2 metapackage
          1. kinect2_bridge and kinect2_viewer
          2. kinect2_calibration
            1. Calibrating your Kinect
      3. Setting up the mission
        1. Detecting Crazyflie and a target
          1. Identifying markers in a color image
            1. Problems with target detection
          2. Detecting and viewing markers with OpenCV
        2. Using Kinect and OpenCV
        3. How to track Crazyflie
      4. How to control Crazyflie
        1. Crazyflie control states
          1. Using ROS services to control takeoff and land
            1. Activating takeoff and land
            2. What makes takeoff and land work?
          2. Using PID control for hover and flight
          3. Using an observer node
      5. Flying Crazyflie
        1. Hovering in place
          1. What makes hover work?
        2. Flying to a stationary target
          1. What makes target detection work?
        3. Learned lessons
          1. Logging messages with rosout and rospy
      6. Summary
    18. 10. Controlling Baxter with MATLAB©
      1. Installing the MATLAB Robotics System Toolbox
        1. Check the MATLAB and Robotics System Toolbox versions
        2. View the Robotics System Toolbox commands for ROS
      2. Using MATLAB Robotics System Toolbox and Baxter Simulator
        1. Installing Baxter messages in MATLAB
        2. Running Baxter Simulator and MATLAB
        3. Making Baxter move
      3. Summary
    19. Index

Product information

  • Title: ROS Robotics By Example - Second Edition
  • Author(s): Carol Fairchild, Dr. Thomas L. Harman
  • Release date: November 2017
  • Publisher(s): Packt Publishing
  • ISBN: 9781788479592