# Understanding a sliding mode controller for quadrotors

I'm really willing to understand and implement such a controller (sliding mode) for a quadrotor. I've found this interesting document explaining that topic. If you scroll down until page 381 (don't be scared, the document is just 6-7 pages) you can find the following height control law (equation .19):

$$U_1 = \frac{m}{\cos{\phi}\cos{\theta}}[c_1(\dot z_r - \dot z) + \ddot z_r + \epsilon_1 sgn(s_1) + k_1 s_1 + g]$$

The explanation of most of the term should be quite easy, but let's focus on the variable z, the height (or altitude if absolute) of the quadrotor. Anyway the control law "pretends" not only the goal height z (through $s_{1}$) but even the vertical speed $\dot z_{r}$ and vertical acceleration $\ddot z_{r}$ (r means here reference).

Now...to me is not clear whether those variables the setpoints are, that must be reached once the quadrotor reaches its predefined height or they just symbolize an abstract mathematical formalism but are going to be most of the time Zero (because I want to reach the target height with $z = z_{r}$ but $\dot z_{r} = \ddot z_{r} = 0$)

?!?!?

I hope my question is clear. Even if this I put in the title "sliding control" I think it may be helpful for other type of controllers. Regards

What you say ($\dot{z}_r$ = 0, $\ddot{z}_r=0$) is true in only the most basic systems. As a trivial counter example, consider systems where the desired height is moving: then it should be obvious that $\dot{z}_r$ and $\ddot{z}_r$ will be non-zero.
Even for systems with $z_r = const$, if you want to improve performance you need to start thinking about $\dot{z}_r$ and $\ddot{z}_r$. Imaging you've just changed the set point so $|z-z_r| >> 0$. Your quad can't instantly jump so it will take some time during which $\dot{z}$ will necessarily be non-zero. If you define a profile, with conistent $z_r$, $\dot{z}_r$, and $\ddot{z}_r$ you get much better overall control than just leaving $\dot{z}_r=0$ and $\ddot{z}_r=0$.
To be clear, this doesn't uniquely define $\dot{z}_r$ and $\ddot{z}_r$. That is for the system designer to decide. For best performance, just make sure the system is consistent, i.e. $\frac{d}{dt} z = \ddot{z}_r$ and $\frac{d^2}{dt^2} z_r = \ddot{z}_r$