Project 4: Rainbow Road

project1 project1

The goal of project 4 “Rainbow Road” was to modify the previously designed robot from project 3, into a more capable machine through the use of a camera and image processing. The objective was still to have a line following robot but this time with better more accurate sensors.

The Process:

As the structural body of the robot and steering control had already been created, the main effort of this project was adapting the old control code to the new image processing input. We started by attaching a camera to the front of the robot, in line with the center. Next, we implemented functionality to take and store photos. In order to extract information from the images they must be processed first. This was done by applying gaussian blur to the entire image, smoothing any edges. We then divided the image by the contour lines, and found the largest nonwhite area. Since the colored lines were placed on a white background this would isolate the line from the image. Finally we found the centroid of the nonwhite area and used this for our control logic. Given that the camera is inline with the center of the robot, the position of the centroid can directly tell us how far we are from the line in either direction, and how far the robot must turn. The control logic made the turn angle proportional to the displacement of the centroid from the center, giving us what was essentially the P from PID. This approach proved successful.

Results:

The success criteria of this project was for the robot to be able to follow a line from start to finish. We were successful in this requirement.