Linear Quadratic Regulator (LQR) Solver for Furuta Rotary Inverted Pendulum.
This utility linearizes the coupled 2-DOF Furuta pendulum equations of motion
about the upright equilibrium (q2 = 0) with motor acceleration command input (u = q1_ddot),
solves the continuous Algebraic Riccati Equation (ARE), computes the state-feedback
gain matrix K, and evaluates closed-loop stability.
State vector:
x = [q1, q1_dot, q2, q2_dot]^T
where:
q1 : motor arm angle [rad]
q1_dot : motor arm angular velocity [rad/s]
q2 : pendulum angle relative to upright [rad] (q2 = 0 is upright)
q2_dot : pendulum angular velocity [rad/s]
Control law:
u = -K * x = -(k_q1 * q1 + k_q1_vel * q1_dot + k_q2 * q2 + k_q2_vel * q2_dot)