Linearize a discrete simulator in tangent coordinates.
Compute and validate a discrete LQR controller.
Distinguish local regulation from trajectory optimization.
Prerequisites: Linear algebra, ODEs, and earlier lectures in this sequence.
Local coordinates around a reference
Let (q⋆,v⋆,u⋆) be an equilibrium. Construct a small error δx=(δq,δv) with δq in the nv-dimensional configuration tangent space. For a free body, this gives twelve error coordinates rather than thirteen raw position-plus-velocity entries. Actuator activation adds na more entries when present.
Linearizing the actual sampled dynamics gives
δxk+1=Aδxk+Bδuk.
MuJoCo's mjd_transitionFD provides discrete transition derivatives for supported integrators. The teaching examples use Euler and direct actuators. Check the nominal step first: a non-equilibrium reference creates an affine residual that this equation otherwise hides.
Discrete LQR
Minimize the infinite-horizon cost
k=0∑∞(δxk⊤Qδxk+δuk⊤Rδuk).
With R≻0 and the usual stabilizability/detectability assumptions, the stabilizing Riccati solution satisfies
P=Q+A⊤PA−A⊤PB(R+B⊤PB)−1B⊤PA.
Then K=(R+B⊤PB)−1B⊤PA and δu=−Kδx. Use a linear solve. Check the eigenvalues of A−BK and test nonlinear rollouts from several initial errors. A Riccati solver returning an array is not itself a validation.
Worked scalar problem
For xk+1=xk+uk with Q=R=1, the Riccati equation reduces to P2−P−1=0. The positive solution is (1+5)/2. Therefore K=P/(1+P)≈0.618, and the closed-loop multiplier is about 0.382. This small case provides a unit test for the implementation.
Cart-pole and quadrotor
Practice 3 linearizes a cart-pole at its upright equilibrium and a full free-joint quadrotor at hover. Both use the same feedback pipeline. Quadrotor orientation error uses MuJoCo's quaternion convention and tangent difference. Thrust limits introduce nonlinear behavior that LQR does not enforce during design. Large initial tilts require a different reference or nonlinear planning.
Beyond equilibrium
For a trajectory, linearize along (xk⋆,uk⋆) and run a finite-horizon Riccati recursion backward to obtain time-varying gains. To find the reference itself, optimize controls by shooting through the dynamics or optimize both states and controls with transcription constraints. CMU's index and MIT's notes develop these directions CMU 16-745 indexMIT trajectory optimization.
Exercise: Double a position coordinate's numerical scale without changing its physical meaning. How should its diagonal Q entry change? Divide it by four to preserve the same cost. This is why units and normalization belong in the experiment configuration.
Reading and source connections
Optimal Control 16-745 — lecture index — Zachary Manchester and CMU course staff. Topic-level connection to discretization, LQR, MPC, trajectory optimization, rotations, and learning.
Linear Quadratic Regulators — Russ Tedrake. Read the LQR derivation and local stabilization discussion; translate configuration errors into MuJoCo tangent coordinates.
Trajectory Optimization — Russ Tedrake. Compare shooting and transcription; the course uses small Python examples before large robot optimization.