I'm a robot builder and I got tired of seeing universities play robot soccer or something with computer vision guiding their players, and no matter how much I begged, darn Ivy Leagues wouldn't share.
So, I wrote my own. And while I did it, I swore I'd try to help anyone trying something similar.
Step 1: Proof-of-Concept
Overlord and Dot Muncher
Step 2: Overview: How it Works
- Webcam sends images of its field-of-view.
- OpenCV looks for the largest red blob.
- It begins tracking the red blob's X, Y.
- The PC averages these X, Y positions for around 150 camera frames.
- If the blob hasn't moved much, the PC assumes the red blob is the robot.
- The PC gets frisky and gives our robot a random target within the webcam's field-of-view.
- The PC calculates the angle between the bot and the target.
- Meanwhile, the robot's microcontroller is taking readings from a magnetometer on the robot.
- The robot, with a one time human calibration, translates true North to "video-game north," aka, top of PC's screen.
- The microcontroller transmits this code to the PC.
- The PC compares the angle of the bot from the target with the robots angle.
- The PC sends a code to the bot telling it to turn left, right, or move forward (closer to the target).
- When the robot has made it within an acceptable distance from the target he "Munches the Dot."
- A new random dot appears. Rinse repeat. (For real though, don't rinse the bot. Consider Asimov's Third Law.)