Skip to main content
Back to Portfolio ProjectsBhavya Gupta · Case Study
AI / ML

Action-Conditioned World Models & Predictive Control

Neural dynamics rollouts powering real-time, constraint-safe Model Predictive Control for autonomous driving in MetaDrive.

80.0%

Unseen Seeds Success

vs 20.0% Stanley PID baseline

88.1%

Route Completion

vs 55.8% Stanley PID

0.0%

Traffic Collision Rate

with explicit safety constraints

56.0 ms

CPU Planning Latency

well below 100 ms (10 Hz) real-time cap

Top-down closed-loop MPC rollout in MetaDrive simulator

Closed-loop MPC top-down rollout on procedural curve map SC.

The Problem

Autonomous driving controllers have to anticipate how steering and throttle compound over multi-second horizons without leaving the road or colliding. Purely reactive controllers struggle on unseen curves, while open-loop neural rollouts accumulate quadratic drift.

What I Built

Built an end-to-end world-model and receding-horizon MPC framework in PyTorch and MetaDrive. Trained a body-frame neural dynamics model on offline driving trajectories and paired it with a 10 Hz sampling MPC planner enforcing four explicit safety constraints.

Technical Architecture

At each 0.1s control step, the ego dynamic state [v_long, v_lat, yaw_rate, steering] is rolled forward across N=256 temporally smoothed candidate action sequences over H=10 steps via a 3-layer SiLU MLP predicting local deltas, then filtered through hard safety constraints before applying u_0*.

01

Ego Body-Frame State

Extracts [v_long, v_lat, yaw_rate, steer] invariant to global map rotation.

02

Batch World-Model Rollout

3-layer SiLU MLP (256 units) rolls out N=256 trajectories for H=10 steps on CPU.

03

4 Explicit Safety Filters

Road boundary margin, 14 m/s speed cap, 3.5 m obstacle clearance, 6 s⁻¹ steer rate.

04

Receding-Horizon MPC

Selects min-cost feasible sequence at 10 Hz (56 ms/step) with braking fallback.

Verification & Key Takeaways

  • 1-step position error of 0.022 m (2.2 cm) and 0.12° heading error across 686 held-out transitions.
  • Explicit safety constraints halved out-of-road incidents in traffic (40.0% → 20.0%).
  • Includes failure-case diagnostics across unseen roundabouts, T-junctions, and dense traffic.
PyTorchMetaDrive SimulatorGymnasiumModel Predictive ControlNumPyPytest