~ / projects /

Controllers for Buggy Racing

Buggy, properly Sweepstakes, is a CMU race in which small aerodynamic vehicles are pushed uphill by runners and coast the downhills on gravity alone, reaching around 35 mph. There is a person inside steering.

Satellite view of CMU's Schenley Park with the Sweepstakes course traced in blue, and a short orange segment marking the start.
The Sweepstakes course through Schenley Park.

This project, for CMU 24-677 (Modern Control Theory), asked what happens when the person is replaced by a controller. The buggy was modeled with bicycle dynamics, lateral and longitudinal, and driven around a Webots simulation of the course. Five controllers were built in order of increasing capability, each addressing a specific way the previous one lost time.

Flowchart of the simulation loop: main.py loads the trajectory and constants, then a controller loop repeatedly calls the custom controller's update method, sets commands, and records states until the finish.
The simulation loop: each controller issues commands to Webots and receives the buggy's state back every step.

Results

ControllerLap timeWhat changed
PID330 sSeparate longitudinal and lateral loops, tuned by hand.
State feedback, pole placement200 sUses the full state vector rather than tracking error alone, with closed-loop poles placed for damping.
LQR120 sOptimal gains from the Riccati equation, trading state error against control effort.
MPC120 sOptimizes over a receding horizon, so track constraints enter the control problem directly.
EKF-SLAM160 sSame control quality without being given the map or its own pose.

The first three steps are the interesting part of the progression. Hand-tuned PID loses time everywhere, because the two axes are tuned in isolation and neither knows what the other is doing. Pole placement recovers most of that by treating the buggy as one coupled system. LQR goes further by computing the gains rather than guessing them: the largest single improvement in the set, and close to halving the lap.

PID block diagram: the error between set-point and feedback feeds proportional, integral and derivative terms that are summed into the control signal for the process.
PID (330 s): proportional, integral and derivative terms on a single error signal, tuned by hand.
The LQR cost functional: a terminal cost plus the integral of x-transpose Q x plus u-transpose R u plus a cross term.
LQR (120 s): gains chosen to minimize a quadratic cost on state error and control effort.

MPC matched LQR rather than beating it. On a fixed, known course with a well-behaved model, there is little left for a receding horizon to exploit; its advantage is handling constraints and disturbances, and this track presents few of either. It would be expected to pull ahead on a course with tighter limits or a less cooperative model.

MPC block diagram: reference tracking provides Y-ref and psi-ref to model predictive control, which outputs steering angles and yaw moment to a nonlinear tire model and a linear vehicle model, whose outputs feed back.
MPC (120 s): the controller predicts the vehicle's response through tire and vehicle models over a receding horizon.

Racing without a map

The last controller solves a harder problem than the other four. EKF-SLAM builds the map and estimates the buggy’s pose within it at the same time, so the controller steers against an estimate that is itself uncertain, rather than against ground truth handed to it by the simulator.

Grid of eight time-series plots from an EKF-SLAM run: the estimated trajectory, velocities, heading, steering, distance error and force over about 160 seconds.
An EKF-SLAM lap: the estimated path (top left) and the state and control histories over the run.

Why 160 s is not a regression. Read as a single column, EKF-SLAM looks slower than LQR’s 120 s. It is the cost of dropping the assumption that the vehicle knows where it is, which is exactly the assumption that has to go before any of this can leave the simulator.

  • Controls
  • Planning
  • Simulation