# tracking error state space, non-linear control example

I am trying to understand an example from [1]. In detail I do not understand how the equation for the dynamic of the tracking error is chosen. I am not a mathematician so please forgive me if I may not use the most proper jargon. The example below, from [p. 216, 1], refers to a third order system. The nonlinear state equations are:

$$\dot{x_1}= sin (x_{2})+ (x_2 + 1) x_3$$

$$\dot{x_2}={x_1}^5 + x_3$$

$$\dot{x_3}={x_1}^2 + u$$

$$y=x_1$$

where $$x_1$$, $$x_2$$, $$x_3$$ are the states, $$u$$ is the control input and $$y$$ the output. Now, the objective of the example is to find a direct equation linking the output to the control input $$u$$.

Differentiating $$y$$ yields

$$\dot{y} = sin (x_{2}) + (x_2 + 1) x_3$$,

and differentiating the above gives:

$$\ddot{y}=(x_2 + 1)u + f(x)$$

showing a direct relationship between the output $$y$$ and the control $$u$$, also

$$f(x)=({x_{1}}^5 + x_3) x3 + cos(x_2) + (x_2+1){x_1}^2$$.

If the control input is chosen as

$$u=\frac{1}{x_2 + 1}(v-f(x_1))$$

with $$v$$ a new 'auxiliary' control input, then the nonlinearity in the equation for $$\ddot{y}$$ is canceled, and the simple linear relation $$\ddot{y}=v$$ is obtained. Now, [p. 217, 1] says that designing a tracking controller for this double integrator is simple. Letting the tracking error be $$e=y-y_d$$, where $$y_d$$ is the reference, and choosing the new input as

$$v=\ddot{y_d} - k_{1} e - k_{2} \dot{e}$$

with $$k_1, k_2 >0$$, the tracking error dynamic is:

$$\ddot{e}+ k_{1} e + k_{2} \dot{e} =0$$

which represents a stable error dynamic.

My question is

1) how does one come up with the choice $$v=\ddot{y} - k_{1} e - k_{2} \dot{e}$$? Is this done in order to have $$\ddot{e}+ k_{1} e + k_{2} \dot{e} =0$$.

2) Why is the choice $$\ddot{e}+ k_{1} e + k_{2} \dot{e} =0$$ made? Rather than for instance simply choosing $$k_{1} e + k_{2} \dot{e} =0$$?

Any (simple) explanation would help a lot!

Thank you

References: [1] Slotine and Li, Applied Nonlinear Control, Prentice-Hall, New Jersey, 1991

I assume that you made a typo and the choice for the input should be

$$v = \ddot{y}_d - k_1\,e - k_2\,\dot{e},$$

so using $$\ddot{y}_d$$ instead of $$\ddot{y}$$, which acts as a feedforward term. Such feedforward term makes sure that when the error is zero it will remain zero for any $$y_d$$ which is at least twice differentiable.

The choice for the input-output linearization gives $$\ddot{y} = v$$. So if we now look at the error dynamics one gets

\begin{align} \ddot{e} &= \ddot{y} - \ddot{y}_d \\ &= v - \ddot{y}_d \\ &= \ddot{y}_d - k_1\,e - k_2\,\dot{e} - \ddot{y}_d \\ &= - k_1\,e - k_2\,\dot{e} \end{align}

Coming up with this $$v$$ is common choice in linear control. Namely as stated before $$\ddot{y}_d$$ acts as feedforward. The remaining two terms act as state feedback, for example after applying the feedforward, so define $$v = \ddot{y}_d + w$$, the error dynamics can also be written as

$$\dot{z} = \underbrace{ \begin{bmatrix} 0 & 1 \\ 0 & 0 \end{bmatrix} }_A z + \underbrace{ \begin{bmatrix} 0 \\ 1 \end{bmatrix} }_B w,$$

with $$z = \begin{bmatrix}e & \dot{e}\end{bmatrix}^\top$$. Now by using state feedback $$w = -K\,z$$ we get the closed loop dynamics $$\dot{z} = (A - B\,K)\,z$$, which decays exponentially to zero if $$A - B\,K$$ is Hurwitz. Choosing a $$K$$ can be done with things like pole placement or LQR, but it can be shown that $$A - B\,K$$ is always Hurwitz when $$k_1,k_2>0$$, with $$K = \begin{bmatrix}k_1 & k_2\end{bmatrix}$$.

Lets say one would choose $$v = \ddot{y} - k_1\,e - k_2\,\dot{e}$$, plugging this into $$\ddot{y}$$ would give $$k_1\,e + k_2\,\dot{e} = 0$$. However, $$v$$ is chosen to be equal to $$\ddot{y}$$ so solving for $$v$$ would imply solving $$v = v - k_1\,e - k_2\,\dot{e}$$. This equation is only true when $$k_1\,e + k_2\,\dot{e} = 0$$ but you are not able to choose what $$e$$ and $$\dot{e}$$ are at any given moment. And if that equation would be true, then all values for $$v$$ would satisfy it. So either way it does not lead to a very sensible result.

• thank you for your effort and detailed answer. Yes, there was a typo before as you have indicated (it is corrected now). I was also wondering that, since $\ddot{y}=v$, and $e=y-y_d$, , then it follows $\ddot{e}=\ddot{y}-\ddot{y_d}$ and $\ddot{e}=v-\ddot{y_d}$. Now, I don't understand why/how it is chosen $\ddot{e} = - k_1 e - k_2 \dot{e}$ ? It seems to be a straightforward choice, but not sure why. Maybe is because the system of the second order? I feel I am missing some simple detail here Feb 1 '19 at 7:37
• @Lello Indeed, namely if the relative degree would have been $n$, so after input-output linearization you would get $$\frac{d^n y}{dt^n}=v,$$ then the natural choice for $v$ would be $$v=\frac{d^n y_d}{dt^n} + \sum_{i=0}^{n-1} k_i\,\frac{d^i e}{dt^i}.$$ Feb 1 '19 at 7:47
• So this is essentially feedforward plus (error-) state feedback with the characteristic polynomial equal to $$\lambda^n - \sum_{i=0}^{n-1} k_i\,\lambda^i,$$ so if its roots all lie inside the left half plane (which is equivalent to $A-B\,K$ being Hurwitz) then the error will decay exponentially to zero. Feb 1 '19 at 7:57

@Kwin thank you very much again. Maybe I get the algebra right this time... we have $$\ddot{y}=v$$ and writing this equation in terms error $$e$$ yields $$\ddot{e}+\ddot{y_d}=v$$. If the choice $$\ddot{e}=-k_1 e - k_2 \dot{e}$$ is made, then $$v=\ddot{y_d}-k_1 e - k_2 \dot{e}$$. Initially we had $$\ddot{y}=v$$, hence we have $$\ddot{y}=\ddot{y_d}-k_1 e - k_2 \dot{e}$$, moving $$\ddot{y_d}$$ on the left hand side gives $$\ddot{y}-\ddot{y_d}=\ddot{e}=-k_1 e - k_2 \dot{e}$$. The equation $$\ddot{e}=-k_1 e - k_2 \dot{e}$$ is written as $$\ddot{e} +k_1 e + k_2 \dot{e}=0$$, whose characteristic equation is $$\lambda^2 + k_1 + k_2 \lambda =0$$, which is stable if $$k_1>0$$ and $$k_2>0$$ (it's Hurwitz), i.e. the solutions will be converging to zero as $$t\rightarrow \infty$$, since they will be $$e^{-\lambda_1 t} + e^{-\lambda_2 t}$$, with $$\lambda_1, \lambda_2>0$$.