Reader small image

You're reading from  Mastering Beaglebone Robotics

Product typeBook
Published inDec 2014
Reading LevelBeginner
Publisher
ISBN-139781783988907
Edition1st Edition
Languages
Concepts
Right arrow
Author (1)
Richard Grimmett
Richard Grimmett
author image
Richard Grimmett

Richard Grimmett has more fun that should be allowed working on robotics projects while teaching Computer Science and Electrical Engineering at Brigham Young University Idaho. He has a Bachelors and Masters degree in Electrical Engineering and a PhD in Leadership Studies. He also has 26 years of experience in the Radar and Telecommunications industries, and even has one of the original brick phones. He has written books on the basics of using the BeagleBone Black for robotics projects, and another for the Raspberry PI and yet another for the Arduino.
Read more about Richard Grimmett

Right arrow

Following colored objects with your vision system


Now that your robot can sense colored objects, let's take this a step forward and use this capability to actually guide your robot. If you look at the code from the last section, you'll notice two variables, pt1 and pt2. These variables hold the x and y coordinates of the color that your robot found. We can use these with our dcmotor.py program to move the robot so that when the color reaches the edge of the viewing area, the robot will move to put the colored object back into the middle of the viewing area. Here is the code:

When your robot finds a color, it also finds the x boundaries of that color. These are held in the rect[0] and rect[2] variables. Each time through the loop, your program checks to see if the left side is smaller than 20 or the right side is larger than 310. In either case, your program will call the dcmotor.py program you wrote earlier and move the robot in a turn either to the right or left. As you move the target,...

lock icon
The rest of the page is locked
Previous PageNext Page
You have been reading a chapter from
Mastering Beaglebone Robotics
Published in: Dec 2014Publisher: ISBN-13: 9781783988907

Author (1)

author image
Richard Grimmett

Richard Grimmett has more fun that should be allowed working on robotics projects while teaching Computer Science and Electrical Engineering at Brigham Young University Idaho. He has a Bachelors and Masters degree in Electrical Engineering and a PhD in Leadership Studies. He also has 26 years of experience in the Radar and Telecommunications industries, and even has one of the original brick phones. He has written books on the basics of using the BeagleBone Black for robotics projects, and another for the Raspberry PI and yet another for the Arduino.
Read more about Richard Grimmett