Source Code on GitHub
System Architecture | Software Design | Electrical Design | Mechanical Design
The system is divided into 2 major components: the single board computer running the control algorithm and the microcontroller driving the servos.
The single board computer is responsible for controlling the robot using the servos as the system output and the camera as the feedback input. It reads video from the camera and then filters it to produce a mask image of pixels matching the desired box color. The average location of matching pixels is used to calculate the box position relative to the center of the frame. This position acts as the error signal to the PID controller pivoting the robot.
The microcontroller is connected to the single board computer using USB serial. The microcontroller accepts movement commands from the single board computer and translates those into servo velocities, which are then sent to the servos. Additionally, the microcontroller implements a timeout feature. If the servo does not receive any commands for 2 seconds, it will stop the servos. This reduces the problem of undesired movement if any of the connections between the remote controller and the microcontroller go down.