PID vs LQR on a Balancing Cart | Watch the Pole and the Wheels
A balancing cart must control both pole angle and cart travel. The same disturbance lets you compare how a PID cascade and a linear quadratic regulator trade one goal against the other.
The key idea
LQR uses a state model that includes cart position and velocity together with pole angle and angular velocity. In a cascade, an outer loop can request a tilt correction that an inner loop tracks. Plotting both position and angle reveals a cart that stabilizes its pole while drifting away.
What to remember
- Use the same initial state and disturbance for both controllers.
- Inspect cart position as well as pole angle.
Check your understanding
Why can a near-zero pole angle be a misleading measure of overall performance?
Show the explanation
The cart can keep the pole upright while moving far from its target position.