Skip to content
Automatic Controls 1

State space: state feedback and observers

State equations and the link with the transfer function, state feedback and pole placement on the inverted pendulum, controllability, LQR, observers and the Kalman filter.

Transfer functions describe the link between one input and one output. Many systems, however, have several inputs and outputs, and their internal state matters: a drone has four motors and six degrees of freedom, an inverted pendulum on a cart must be controlled by looking at position, angle and velocity together. The state-space representation describes the system with a set of first-order equations and makes it possible to design controllers that use all the internal quantities. In this lesson we cover state equations, controllability, state feedback with pole placement and observers.

State equations

The state \mathbf{x} is the minimal set of quantities that, together with future inputs, determines the whole future evolution: positions and velocities of a mechanical system, capacitor voltages and inductor currents of a circuit. For a linear system:

    \[ \dot{\mathbf{x}} = A\mathbf{x} + B\mathbf{u},\qquad \mathbf{y} = C\mathbf{x} + D\mathbf{u} \]

Example. An n-th order differential equation is brought into this form by choosing the output and its derivatives as states. For the inverted pendulum linearised around the upright position, \ddot\theta = \frac{g}{l}\theta + u (with u the normalised command acceleration), with x_1 = \theta and x_2 = \dot\theta:

    \[ \dot{\mathbf{x}} = \begin{pmatrix} 0 & 1 \\ g/l & 0 \end{pmatrix}\mathbf{x} + \begin{pmatrix} 0 \\ 1 \end{pmatrix}u \]

The link with the transfer function. Taking the Laplace transform (zero initial conditions), s\mathbf{X} = A\mathbf{X} + B\mathbf{U}, so

    \[ G(s) = C\,(sI - A)^{-1}B + D \]

The poles of G are the eigenvalues of A, roots of \det(sI - A) = 0. For the pendulum: s^2 - g/l = 0, eigenvalues \pm\sqrt{g/l}, one positive: the inverted pendulum is unstable, as expected.

State feedback

If the whole state is measurable, the command u = -K\mathbf{x} + r is used, with K a row of gains. The closed loop becomes

    \[ \dot{\mathbf{x}} = (A - BK)\,\mathbf{x} + B\,r \]

and its poles are the eigenvalues of A - BK, which can be chosen through K.

Example. For the pendulum with g/l = 20 s⁻² and K = (k_1\ \ k_2):

    \[ A - BK = \begin{pmatrix} 0 & 1 \\ 20 - k_1 & -k_2 \end{pmatrix},\qquad \det(sI - A + BK) = s^2 + k_2 s + (k_1 - 20) \]

To have poles with \omega_n = 10 rad/s and \zeta = 0.7, the desired polynomial is s^2 + 14s + 100: so k_2 = 14 and k_1 = 120. The command u = -120\,\theta - 14\,\dot\theta keeps the pendulum upright, with feedback on both angle and angular velocity: it is a PD controller, derived systematically.

Controllability. The poles can be placed at will if and only if the system is controllable, that is if the matrix

    \[ \mathcal{C} = \begin{pmatrix} B & AB & A^2B & \cdots & A^{n-1}B \end{pmatrix} \]

has rank n. It means the input can influence every component of the state. For the pendulum \mathcal{C} = \begin{pmatrix} 0 & 1 \\ 1 & 0 \end{pmatrix}, of rank 2.

The inverted pendulum on a cart

Inverted pendulum mounted on a cart driven by a horizontal force
A cart of mass M slides on a horizontal track and is pushed by a force u; on top, a rod of length l with a mass m at its tip is hinged. The state includes the cart position x, the rod angle θ from the vertical and the two velocities.

The classic case in control laboratories, and the principle of self-balancing vehicles like the Segway: a single input (the force on the cart) must control four states (cart position and velocity, rod angle and angular velocity). The linearised model is controllable, and state feedback with four gains manages to keep the rod upright and bring the cart back to the desired position. A single PID on the angle would not be enough: it would keep the rod straight, but the cart would drift away.

To choose the poles in a principled way the linear quadratic regulator (LQR) is often used, which computes the K minimising a cost of the form \int(\mathbf{x}^TQ\mathbf{x} + u^TRu)\,dt: an explicit trade-off between accuracy and control effort.

Observers

Often not all of the state is measurable: the angle is measured by a sensor, but not the angular velocity. An observer is then built, a model of the system running in parallel on the computer and corrected by the difference between the measured and the predicted output:

    \[ \dot{\hat{\mathbf{x}}} = A\hat{\mathbf{x}} + B\mathbf{u} + L(\mathbf{y} - C\hat{\mathbf{x}}) \]

The estimation error \mathbf{e} = \mathbf{x} - \hat{\mathbf{x}} satisfies \dot{\mathbf{e}} = (A - LC)\mathbf{e}: by choosing L the estimate can be made as fast as desired, provided the system is observable (the dual condition of controllability). By the separation principle the feedback and the observer can be designed independently, and the feedback applied to the estimated state. The Kalman filter, used in the navigation of aircraft, phones and drones to fuse data from accelerometers, gyroscopes and GPS, is an observer designed taking sensor noise into account.

Subscribe
Notify of
guest
0 Comments
Oldest
Newest Most Voted
0
Would love your thoughts, please comment.x
()
x