Software apps and online services
For ELEC 424, our final project was to program our beagle bone black to autonomously navigate a track made out of blue tape. Our car, named FATBB (Short for Freddy, Alan, Teddy, and Ben's Baby) should stay within the lanes of the track and recognize stop signs. At the first stop sign, FATBB will stop for a few seconds and then continue; at the second stop sign, FATBB will stop completely.
We connected a webcam to the beagle bone and used the OpenCV library in order to achieve color and edge detection. We also implemented a PD controller so that our steering is smooth. This project was a great way to put together a lot of the topics that we learned throughout the semester.
In order to process images quickly enough for our car to react, we had to decrease the resolution of the camera. We did this via the resize function and we lowered the resolution to 100 x 75 which was a sweet spot that gave us enough processing speed as well as image quality.
In order to implement the PD controller, we had to tune our gain coefficients for both proportional and derivative control. We started with our kd value at 0 and began increasing our kp by.1 from.5 to 2. We also tried kp values significantly larger at 3, 3.5, 5, and 8. Increasing Kp would increase our responsiveness but would lead to a lot of overshoot. In addition since our board couldn't process images from the camera quick enough we also had to limit the speed of the car during each run. regardless of Kp and Kd values if the car was moving too fast, our PD controller wouldn't get enough information to keep the car on the track smoothly. We modified Kd until there was less overshoot and smoother turning. We ended up with a Kp value 2.5 and Kd value of.4.
The stop sign was a piece of construction paper on the track. In order to recognize the stop signs, we took one in ten frames from the camera, converted them to HSV, and isolated the pixels within the red color range. We then checked to see if there is enough red to be considered a stop sign. If there was and we had not yet seen a stop sign, FATBB takes a 3-second nap, then wakes up and restarts the lane-keeping algorithm. If there was enough red to be considered a stop sign and we have seen a stop sign before, FATBB takes a nap indefinitely.
One feature that we implemented was a "kill switch" for FATBB. We used a push-button to send a signal to the beagle bone when we want FATBB to stop running. This helped facilitate testing because when the kill switch was pressed, the ESC and servo were a 7.5% duty cycle, minimizing ESC initialization errors.
Below we have two plots showing our error vs Proportional and Derivative response and our error vs steering and drive pwm settings.
Self-driving car demo video. Car temporary stops on the first red sign and comes to a complete halt after the second stop sign.
User raja_961, “Autonomous Lane-Keeping Car Using RaspberryPi and OpenCV”. Instructables. URL:https://www.instructables.com/Autonomous-Lane-Keeping-Car-Using-Raspberry-Pi-and/