O'Reilly logo

Mastering BeagleBone Robotics by Richard Grimmett

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Following movement with your robot

To follow the movement, you will do something very similar to the previous section on following color. Your program will hold the center of the movement in the center_point variable, which will hold and the x and y value. You can then use it to move your robot if it is on either edge of the vision field. The first additions you'll need to add to your program are the import time and import os lines at the top of the file, to include these libraries. Here are the changes:

Following movement with your robot

Here are the main additions at the bottom of the program on motion detection:

These lines should look almost exactly like the lines you added to ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required