States and the cart-pole model
A state records enough information to predict the next motion once the input is known.
Separate state, input, and measured output before writing a state equation.
The motor balance used current speed and torque to predict acceleration. For a cart and pole, one value is not enough: position and velocity matter too.
Review the previous lesson: From hardware to equationsFirst, picture it
Two carts can be at the same position but move in opposite directions. A position reading alone cannot tell you where either cart will be next. Add velocity and you can make a prediction once the applied force is known.
Build the idea step by step
A state is a set of values that, with the future input, is enough to predict the model's future. For a cart, position and velocity can be the states. A state vector is simply these values written in a column. The input is the force we apply. The output is what we measure, which may be only position. In a linear model, matrix A describes how states affect their rates of change, B how inputs affect those rates, C what we measure, and D any immediate input-to-output effect.
Read the equations
The first relation predicts how state changes. The second describes what sensors report. These matrices describe a linear model near a chosen operating point.
What the symbols mean
- column of state values, with units that depend on each state
- actuator input, such as force in newtons
- measured output, such as position in metres
- matrices that link state, input, and output; their entries carry the needed units
- time derivative of each state; the dot means rate of change
A dot means change per unit time. The state vector may mix units, so its matrix entries need compatible units. A cart-pole model near upright is a local approximation; writing a matrix does not make a nonlinear device linear everywhere.
A cart described by two states
Take a frictionless cart of mass 2 kilograms. Its state is position and velocity; a 4 newton force is the input.
Velocity changes by force divided by mass: 2 metres per second squared. Position changes at the current velocity.
If the cart starts at rest, after 0.1 second its velocity is 0.2 metres per second. A position-only sensor still does not directly report that velocity.
More detail and model assumptions
State, input and output are different roles
The state is the system's evolving memory. The input is what the actuator can command. The output is what you decide to measure or report. In this Lab the simulation knows all four cart-pole states, but a real controller cannot assume every state is directly sensed.
Writing A, B and C makes those roles explicit. In the later state-space design part, we ask which states the input can move and which states the outputs can reveal before designing feedback.
Connect the example to the lab
Run angle-only balance and watch cart drift. Then try position return with the same initial angle; compare position and angle together.
Try the LQR experimentMake a prediction before moving a control.
- PREDICTCan the pole be upright while the cart is in trouble?
- CHANGE ONE THINGCompare angle-only and position-return presets at one initial angle.
- OBSERVEInspect cart position, velocity, angle and force.
- EXPLAINExplain which state the angle display hid.
Having a state vector does not mean every state is measured or that the actuator can control every mode. Check those properties before choosing state feedback.
Check your understanding+
Why is pole angle alone insufficient to describe the cart-pole's future?
The same angle can occur with different cart positions, velocities and pole rates, leading to different next motions.Why the next lesson follows
Real systems are often nonlinear. Next we learn when a linear state model can stand in for one.