The main goal of this project is to create an autonomous car that uses computer vision in order to achieve lane keeping. The car is able to drive through a predetermined curved track that uses blue tape as its lane lines and includes 2 red stop signals. We were inspired by raja_961's "Autonomous Lane-Keeping Car Using Raspberry Pi and OpenCV" project, which can be found at this link:https://www.instructables.com/Autonomous-Lane-Keeping-Car-Using-Raspberry-Pi-and/.
We would like to thank Team 5 for allowing us to use their car.
Resolution and PID:When selecting our resolution for the camera, we referred to raja_961's tutorial and used the same 320x240 resolution that he used. We found that this resolution was able to achieve a good balance of detail and performance, making it sufficient to process with our OpenCV vision algorithms.
When selecting our PID constants, we utilized a more trial-and-error approach. First, we tried using raja_961's constants of Kp = 0.4 and Kd = Kd*0.65, but those constants were too large for our use. From our testing, Kp = 1 and Kd = 0.1 was better for this specific course and our specific car. In particular, this allowed for appropriate aggressive corrective steering while preventing excessive oscillations.
Stop Box:When detecting the stop boxes, we simply processed every 5th frame to see if we detected the color of the red stop box in the frame. We incorporated some room for error within both the upper and lower bounds of what we considered "red", where we set the lower bound to 140, 80, 170 and the upper bound to 200, 255, 250. Like we stated before, our algorithm will stop the car if any red is detected, specifically if more than 1% of the camera frame is red. Although this may seem like a very low number, we found it worked in our use case and saw that it worked for previous groups in the https://www.hackster.io/elec424/projects?sort=published projects.
In order to address the first vs the second stop box, we simply pause after the first stop box is detected, and fully stop after the second red box is detected.
Voltage Plot:PID Plot:
We were working on implementing the encoder with our main code, and we showed the driver working to the instructor. He said our project was fine without the encoder integration because we showed him the video below.
Hardware Setup:Houston Dynamics: Spencer Darwall, Noah Elzner, Agha Sukerim, Anthony Zheng
Comments