The track which the car needed to navigate. My team and I achieved a lap time of 32.4 seconds (just 1 second behind the 8-year time record).
Some of the code snippets I wrote below:
A launch file I wrote that my team used to speed up the testing process. What took us up to 30 minutes due to poor connection and long configuration time, was shortened to just 5 minutes.
This is the main control loop for the vehicle. As can be seen, a geometrical calculation is done to triangulate the position of the vehicle using LiDAR feedback. Part of the constraint of this project was to use the given workspace to allow the car to function. Several ROS nodes were setup to report LiDAR and other diagnostic data. The PI controller logic is also present. This was the main loop that allowed the car to run and self-correct. Personally I developed the triangulation algorithm and tuned the PI controller to allow for smooth driving.
As seen below the PID of the racecar works very well (though this was not the fastest run, it was the fastest run that we recorded on video). The car moves in a very wavy pattern during the long hallway because the algorithm follows placed waypoints on a predefined map, there is a high concentration of them around the corner to slow the car as the current version of the code adjusted the acceleration based on the length of the path. However the corners are cut very smoothly and besides the unexpected chair in the path at the end, the car was able to complete the race without any collisions. The main limiter for speed that we had hit was in processing speed of the microcontroller being used, any acceleration above what was shown would immediately delocalize the car, so the acceleration of the vehicle was tuned quite well given the system specs of the car. Given additional development time, I would implement a predictive learning-based improvement to the controller. The idea is to estimate the vehicle’s future position based on velocity and heading, compare it against the desired trajectory, and back-propagate the resulting error into the PID gains. Over multiple iterations, the controller would learn how acceleration should be adjusted before entering curves, reducing oscillations and wobbling, and allowing for higher stability overall.
Of course there was a fair share of failures as well.