Meshing the tracking with robot controls was pretty straight forward. We used the database as a message queue, essentially we would update the database to indicate where the camera should be pointed based on image tracking. The position checking would read the new values from the database and correct the movement path. Made for fluid movement as the head tilt/pan was always in motion. For small movements it would move slowly for larger movements it would move faster, always in an acceleration arch that removed any jerkiness. We completed this several years ago, but never posted the video… this is Half Built after all
I finally finished my port of the E1 object tracking from OpenCV (CV2) / Python 2.7 to OpenCV / Python 2.6. I had to do this because Beagleboard doesn’t have a readily available Python 2.7 package (at least not with Angstrom), and I didn’t realize that OpenCV (CV2) required Python 2.7 until after I developed the original code on my laptop.
This was a bit of pain because there are not many examples. If your platform supports Python 2.7, use OpenCV CV2! There are a lot of examples and it’s all object oriented. It’s so much more enjoyable to work with.
I made a quick and dirty web GUI so that I can adjust the HSV values in real-time. It works pretty well.
I also built a quick-and-dirty web interface to control the servos. The big motivator here was I replaced the original side-to-side movement with a pan-tilt configuration.
Unfortunately when used together, the board gets reset…. Still trying to figure out why…
Ultimately the E1 will be controlled by a beagle board computer. To accomplish this I bought a Torobot 24-servo controller board, but had a really hard time getting an easy-to-use API to interface it. I tried pyUSB to no avail.
Finally I found that the Torobot USB board could be communicated with through an Arduino serial driver. Conveniently this is available through opkg:
opkg install kernel-module-cdc-acm
When the board is plugged in, it comes up as
From here you can simply echo commands to the device.
echo "#8P1500T100" > /dev/ttyACM0
This basically says “set servo 8 to position 1500 with speed 100″. Doesn’t get much simpler than that!