D3 · Lesson 10 · Capstone
Why a stick balanced upright falls exponentially and why short sticks are harder to balance, catching it by accelerating the cart with angle feedback, why angle feedback alone lets the cart run away, and a full-state controller designed by pole placement and tested on the nonlinear pendulum
Balancing a broomstick on your palm is the classic control problem: the stick is unstable, so doing nothing means it falls, and you catch it by moving your hand under it. A Segway, a rocket on its exhaust and a walking robot all solve the same problem. It brings together every idea in this course: an unstable pole, feedback that moves it, damping to stop the swinging, the state-space view that keeps the cart from wandering off, and a simulation to check that a design based on a linear model works on the real, nonlinear system.
- A pendulum of length L standing on a cart, near upright. Without control its angle obeys , so it falls exponentially at rate .
- The cart accelerates by , moving under the pendulum as it leans. The arrows show how angle and angular velocity evolve from each point.
- With below g (9.81 m/s² per radian), no amount of damping saves it. Above g, the upright position becomes a stable spiral or node.
Predict
Without control, a pendulum 1 m long falls away from upright with its angle growing as . How long does its angle take to double? And for a 25 cm pendulum?
The growth rate is = 3.13 s⁻¹, so doubling takes ln 2/3.13 = 0.22 s. A quarter of the length doubles the rate to 6.26 s⁻¹ and halves the time to 0.11 s. That's why a long broomstick is easier to balance than a pencil: the controller has more time.
Name it
The unstable plant
Linearized about upright, with the cart's acceleration a as the input,
with poles at : one in the right half plane.
Angle feedback
Accelerating the cart toward the lean, , gives
stable when and , with and . But nothing in this law cares where the cart is, so the pendulum stays up while the cart drifts off at constant speed.
Full-state feedback
With the state , feedback on all four places all four poles (lesson 9), so the cart returns home too. The gains come out with a surprising sign: to move the cart left, the controller first moves it right, tipping the pendulum left so that it can follow. Systems with this "wrong-way" start are hard to control quickly.
Linear design, nonlinear check
The gains are designed on the linearized model, then tested on the full equation . Near upright they agree; far from it the linear design eventually fails.
Worked example
A 0.5 m pendulum is controlled with = 20 m/s² per radian and = 4 m/s per radian per second. What are its natural frequency and damping?
Show the solution
- Natural frequency.
- Damping.
- What that means. It's a well-damped catch, but the cart will drift.
Answer = 4.51 rad/s and ζ = 0.886.
Worked example
The full-state design in the Python step places the poles at −3, −4 and −5 ± j2 for L = 0.5 m. How does it do?
Show the solution
- Gains. Ackermann's formula gives
- From 0.2 rad. The nonlinear pendulum is upright and the cart home within 5 s, with peak cart acceleration 14.8 m/s².
- Larger starts. The same gains recover from 0.7 rad (40°) but not from 0.9 rad, where the linear model is too far from the truth.
Answer from 0.2 rad it balances and brings the cart home within 5 s, peaking at 14.8 m/s², and it recovers from 0.7 rad but not from 0.9 rad.
Worked example
Without control, how fast does a 0.5 m inverted pendulum fall away from upright?
Show the solution
- Linearized equation. so small angles grow as .
- Growth rate.
- Doubling time.
- What the controller needs. It must act within a fraction of that, which is why balance loops run fast.
Answer the angle doubles every 0.16 s.
Check
Model the cart and pendulum, place the poles with Ackermann's formula, and test the design on the nonlinear pendulum.
Python 3.14 with numpy and matplotlib, running in your browser. Tab indents; press Esc and then Tab to move on.
Check
How fast does an uncontrolled pendulum 0.5 m long fall away from upright (the growth rate of its angle)?
Check
How long does an uncontrolled 0.5 m pendulum take to double its angle?
Write units the way you normally would: 1.5 s and 1500 ms are the same answer.
Check
A 0.5 m pendulum is caught with = 15 m/s² per radian. What's the closed loop's natural frequency?
Write units the way you normally would: 1.5 rad/s and 1500 mrad/s are the same answer.
Check
The same 0.5 m pendulum with = 15 has = 8. What's the damping ratio?
Check
An inverted pendulum of length 0.5 m is left uncontrolled.
(a)
At what rate s, in s⁻¹, does a small tilt grow as ?
(b)
How long does the tilt take to double?
Write units the way you normally would: 1.5 s and 1500 ms are the same answer.
Check
A pendulum of length 0.5 m is held up with = 15 m/s² per radian and = 4 m/s per rad/s, giving ... rewritten as .
(a)
What is its natural frequency?
Write units the way you normally would: 1.5 rad/s and 1500 mrad/s are the same answer.
(b)
What is its damping ratio?
Explain why
Why does feeding back only the pendulum's angle let the cart drift away?
Angle feedback accelerates the cart whenever the pendulum leans, which is enough to bring the pendulum upright and hold it there. But once it's upright with no angular motion, the control law asks for zero acceleration, and that's satisfied by a cart at rest anywhere or by a cart rolling at any constant speed. Nothing in the law measures the cart's position or velocity, so those two states are left uncontrolled, and any small push sets the cart drifting. Feeding back the cart's position and velocity too gives the controller a reason to bring it home, which it does by deliberately tipping the pendulum toward home and then following it.
Practice
Keep practicing
8 kinds of problem on this topic, dealt one at a time with new numbers every time, for as long as you like.