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 ...
Get Programming Robots with ROS now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.