Balance with a state model
What changes when position and pole angle have different costs?
Try it in the current lab
Pin this run, raise Q angle, and see how much extra force protects upright balance.
Tune Q position, Q angle and R force. Compare position recovery, pole angle and force after the same kick.
The lab recalculates after a setting changes. Pin a run before changing one variable; the response and control-effort plots share the same replay time. PID experiments also show the P/I/D terms; estimator experiments show measured and estimated states.
What the system is doing
Discrete LQR computes a gain from the upright linear model and Q/R weights, then applies it to the nonlinear plant. It assumes the full state is available.
Connect the design method
The lab linearizes around the upright equilibrium, discretizes at 20 ms, computes K from Q/R, then applies u = −Kx to the nonlinear cart-pole. This exercise grants access to all four true states; a physical system would need sensors or an observer.
x = [cart position, speed, pole angle, pole rate]; u = −Kx