Iterative linear quadratic regulator (iLQR)
iLQR finds the acceleration and steering sequence that takes a car from rest to a goal pose, stopped there, with as little control effort as possible. It starts from a car that does nothing and improves the whole trajectory at every iteration.
Algorithm
Each iteration:
Linearise the car model around the current trajectory, with analytic Jacobians.
Solve the resulting linear-quadratic problem backwards in time. Every step gets a feedforward change \(k_t\) and a feedback gain \(K_t\):
Roll the corrected controls forward through the real, nonlinear model, halving the step size \(\alpha\) until the cost goes down:
Adapt the regularisation of the value function’s Hessian: smaller after a successful step, larger after a failed one.
The first iteration never steers: at rest, the linearised car cannot turn, so the first improvement only drives straight ahead.
Code Link
- PathTracking.ilqr.ilqr.ilqr(start: ndarray, us: ndarray, on_iteration: Callable[[ndarray, list[float]], None] | None = None) tuple[ndarray, ndarray, ndarray]
Optimise the controls us (T, 2) from start. Returns the states (T + 1, 4), the controls, and the cost after each accepted iteration.
Standalone project and report
This algorithm is also published as a standalone project, robofan45/ilqr-trajectory-optimization, with an installable package, tests that run on Linux, macOS and Windows, and an IEEE-style technical report (PDF) with measurements and a full bibliography.
Reference
W. Li and E. Todorov, “Iterative Linear Quadratic Regulator Design for Nonlinear Biological Movement Systems”, ICINCO, 2004
Y. Tassa, T. Erez and E. Todorov, “Synthesis and Stabilization of Complex Behaviors through Online Trajectory Optimization”, IROS, 2012