Autonomous RC Car Achieves Top Speed Using Racing Lines

Students generate optimal race lines to steer autonomous RC car to its fastest lap.

Racing lines may not be a familiar term to everyone. However, they are the imaginary lines a driver would follow on a race track to achieve the best theoretical lap times. They are sometimes shown in video games or racing simulators and guide racers through turns at the largest possible radius. Taking corners at a larger radius will generally allow a racer to maintain a higher velocity throughout the turn. A team of students from the University of Waterloo decided to take this approach and implement it on an autonomous RC car to determine the how fast they can make the car complete laps around different tracks.

To begin, the students have access to a F1TENTH car through their research lab at the university. The F1TENTH is a 1/10th scale racing car that serves as a platform for autonomous driving research. It is also quite expensive due to the integrated electronics. The autonomous driving is accomplished through a combination of an onboard NVIDIA Jetson NX computing platform, a Hokuyo 10LX Lidar, an Intel RealSense D3451i depth camera, and a VESC 6 MkV motor controller. Collectively, the platform amounts to more than $5,000 in hardware.

F1TENTH car used for project (📷: stevengong.co)

To begin determining the optimal racing lines to implement on the RC car a location was first chosen. This happened to be the 5thfloor of a university lab building. Next, using the Lidar and slam_toolbox, a software tool box for helping map out environments, the floor pan was mapped out and generated. This forms a grey and white image that closely resembles the floor plan of the building. Once completed this image is then edited with photo shop to create something that more closely resembles a race track. This includes eliminating halls or entry ways that will not be used and possibly rounding out corners. The final steps is where the brilliant engineering emerges. A Euclidean Distance Transform is then performed on the image followed by a skeletonized algorithm. The result is a center line that routes around the photoshopped course.

Once the centerline is extracted, an additional algorithm was written to make racing lines. This is an optimization algorithm that uses the center line and width of the mapped out course to determine the best path to take to achieve the shortest lap times. The output from this algorithm is in the form of a csv file with each row containing a tuple of values. These include the x and y position values and a third value of velocity. As a result, the csv file now contains the coordinates of the route to take along with a velocity profile which details when and where to speed up and slow down.

An optimal race line overlaid on the generated floor plan (📷: stevengong.co)

The students created a video demonstrating the car in action zooming its way through the halls it used as a test track. They detail their experience working on the project as well as working through some of the issues encountered. That includes the car overshooting turns, the car oscillating while driving, and improving some of the mechanical features of the car which were keeping it from achieving peak performance. The video is quite entertaining and also features many of the crashes recorded while working to get the best performance from the autonomous car.


MrT0b0r

I am currently a RF/Wireless engineer and like all things electrical engineering related.

Latest Articles