Book Image

BeagleBone Robotic Projects - Second Edition

By : Richard Grimmett
Book Image

BeagleBone Robotic Projects - Second Edition

By: Richard Grimmett

Overview of this book

BeagleBone Blue is effectively a small, light, cheap computer in a similar vein to Raspberry Pi and Arduino. It has all of the extensibility of today’s desktop machines, but without the bulk, expense, or noise. This project guide provides step-by-step instructions that enable anyone to use this new, low-cost platform in some fascinating robotics projects. By the time you are finished, your projects will be able to see, speak, listen, detect their surroundings, and move in a variety of amazing ways. The book begins with unpacking and powering up the components. This includes guidance on what to purchase and how to connect it all successfully, and a primer on programming the BeagleBone Blue. You will add additional software functionality available from the open source community, including making the system see using a webcam, hear using a microphone, and speak using a speaker. You will then learn to use the new hardware capability of the BeagleBone Blue to make your robots move, as well as discover how to add sonar sensors to avoid or find objects. Later, you will learn to remotely control your robot through iOS and Android devices. At the end of this book, you will see how to integrate all of these functionalities to work together, before developing the most impressive robotics projects: Drone and Submarine.
Table of Contents (18 chapters)
Title Page
About the Author
About the Reviewers
Customer Feedback

Using the vision library to detect colored objects

A useful task that OpenCV and your webcam can do is to track objects. This might be useful if you are building a system that needs to track and follow a colored object. OpenCV makes this amazingly simple by providing some high-level libraries that can help with this task. I'm going to do this in Python, as I find it much easier to work with than C. If you're a coder who feels more comfortable in C, these instructions should be fairly easy to translate to the C environment.

If you'd like, create a directory to hold your image-based work. From your home directory, you can create an imageplay directory name by typing mkdir imageplay while in your home directory. Then, change directory to the directory you just created by typing cd imageplay. Once there, let's bring over your file as a starting point by typing cp /home/debian/examples/python/ Now you are going to edit the file until it looks something like this: