FEB Path-Following Controller

Formula Electric at Berkeley — Autonomous · 2026

Developing a Python path-following controller for a simulated race car on a cone-defined track. The controller takes the vehicle state [x, y, heading φ, velocity v, steering angle θ] and outputs acceleration and steering-rate commands [a, θ̇], using a kinematic bicycle model and feedback control with steering and acceleration constraints. Objective: a fast, safe lap with no cones hit.

Control Theory Learning

Reviewed Python and NumPy array operations, learned vehicle state representation, studied the kinematic bicycle model, and worked through open-loop vs. closed-loop feedback and PID control — then applied each concept incrementally in the simulator.

Kinematic bicycle model
Kinematic bicycle model
The cone-defined track and initial car pose
The cone-defined track and initial car pose
Feedback control notes
Feedback control notes

Learning Simulation

Built a small timestep simulation to teach myself the fundamentals: start with a known state, apply a control, calculate the state derivatives, advance by dt, repeat. The first controller computed a desired heading toward a target with atan2 and used proportional feedback on the heading error — which worked, but caused the car to loop around the target with no way to correct lateral error.

Spiralling into the target
Spiralling into the target
Unstable gain
Unstable gain
Point-toward-target controller
Point-toward-target controller

From Target Tracking to Path Tracking

Sampled the track centerline, found the closest centerline point to the car, computed the track direction and a signed lateral error (being 5 m away is not enough — you need to know which side of the track you're on), and combined it with heading error: θ̇ = K_heading · e_heading − K_lateral · e_lateral. Tuning the two gains is what keeps the car off the cones.

Closest-point and lateral error
Closest-point and lateral error
Early path tracking — oscillating around the centerline
Early path tracking — oscillating around the centerline

Current P Controller

The current controller follows the centerline cleanly around the full track. Next steps: better speed control, measuring lap time, and moving from a P controller to full PID.

Car trajectory vs. centerline
Car trajectory vs. centerline
Tuned heading + lateral controller
Tuned heading + lateral controller
Back to top