Skip to content

Add iLQR path tracking - #295

Draft
guptuv wants to merge 6 commits into
ShisatoYano:mainfrom
guptuv:add-ilqr-path-tracking
Draft

guptuv wants to merge 6 commits into
ShisatoYano:mainfrom
guptuv:add-ilqr-path-tracking

Conversation

@guptuv

@guptuv guptuv commented Nov 25, 2026 •

Copy link
Copy Markdown
Contributor

Summary

Adds iLQR (iterative Linear Quadratic Regulator) path tracking (Li & Todorov 2004; Tassa et al. 2014) as section 10.5 of the Optimal Control chapter, after LQR, MPC and MPPI.

State [x, y, yaw, v], input [accel, steer], kinematic bicycle model, 20 step horizon (2 s). Each cycle it rolls out the nonlinear model, linearizes it around the rollout with analytic Jacobians, solves the LQR backward pass (with regularization), and updates the inputs with a line search. Inputs are clamped, the yaw error is wrapped, and the solution is shifted to warm start the next cycle. The predicted trajectory is drawn.

Files

  • src/components/control/ilqr/ilqr_controller.py
  • src/simulations/path_tracking/ilqr_path_tracking/ilqr_path_tracking.py: same course as lqr_path_tracking, so the two can be compared directly
  • test/test_ilqr_path_tracking.py: smoke test
  • doc/optimal_control/index.md: adds 10.5
  • pyrightconfig.json, .devcontainer/devcontainer.json: regenerated

Closes #292

How I checked it works

  • Uses only numpy and matplotlib (no casadi or do-mpc), so the whole algorithm is readable in one file.
  • Headless comparison on the same course: mean lateral error 0.29 m with iLQR vs 0.91 m with LQR, and the final error is 0.06 m. The largest error (about 2.8 m) is at the tightest turn, where the 30° steering limit is active.
  • Ran the simulation headless (show_plot = False) and as an animation, and looked at the GIF below.
  • Also ran the whole change in a Google Colab notebook (fresh clone, new files, pytest).

Images

iLQR path tracking demo

@ShisatoYano

Copy link
Copy Markdown
Owner

Thank you, @guptuv! As I wrote in #294, let's review your four PRs one at a time, starting with DWA (#294). Could you convert this one to a draft for now? I'll come back to it after #294 is merged. It isn't a rejection: the proposal fits the book, and the order is only about review time.

🤖 Generated with Claude Code

@guptuv
guptuv marked this pull request as draft November 25, 2026 15:19

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Proposal: iLQR path tracking (Optimal Control chapter)

2 participants