Software apps and online services
Our project is coding an RC car with an attached webcam to autonomously follow a track and stop at "stop signs" along the track. We are basing our code off of user raja_961's project, “Autonomous Lane-Keeping Car Using RaspberryPi and OpenCV”. (https://www.instructables.com/Autonomous-Lane-Keeping-Car-Using-Raspberry-Pi-and/)
We determined the resolution of our camera by first running the program and lowering the resolution and resizing the image until we got sufficient fps so we could check the image as frequently as possible, but we kept the resolution high enough that we could still find the track and stop signs. In the end we used an image size of 80p by 60p.
We determined the proportional gain, and derivative gain by using these equations:
derivative = kd * (error - lastError) / dt proportional = kp * error
with the error being the difference between the desired angle we want the car to be at and the actual angle it's moving at. kp scaled the amount of proportional gain added for each error past a threshold (around 13 degrees off of center), and kd scaled the derivative gain between the current error and previous error if the difference between the current and previous error exceeded a threshold of 10. A higher proportional gain makes the car turn more with each increase in error, while the derivative gain was supposed to make the turning smoother, i.e. a higher derivative gain should make the car swivel back and forth less. We determined the scaling values experimentally by comparing the error, kp, kd, and output duty cycle value between multiple runs and adjusting them until the car was able to successfully navigate the track.
We handled the stop sign by finding when the webcam saw red in at least 1/9th of the total frame, or 2/9ths of the bottom half. When it does, it stops for 3 seconds and stops checking for stop signs until it passes that one. After 3 seconds, we increase the speed back to the previous value plus some in order for the car to overcome the friction from being stopped. We also slow down the car slightly on wide turns.