Mechatronics Final Project

Ball Pickup

The ball detection of the robot car utilized the color detection algorithm in the colorvision.c file to return the centroid and size (numpels) of blue and orange balls. Additional code was added to the colorvision.c code to allow for two-color detection. Entering two HSV ranges and utilizing a flag to determine whether to detect orange or blue balls implemented two-color detection.

If the number of pixels of either the blue or orange balls was greater than a certain threshold, the ball pick up sequence would take control. The robot’s turn control is set so that the centroid of the golf ball would be either offset left or right so that the balls can enter the correct section of ball picker-upper. The speed of the robot car is decreased to allow more time for the robot to align itself with the golf balls. The metal arm of the picker-upper opens as it enters the ball picking sequence. The turn during this sequence is set to zero to prevent the ball from missing the slot. The robot continues to drive straight and then the arm is closed after a certain delay, implemented by a timer. There is a check that determines the size of the different color golf balls seen by the robot and setting the larger, which means closer, golf ball as the target.

After the robot is done running the course, it goes to the different golf ball drop points while opening its robot arms and then backs out of the spot, dropping the golf balls in their respective zones.