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

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
  1. APreset, exactly as the link opens it.
  2. BChange only: Angle cost → 1000.
  3. CChange only: Force cost → 10. (ext.)

1. Predict

What changes when position and pole angle have different costs?

What happens

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

QuantityWhere to read itABC ext.
Peak angle (°)Measured response18.43°13.46°13.37°
Peak cart travel (m)Measured response0.77 m0.96 m1.08 m
Peak |applied force| (N)Control effort plot5.47 N6.98 N2.42 N
Control effort (N·s)Measured response2.62 N·s2.45 N·s2.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

  1. 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.

  2. 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.

Source: eigenroom.com/worksheets/cart/lqr/answersCite: EIGENROOM. (2026). Balance with a state model [Lab worksheet]. Accessed YYYY-MM-DD. https://eigenroom.com/worksheets/cart/lqr