LQR Optimal Control of a Cart-Pole Under Seismic Disturbance
An LQR tuned to hold an inverted pendulum through earthquake class disturbances, benchmarked against a DQN trained from scratch in a custom earthquake augmented environment.
TYPE
Simulation · ROS 2 Jazzy + Gazebo Garden
STABILITY
9.69/10 stability metric under 15 N, 0.5 to 4 Hz
EXTRA
DQN written from scratch in PyTorch
The cart-pole holding vertical in Gazebo under seismic forcing.RViz visualization with control force and earthquake disturbance rendered live.
Overview
An inverted pendulum on a rail, shaken by 15 N seismic forcing swept across 0.5 to 4 Hz, held upright by an LQR whose weights were retuned aggressively: state costs up tenfold, control cost down tenfold.
Extra credit: a DQN built from scratch in PyTorch, trained in a Gymnasium environment modified to inject the earthquake into the dynamics and expose it as a fifth observation.
Design & Build
Control: Linearized state space model, continuous algebraic Riccati solve, and instrumentation added for scoring, termination, and plotting.
Learning: Replay buffer, target network, shaped reward, and an earthquake augmented observation space, trained over thousands of episodes.
Challenges
Balancing disturbance rejection against control effort: the aggressive weights hold the pole near vertical on roughly a third of the available control authority.
Result
9.69 of 10 on the assignment's stability metric, with cart excursion around 3 percent of the rail limit and pole deviation under a degree, as reported in the project write up. Model based control wins, and the numbers show why.