Memuat
Memuat
Want to go deeper?
Join one of our courses or ask us directly on WhatsApp.
Picked from the software, topic, and level of “Class Autonomous Car MPC Path Tracking #3: Reference Control: Pure Pursuit and Stanley”.
Other ways we can help with Python.
Learn with a mentor
Scheduled Simulation & Engineering courses with live guidance and a certificate.

Course/Training Ansys ~ Heat Transfer and Heat Flux Analysis
★ 5.0 (10)

Course/Training MATLAB — MATLAB App Design: The Ultimate Guide to MATLAB Apps
★ 5.0 (10)

Course/Training Ansys — Airflow Simulation of a Car Radiator with ANSYS
★ 5.0 (9)
Have it built for you
No time to learn Python? Our team can do the project for you.

Matlab Development Service — Complete Neural Signal Processing and Analysis Zero to Hero
★ 5.0 (59)

Ansys Maxwell Development Service
★ 5.0 (50)

Petrel Development Service
★ 5.0 (14)
Get notified about new Python classes
At most one email a week. Unfollow anytime with one click.
The full narration of this video. The current sentence is highlighted while the video plays; click any sentence to jump there.
This is the final result, two classic path tracking controllers, Pure Pursuit and Stanley, which make the car follow the path through lanes and turns with an error of just tens of centimeters. Both become the benchmarks for MPC later. Let's get started. Hello, welcome to episode three of the MPC Path Tracking series on autonomous vehicles. Before building MPC, good research always has a benchmark. We use two of the most popular geometric controllers. Pure Pursuit, which chases a point ahead, and Stanley, which was used by the winning car in the 2005 DARPA Grand Challenge.
Create a benchmark.py file. Speed is controlled by a simple proportional controller. Pure Pursuit selects a point on the path at a distance ahead of the car. Then it calculates the circular arc that connects the rear axle to that point. The steering angle is calculated as the inverse tangent of two L-sinus alphas divided by look ahead, with alpha being the angle between the car's direction and the target point. Look ahead is made adaptive, 3 meters plus half the speed, because at high speeds, the car must look further ahead.
Stanley works on the front axle. The steering angle consists of two parts, minus the heading error, so the car aligns with the path, and minus the inverse tangent of the lateral error divided by speed, so the car returns to the path. Dividing by speed makes the correction gentle at high speeds and firm at low speeds.
Create a test_underscore_benchmark_dot_py file and run it at 10 meters per second. On lane changes, Pure Pursuit has a lateral RMS error of 0.084 meters, and Stanley are much smaller, 0.024 meters. On the S curve, Pure Pursuit is 0.101 meters and Stanley is 0.084 meters. But Stanley pays for its accuracy with more frequent steering changes, 0.26 degrees per step compared to 0.18 for Pure Pursuit. Let's look at the graphs.
During lane change, Pure Pursuit cuts the corner because it chases the point ahead, while Stanley is more compact. The lateral error graph on the S curve shows both deviating the furthest exactly at the part of the path where the curvature changes, because both only react to the current error, without looking ahead at the upcoming curve. This weakness will be addressed by MPC.
Done. We have already built Pure Pursuit with adaptive look ahead and Stanley. Then compared them on two paths. In the next episode, we will formulate MPC, model linearization, prediction horizon, cost function, and steering constraints. Currently working on a thesis, dissertation, or research in the field of autonomous vehicles and control systems? Cerdas Inovasi Digital helps implement vehicle control systems, from bicycle model, reference path, Pure Pursuit and Stanley, up to model predictive control with CVX-Py, as well as opening Python programming courses for electrical and mechatronic engineering. Want to master the entire series, from vehicle models to complex circuit tests with various speeds? All six episodes, complete with step-by-step PDF guides and source code, are available to premium tutorial subscribers. Subscribe starting at Rp69.000 per month, save 28% with the 12-month package, or pay once Rp999.000 for lifetime access. Want just one class? Buy individual classes with lifetime access. Subscribe now at the premium page cerdasinovasidigital.com. Contact us via WhatsApp, or visit cerdasinovasidigital.com. Thank you for watching, see you in the next episode.
Type a question or keyword; we find the part of this episode that explains it and jump the video there.
Notes are saved with the current video time and are only visible to you.
Stuck on a step? Ask here; the instructor and other learners can answer.
No questions yet.

Cerdas Inovasi Digital Team
Software developers, BIM & 3D engineers, and AI practitioners
We build software, BIM models, games and AI automations for clients every day, and turn that hands-on work into step-by-step classes: every step is shown on screen and comes with a PDF guide you can keep.
See our clients →