← Visualization Hub · Step 14 · cart–pole block (13 → 14)
Cart–Pole Inverted Pendulum — Nonlinear Dynamics, LQR & Swing-Up
Governing Differential Equations (rigid rod, pivoted on a driven cart)
$$\begin{aligned}
(M+m)\,\ddot{x} \;+\; m\,l\,\ddot{\theta}\cos\theta \;-\; m\,l\,\dot{\theta}^{\,2}\sin\theta \;+\; b_c\,\dot{x} &= u\\[2pt]
\tfrac{4}{3}\,m\,l^{2}\,\ddot{\theta} \;+\; m\,l\,\ddot{x}\cos\theta \;-\; m\,g\,l\sin\theta \;+\; b_p\,\dot{\theta} &= 0
\end{aligned}$$
$$\dot{\mathbf{z}} = f(\mathbf{z},u),\quad
\mathbf{z}=\begin{bmatrix}x & \dot{x} & \theta & \dot{\theta}\end{bmatrix}^{\!\top}
\;\xrightarrow[\ \theta\approx 0\ ]{\text{linearize}}\;
\dot{\mathbf{z}} = A\mathbf{z} + Bu,\qquad u = -K(\mathbf{z}-\mathbf{z}_{\text{ref}})$$
Two coupled nonlinear second-order ODEs, one actuator, four states — the classic underactuated benchmark.
\(\theta\) is measured from upright, so \(\theta = 0\) is an unstable equilibrium (a saddle in the
phase plane): without feedback every trajectory leaves it. Drag the pole or the cart to set an initial condition,
kick it, and watch the LQR feedback law \(u = -K(\mathbf{z}-\mathbf{z}_{\text{ref}})\) hold the state at the saddle.
← First see the same plant with u = 0
Status
—
Control
LQR balance
Swing-up
Pause
Nudge (5 N·s)
Hard kick
Reset
LQR weights
Plant parameters (SI)
Readouts
Display
Pole field
Phase trail
Linear-model ghost
Presets
Balance from tilt
Swing-up from hanging
Cheap control (R small)
Lazy control (R large)
Heavy pole
Read it like a control engineer: the open-loop plant has a pole in the right half-plane —
that single positive real eigenvalue is the pole falling over. With little pivot friction it sits near
\(+\sqrt{3g/4l}\), a bit above it because a free cart slides out from under the pole;
wind \(b_p\) up and it drops well below that. The pole map shows the real
value, whatever the sliders say. Feedback moves it left. Raise \(q_\theta\) and the closed-loop poles march deeper
into the left half-plane (fast, aggressive, more force); raise \(R\) and they drift back
toward the imaginary axis (gentle, slow, eventually too slow to catch the fall). The linearization is only
valid near \(\theta = 0\) — turn on the ghost and tilt hard to watch it lie.
Nonlinear plant (what actually happens)
Linearized model ghost / open-loop poles
Control force \(u\)
Closed-loop poles