← Back to projects

MPC Trajectory Tracking & Roll Avoidance

A real-time nonlinear model-predictive controller that plans and tracks trajectories for a three-wheeled autonomous pod, keeping it stable at the edge of vehicle dynamics. Structured and unstructured local planning, closed-loop in the CARLA simulator.

NMPCRoll Avoidance Vehicle Dynamicsacados CARLAMotion Planning

Plan a path, respect the vehicle

The vehicle

A tadpole pod

A lightweight three-wheeled vehicle — two steered wheels at the front, one at the rear. Its narrow track and single rear contact patch make grip and rollover the central stability concern, so the controller has to plan against those limits directly.

The problem

Safety at the edge

Track a planned path accurately while staying inside tire grip, steering and force limits, and — critically — a lateral-acceleration envelope that keeps the pod from tipping. Every constraint is re-evaluated at a 20 ms control rate.

The approach

Plan, then optimize

A local planner proposes a drivable path; the NMPC optimizes steering and longitudinal force over a short horizon to follow it, subject to the friction and roll limits; an allocation layer maps the result onto the vehicle.

Where the lateral-acceleration limit comes from

The NMPC never reasons about rollover directly. Each step it consumes a single scalar — the limiting lateral acceleration \(a_y^{\lim}\) — and enforces it as a heavy Soft constraint on the predicted motion. That scalar is produced by a standalone geometry-based roll-avoidance algorithm that treats the pod as a rigid body and works from its wheel geometry plus a live estimate of the center of gravity.

The tipping axis

Not a symmetric base

On a tadpole the support polygon is a triangle — two front contact patches, one at the rear. In a turn the pod rolls about the line joining the outer front wheel to the single rear wheel: a diagonal axis, not the vehicle centerline.

Rigid-body model

Static threshold

Suspension compliance and transient load transfer are set aside; the limit is the steady rigid-body point at which the weight vector reaches the tipping axis. It is conservative and cheap enough to recompute inside the control loop.

Live CG

Inertial sensing

Inertial sensors track dynamic in-plane migration of the CG, so the moment arm reflects the current load state. Because the pod is loaded from the top in a fixed configuration, CG shifts along the vertical (Z) axis are held constant and ignored.

top view tipping axis d CG a_y t_f L rear view (banked) φ CG h mg a_y
Tadpole tipping geometry — the roll axis runs from the outer front contact patch to the single rear wheel; \(d\) is the perpendicular distance from the CG to that axis and \(h\) its height above the road plane. Original schematic.

On flat ground, rollover impends when the overturning moment from the lateral inertial force acting at CG height \(h\) equals the restoring moment of the weight acting at the moment arm \(d\). Setting \(m\,a_y\,h = m\,g\,d\) and resolving \(d\) for the tadpole geometry gives:

flat ground — rollover threshold
\[ a_y^{\lim} \;=\; \frac{g}{h}\,d \;=\; \frac{g}{h}\cdot\frac{\tfrac{t_f}{2}\,b}{\sqrt{L^{2}+\left(\tfrac{t_f}{2}\right)^{2}}} \;\approx\; \frac{g\,t_f\,b}{2\,h\,L} \]

The \(b/L\) factor is what separates the tadpole from a symmetric vehicle: as the CG migrates toward the single rear wheel (\(b\to 0\)) the margin collapses, while a CG near the wide front track (\(b\to L\)) recovers the full \(g\,t_f/2h\) limit. Road configuration then reshapes the balance — a favorable bank angle \(\phi\) contributes a restoring gravity component, while a grade \(\theta\) reduces the effective normal load:

banked & sloped road — road-plane balance
\[ a_y^{\lim} \;=\; g\,\cos\theta\left(\frac{d}{h}\cos\phi \;+\; \sin\phi\right) \]

The same rigid-body construction is evaluated for flat, sloped, and banked surfaces, and the tightest limit for the current road configuration is handed to the NMPC as \(a_y^{\lim}\). The road-configuration treatment follows the rigid-body rollover analysis in “Rollover Stabilities of Three-Wheeled Vehicles Including Road Configuration Effects.”

Note: the equations above are the standard rigid-body rollover relations, derived here for the tadpole tipping axis — not reproduced from the reference. The paper is cited for its flat/slope/banking road-configuration framework.

The rest of the stack

🎯

Pose-tracking NMPC

An 11-state predictive controller tracks cross-track error, heading, and speed directly, re-solving a constrained optimization every control step in real time with acados / SQP.

acadosSQPCasADi
⚙️

Friction-ellipse tire model

A combined-slip model couples lateral and longitudinal forces, with per-wheel constraints that keep every tire inside its friction ellipse — grip honoured alongside the roll limit.

Combined slipFriction circle
🧭

Two local planners

A Frenet lattice for structured lane-keeping and overtaking, and a Hybrid A* search for unstructured obstacle fields and tight maneuvers — both feeding the same NMPC through one path interface.

FrenetHybrid A*
📉

Offset-free longitudinal

A disturbance observer estimates unmodeled road load and feeds it back, so speed tracking stays accurate despite plant/simulator mismatch.

Disturbance obs.Speed tracking

Running in CARLA

Closed-loop demos with the live telemetry dashboard — the pod tracking its planned path in CARLA next to real-time plots of speed, steering, curvature, tracking error, and per-wheel friction utilization.

Live telemetry & CARLA — speed, steering, curvature, tracking error, and the friction circle as the pod drives. 
Tracking through curves — the planned path and per-wheel friction utilization as the pod corners. 
CARLA closed-loop telemetry: speed tracking, curvature tracking, steering, lateral acceleration within limits, longitudinal force decomposition, and disturbance estimate over a 50-second run.
50 s closed-loop run at a 9.0 m/s target — speed, curvature, and steering tracking with lateral acceleration held inside the ±3 m/s² envelope.
±3 m/s²
lateral accel
20 ms
solve + control
11
model states
50 s
closed-loop run
← All projects Download Résumé