A simulated visualization of the Pure Pursuit path following algorithm I implemented for the VEX Robotics competition in 2021. Using a set lookahead distance, it constantly calculates the arc necessary to return to a pre-set path, based on points inputted accordingly after running the executable. Grab the latest release here.
As this is a simulation of Pure Pursuit, the same limitations apply. It's generally required to start the robot close to the first point, and for its heading to not be in the opposite direction (negative movements are not inherently supported, and a path would have to be flipped to drive in reverse; I did this for the competition, but it isn't part of the fundamental algorithm). Additionally, excessively tight turns and precise stops likely require per-path tuning of the lookahead distance and stopping point. My plan is to allow these to be tuned in an easily understood UI, but you can simply compile the program having changed these settings for now.
After running the executable, a csv file looking like this will be created
Running render.py and entering the name of your CSV file will then allow you to visualize this as a 2D graph.
My eventual plan is to encapsulate the visualization and calculations into one interactive program, with toggleable settings for
- Lookahead distance
- Stopping point
and a rendering of it in real time
My friend Liam for letting me bounce ideas off of him, and refactoring the makefile to be multiplatform.