Skip to Content
Programming Robots with ROS
book

Programming Robots with ROS

by Morgan Quigley, Brian Gerkey, William D. Smart
December 2015
Intermediate to advanced
300 pages
10h 47m
English
O'Reilly Media, Inc.
Content preview from Programming Robots with ROS

Chapter 12. Follow-bot

The previous several chapters were mostly concerned with getting robots to move around: either moving the robot base for locomotion or moving a robot arm for manipulation. Most of the systems we’ve built thus far would be considered open-loop systems, meaning that they have no feedback loop. That is, these systems do not use sensor data to correct for errors that accumulate over time. In this chapter, we will start working with sensors to create closed-loop systems that compute errors and feed them back into the control system, with the goal of reducing errors of various sorts.

Let’s start by creating a robot that can follow lines on the ground using a camera. We will do this using OpenCV, a popular open source computer vision library. To build this system, we will need to do the following steps:

  • Acquire images from a camera and pass them to OpenCV.

  • Filter the images to identify the center of the line we are to follow.

  • Steer the robot so that the center of the robot stays on the center of the line.

This will be a closed-loop system: the robot will sense the steering error as it drifts off the line and then steer back toward the center of the line. As we have always been doing in this book, we will develop this entire application in simulation. First, we will show how to subscribe to images in ROS.

Acquiring Images

Images in ROS are sent around the system using the sensor_msgs/Image message type. To have images stream into our nodes, we need to subscribe ...

Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.

Read now

Unlock full access

More than 5,000 organizations count on O’Reilly

AirBnbBlueOriginElectronic ArtsHomeDepotNasdaqRakutenTata Consultancy Services

QuotationMarkO’Reilly covers everything we've got, with content to help us build a world-class technology community, upgrade the capabilities and competencies of our teams, and improve overall team performance as well as their engagement.
Julian F.
Head of Cybersecurity
QuotationMarkI wanted to learn C and C++, but it didn't click for me until I picked up an O'Reilly book. When I went on the O’Reilly platform, I was astonished to find all the books there, plus live events and sandboxes so you could play around with the technology.
Addison B.
Field Engineer
QuotationMarkI’ve been on the O’Reilly platform for more than eight years. I use a couple of learning platforms, but I'm on O'Reilly more than anybody else. When you're there, you start learning. I'm never disappointed.
Amir M.
Data Platform Tech Lead
QuotationMarkI'm always learning. So when I got on to O'Reilly, I was like a kid in a candy store. There are playlists. There are answers. There's on-demand training. It's worth its weight in gold, in terms of what it allows me to do.
Mark W.
Embedded Software Engineer

You might also like

Mastering ROS for Robotics Programming - Third Edition

Mastering ROS for Robotics Programming - Third Edition

Lentin Joseph, Jonathan Cacace
Effective Robotics Programming with ROS - Third Edition

Effective Robotics Programming with ROS - Third Edition

Luis Sanchez, Enrique Fernandez Perdomo, Anil Mahtani
Hands-On ROS for Robotics Programming

Hands-On ROS for Robotics Programming

Bernardo Ronquillo Japón

Publisher Resources

ISBN: 9781449325480Errata Page