Scan the image looking for one of the colors the robot is searching for.
Search algorithm searches from the bottom to the top of the image, and from the center to the outside (left, then right)
to find objects that are closer before ones that are further away.
Runs a small sequence to fix left bumper hit
save rotation value
Turn 90 degrees Right while checking for right bumper hits
If right bumper hits, back up until it no longer hits
Once 90, travel forward a few inches
Turn 90 degrees Left while checking for left bumper hits
If left bumper hits, recursively call fixLeft, otherwise retrieve old rotation values and return
Runs a small sequence to fix right bumper hit.
Save rotation value
Turn 90 degree Left while checking for left bumper hits
If left bumper hits, back up until it no longer hits
Once 90, travel forward a few inches
Turn 90 degrees Right while checking for right bumper hits
If right bumper hits, recursively call fixRight, otherwise retrieve old rotation values and return
Gets the current tracking information from the camera and converts it to tracking information.
Reads current tracking information from the camera (which was started by calling trackColor()).
Considers object to be centered when x middle mass is between 30 and 60.
This is where the actual overall AI of the robot is controlled from.
The general flow of the AI is as follows:
Take a snapshot from the camera via serial download.
Search the image for one of our pre-defined colors.
Class constructor.
This function initialized the external components used by the robot.
One is the camera class, which does all the interaction and processing of the camera data.
Set the motors to correctly track an object.
Calls GetTrackDirection() to determine which direction to rotate to as well as whether to move forward or not.
Will handle wall/object collision by turning 90 degrees opposite of collision
moving a few inches, and swing back to the original orientation.