← ⚙️ Engineering

⚙️ LQR Regulator

gain k₁
gain k₂
Position x₁:
Velocity x₂:
Control u:
Cost so far J:
FPS:
Drag — rotate · Scroll — zoom

⚙️ State-Space Control and LQR

A mass sliding on a frictionless rail is regulated back to rest by an optimal LQR feedback controller, while a linked 3D plot extrudes the live state (position, velocity) forward through time as a spiral that collapses onto the origin.

🔬 What It Demonstrates

The controller solves the continuous algebraic Riccati equation in real time from your Q and R weightings, deriving the feedback gains k₁, k₂ that minimise a trade-off between state error and control effort.

🎮 How to Use

Raise Q₁ or Q₂ to penalise position or velocity error more heavily, raise R to make control effort more costly, and set the initial offset x₀ — then watch the gains, the rail mass, and the state-space spiral respond together.

💡 Did You Know?

LQR was formalised by Rudolf Kálmán in the early 1960s and, alongside the Kalman filter, became foundational to the Apollo guidance computer and nearly every modern autopilot.