EIGENROOMLAB WORKSHEET 12ANSWER KEY · FOR INSTRUCTORSCart-pole · State space
Balance with a state model
Goal
Use the LQR weights to trade pole angle against cart travel, and measure the force each choice takes.
Setup
Lab eigenroom.com/lab?lesson=lqr · short link eigenroom.com/lqr
Open it on a phone or a computer; there is nothing to log in to or install. The link loads run A's settings:
- Initial angle
- 6°
- Controller type
- LQR
- Position cost
- 10
- Angle cost
- 100
- Force cost
- 1
- Sensor noise
- 0
- Disturbance events
- Nudge cart 1.2 N·s at 1.4 s
- Recording
- 8 s
- APreset, exactly as the link opens it.
- BChange only: Angle cost → 1000.
- CChange only: Force cost → 10. (ext.)
1. Predict
What changes when position and pole angle have different costs?
Discrete LQR computes a gain from the upright linear model and Q/R weights, then applies it to the nonlinear plant. It assumes the full state is available.
2. Observe
| Quantity | Where to read it | A | B | C ext. |
|---|---|---|---|---|
| Peak angle (°) | Measured response | 18.43° | 13.46° | 13.37° |
| Peak cart travel (m) | Measured response | 0.77 m | 0.96 m | 1.08 m |
| Peak |applied force| (N) | Control effort plot | 5.47 N | 6.98 N | 2.42 N |
| Control effort (N·s) | Measured response | 2.62 N·s | 2.45 N·s | 2.41 N·s |
Values computed by DC motor and cart-pole engine 1.5.0 at the settings above. A replay readout can differ in the last digit if the slider is not exactly at the stated time; values read from a plot are approximate.
3. Explain
Raising the angle cost from run A to run B: what happens to the peak angle and to the cart travel?
The peak angle falls from 18.43° to 13.46°, but the cart travels further, from 0.77 m to 0.96 m. The weights trade one state's excursion against another's.
Did protecting the angle take more force? Compare the peak force and the total control effort.
The peak force rises from 5.47 N to 6.98 N: the controller pushes harder right after the nudge. The total effort barely changes (2.62 N·s against 2.45 N·s), because the faster angle correction ends sooner.
Extension (optional)
Raise the force cost to 10 with the other weights as in run A. Predict the peak force and the peak angle.
Force becomes expensive, so the controller pushes more gently: peak force 2.42 N against 5.47 N. Many predict a larger angle, but here the gentler push also tips the pole less (13.37° against 18.43°); the price is cart travel, 1.08 m against 0.77 m.