HW8 - Autodrive

Team: Eric Wu, Michael Carnavos.

This is a compact robot car that can navigate autonomously on a road defined by parallel masking tapes. It uses an image processing algorithm developed by ourselves.

Details
Image Processing Algorithm

Using the “find_lines” example provided by the OpenMV IDE, we were able to draw lines along the significant color change on the live image. Then, we filtered out interfering lines by increasing the “threshold” in the code and defining an angle constraint. Assuming the robot is moving on a smooth surface with two distinct lines as the path, the camera will now only draw lines from the actual path.

Next, we acquired the theta values (shown in image 2). If the camera is mounted upright, the angle increases from 0 degree at one side and decreases from 180 degrees at the other. Therefore, we rotated our camera by 90 degrees, so that a straight path will have a theta value of 90 degrees, and the value will change proportionally as it rotates toward both sides.

Since the camera draw lines one at a time, most of the times it will alternately draw lines from the two path boundaries. Therefore, if we take the current line’s theta value and the previous one, we will end up with two lines that defines the two paths. We then looked the average value between the two lines, and send the angle to the pyboard.

From the pyboard, we compared the angle with 90 degrees. If the values are equal, the robot will be driving straight ahead. If the values differ, the robot will then drive one motor faster than the other to correct the direction of motion. We also used proportional control to ensure a smooth change of motor speed.