Presets
Playback
Control mode
Plant: pendulum, arm, motor
Controller
Sensing and loop
Start condition
Disturbances
Camera
Layers
Quality
Model check
The science
The device
A Furuta pendulum (1992) is a horizontal arm driven by a motor about a vertical axis, with a rod hinged at its tip. The rod can swing freely in the plane perpendicular to the arm. Only the arm is actuated, yet the page must control two angles: this is an underactuated system. It is a classic test bench for nonlinear control.
Equations of motion (Lagrange)
With arm angle theta, rod angle alpha measured from upright, arm length r, rod mass m, centre distance l and pivot inertia J = m l^2 + I_c:
(J0 + m r^2 + J sin^2 a) theta'' + m r l cos a alpha'' = tau - c_t theta' - J sin 2a alpha' theta' + m r l sin a alpha'^2
m r l cos a theta'' + J alpha'' = (J/2) sin 2a theta'^2 + m g l sin a - c_a alpha'
The page integrates these exactly (RK4, 1 ms) with no small-angle approximation. The motor gives tau = K_m (V - K_b theta') / R, limited by the supply voltage, so the available torque falls as the arm speeds up (back-EMF).
Swing-up by energy shaping
The rod energy relative to the upright rest state is E = J alpha'^2 / 2 + m g l (cos a - 1) and its rate is dE/dt = - m r l cos a alpha' theta'' (centripetal term neglected). Choosing the arm acceleration theta'' = - k (E_ref - E) sign(alpha' cos a) with E_ref = 0 pumps energy while the rod is below the horizontal and removes it above, so the orbit approaches the separatrix (the dashed green curve in the phase portrait) and the rod arrives slowly near the top. The acceleration command is turned into a voltage with the arm inertia, plus a weak centring spring so the cable does not wind up. This is the Astrom-Furuta strategy.
Balance by LQR
Linearising about the upright state gives x' = A x + B V with x = (theta, alpha, theta', alpha'). The controller V = -K x minimises integral (x'Qx + R V^2) dt; K = R^-1 B' P where P solves the algebraic Riccati equation A'P + PA - P B R^-1 B' P + Q = 0. The page solves it live by integrating the Riccati differential equation to steady state. A heavier weight on alpha gives a stiffer, faster loop but needs more voltage and is less tolerant of delay.
Switching
LQR takes over when the measured angle is inside the catch window and the rod is slow. If the rod leaves 43 degrees it falls back to swing-up. The unstable pole is near sqrt(m g l / J) (about 8 per second here): any delay approaching a tenth of a second destroys balance, which you can test with the delay slider.
Sensors
The controller sees only quantised encoder angles (counts per revolution) and velocities from a filtered backward difference at 1 kHz, as a microcontroller would compute them. Coarse encoders and low filter cut-offs add the phase lag and noise that make real balancing hard.
Numerical checks on this page
(1) Unforced, frictionless nonlinear motion must conserve kinetic plus potential energy. (2) A 1 milliradian tilt evolves identically in the nonlinear model and in the linearised matrices used by LQR. (3) The Riccati cost-to-go x0'P x0 equals the time integral of the cost along a simulated linear closed loop, and the Riccati residual vanishes. (4) The hanging rod with the arm locked has period 2 pi sqrt(J / (m g l)).
Honest simplifications
The rod is a uniform thin rod; there is no gearbox backlash, Coulomb friction, motor inductance or current limit other than the supply voltage; the arm angle is unwrapped and unlimited (real benches limit it with a cable). Parameters are a plausible benchtop set, not a specific commercial unit. Sensor noise is only quantisation.