Open Access
This article is

- freely available
- re-usable

*Electronics*
**2019**,
*8*(7),
793;
https://doi.org/10.3390/electronics8070793

Article

Embedded Flight Control Based on Adaptive Sliding Mode Strategy for a Quadrotor Micro Air Vehicle

Tecnologico de Monterrey, Escuela de Ingenieria y Ciencias, Monterrey, NL 64849, Mexico

^{*}

Author to whom correspondence should be addressed.

Received: 14 June 2019 / Accepted: 8 July 2019 / Published: 16 July 2019

## Abstract

**:**

The design of an embedded flight controller for a quadrotor micro air vehicle, which is subject to uncertainties and perturbations, is addressed. In order to obtain robustness against bounded uncertainties and disturbances, an adaptive sliding mode controller is proposed. The control adaptive gains allow using only necessary control to satisfy the task, reducing the chattering effect and at the same time reject external perturbations. Furthermore, a stability analysis of the closed-loop system is given. Finally, simulations and experimental results carried out on a commercial micro air vehicle demonstrate the feasibility and advantages of the proposed flight controller.

Keywords:

embedded control; adaptive sliding mode control; quadrotor MAV## 1. Introduction

The study about Unmanned Aerial Vehicles (UAVs), particularly the quadrotor systems, has grown exponentially, such that many applications have been developed due to their advantages such as vertical take-off and landing, hovering, and maneuverability. Then, quad-rotors are employed in inspection-, mapping-, and surveillance-related tasks. Recently, Micro Air Vehicles (MAVs) (according to the definition in [1], these vehicles have a mass $<0.1$ kg and a size $<0.15$ m) have attracted attention because they can access confined and denied GPS spaces such as inside buildings, pipelines, halls, factories, schools, and more. Since MAVs are designed to operate in the above places, they require more advanced controllers to achieve the commanded tasks.

Many commercial quadrotors are available on the market. Nonetheless, we focus on the Parrot mini drone rolling spider, which due to its tiny size is classified as an MAV. These drones are safe and reliable, and they include sensors, such as an altimeter, an ultrasonic sensor, an Inertial Measurement Unit (IMU), and a camera. A remarkable advantage is that, it is possible to test low level control due to the recently open architecture for MATLAB by means of the Simulink Support Package for Parrot Minidrones [2] or by getting started with MIT’s Rolling Spider MATLAB Toolbox [3].

Regarding the small size of UAVs, uncertainties and external disturbances affect the performance of the vehicle. Hence, tasks conducted by these MAVs require control approaches able to provide accuracy, efficient consumption of energy, and robustness. In order to control a quadrotor MAV subject to uncertainties and external disturbances, adaptive control [4], robust control [5], optimal control [6], and intelligent control [7] have been developed. Nevertheless, the aforementioned results depend of the knowledge of the system or a training process for the last one. Even more, they show limited robustness under external perturbations.

Robust control techniques for UAVs, with some approaches such as [8], where a robust attitude control scheme subject to actuator faults and wind gust was investigated, require much information estimated via an extended state observer. On the other hand, sliding mode controllers appear as one of the most available approaches due to their advantages such as robustness as pointed out in [9,10,11,12,13,14,15]. Nonetheless, the controller parameters remain fixed, and the tuning of these gains could be complex.

The super twisting approach is a powerful sliding mode controller, which has been employed in flight control for quadrotors in [16,17,18]. The algorithm is robust to bounded and derivative bounded perturbations, but the magnitude of these bounds must be known in order to guarantee stability. On the other hand, adaptive strategies have arisen to deal with the control effort such as in [19,20]. However, the tuning of these algorithms is very difficult. Previous investigations were relative to standard size UAVs (more than $0.5$ kg), and they proved their strategies on quadrotors of typically more than a kilogram of weight. Hence, it is clear that tiny vehicles such as micro air vehicles have more sensitivity to external perturbations compared with the standard size, demanding robust and adaptive controllers to guarantee the commanded task.

#### Contribution

An embedded flight controller for a quadrotor MAV subject to uncertainties and perturbations is the main contribution of this paper. An adaptive sliding mode technique is the core of the approach, where the advantages rely on not overestimating the magnitude of the gain and robustness against bounded disturbances. Due to adaptive gains, only necessary control is employed to satisfy the task, reducing the chattering effect and at the same time being able to reject external perturbations. Furthermore, a stability analysis of the closed-loop system is provided. Finally, simulations and experimental results carried out on a commercial rolling spider micro drone demonstrate the feasibility and advantages of the proposed flight controller.

## 2. Mathematical Model

In this section, the mathematical model of the parrot rolling spider micro quadrotor is presented. The kinematics and dynamics of the MAV moving in space are described by the following state variables $\mathbf{p}={[x,y,z]}^{T}\in {\mathcal{R}}^{3}$ and $\mathsf{\Theta}={[\varphi ,\theta ,\psi ]}^{T}\in \{-\pi ,\pi \}$, which are the linear and angular positions, respectively in the inertial reference frame, whereas $\nu ={[u,v,w]}^{T}\in {\mathcal{R}}^{3}$ and $\omega ={[p,q,r]}^{T}\in {\mathcal{R}}^{3}$ are velocities expressed in the body reference frame (see Figure 1).

Thus, following the Newton–Euler convention, the quad-rotor model is given by [21]:
where m is the aircraft mass and the rotation matrix ${\mathbf{R}}_{1}\left(\mathsf{\Theta}\right)\in SO\left(3\right)$ and ${\mathbf{R}}_{2}\left(\mathsf{\Theta}\right)\in {\mathcal{R}}^{3\times 3}$ transform the body frame to inertial frame. The matrices are denoted by:
and:
where ${s}_{x}$, ${c}_{y}$, and ${t}_{z}$ are $sin\left(x\right)$, $cos\left(y\right)$, and $tan\left(z\right)$, respectively.

$$\begin{array}{ccc}\hfill \dot{\mathbf{p}}& =& {\mathbf{R}}_{1}\left(\mathsf{\Theta}\right)\mathbf{v}\hfill \end{array}$$

$$\begin{array}{ccc}\hfill \dot{\mathsf{\Theta}}& =& {\mathbf{R}}_{2}^{-1}\left(\mathsf{\Theta}\right)\omega \hfill \end{array}$$

$$\begin{array}{ccc}\hfill \mathbf{F}& =& m(\dot{\mathbf{v}}+\omega \times \mathbf{v})\hfill \end{array}$$

$$\begin{array}{ccc}\hfill \tau & =& \mathbf{I}\dot{\omega}+\omega \times \mathbf{I}\omega ,\hfill \end{array}$$

$${\mathbf{R}}_{1}\left(\mathsf{\Theta}\right)=\left[\begin{array}{ccc}{c}_{\psi}{c}_{\theta}& -{s}_{\psi}{c}_{\varphi}+{c}_{\psi}{s}_{\theta}{s}_{\varphi}& {s}_{\psi}{s}_{\varphi}+{c}_{\psi}{s}_{\theta}{c}_{\varphi}\\ {s}_{\psi}{c}_{\theta}& {c}_{\psi}{c}_{\varphi}+{s}_{\psi}{s}_{\theta}{s}_{\varphi}& -{c}_{\psi}{s}_{\varphi}+{s}_{\psi}{s}_{\theta}{c}_{\varphi}\\ -{s}_{\theta}& {c}_{\theta}{s}_{\varphi}& {c}_{\theta}{c}_{\varphi}\end{array}\right]$$

$${\mathbf{R}}_{2}\left(\mathsf{\Theta}\right)=\left[\begin{array}{ccc}1& {s}_{\varphi}{t}_{\theta}& {c}_{\varphi}{t}_{\theta}\\ 0& {c}_{\varphi}& -{s}_{\varphi}\\ 0& {s}_{\varphi}/{c}_{\theta}& {c}_{\varphi}/{c}_{\theta}\end{array}\right]$$

The inertia assuming that the vehicle is symmetric $\mathbf{I}\in {\mathcal{R}}^{3\times 3}$ is given by:

$$\mathbf{I}=\left[\begin{array}{ccc}{I}_{x}& 0& 0\\ 0& {I}_{y}& 0\\ 0& 0& {I}_{z}\end{array}\right]$$

The force and torque vectors are described by:
where,
is the gravity vector. On the other hand, the sum of each thrust produced by a motor-propeller represents the total thrust acting on the z-axis of the body frame, defined as:
where ${T}_{i}$ for $i=1,2,3,4$ is the thrust provided by each motor. In contrast, torques are produced by differences in rotor speeds, obtaining roll, pitch, and yaw motions, which are defined according an “X” configuration:
where l is an arm of the quadrotor. ${Q}_{i}$ for $i=1,2,3,4$ is the rotor torque. The gyroscopic effects are denoted by:
where ${j}_{r}$ is the rotor inertia, $p,q$ are the angular velocities in the body frame, and ${\mathsf{\Omega}}_{i}$ for $i=1,2,3,4$ is the angular rate of the ${i}^{\mathrm{th}}$ rotor. However, assuming standard approximations of the thrust and torque, these are expressed as follows:
where ${k}_{T}$ is a constant of thrust and ${k}_{Q}$ is a torque constant. Therefore, the actual torques, i.e., ${\tau}_{\varphi},{\tau}_{\theta},{\tau}_{\psi},\tau $, which represent the roll, pitch, yaw, and throttle torques, respectively, are explicitly given by:

$$\begin{array}{ccc}\hfill \mathbf{F}& =& {\mathbf{F}}_{g}+{\mathbf{F}}_{m}\hfill \end{array}$$

$$\begin{array}{ccc}\hfill \tau & =& {\tau}_{m}+{\tau}_{gy}\hfill \end{array}$$

$${\mathbf{F}}_{g}={\mathbf{R}}_{1}^{-1}\left(\mathsf{\Theta}\right)\left[\begin{array}{c}0\\ 0\\ mg\end{array}\right]=\left[\begin{array}{c}-mg{S}_{\theta}\\ mg{C}_{\theta}{S}_{\varphi}\\ mg{C}_{\theta}{C}_{\varphi}\end{array}\right]$$

$${\mathbf{F}}_{m}=\left[\begin{array}{c}0\\ 0\\ -({T}_{1}+{T}_{2}+{T}_{3}+{T}_{4})\end{array}\right],$$

$${\tau}_{m}=\left[\begin{array}{c}\frac{l}{\sqrt{2}}({T}_{2}+{T}_{3}-{T}_{1}-{T}_{4})\\ \frac{l}{\sqrt{2}}({T}_{1}+{T}_{2}-{T}_{3}-{T}_{4})\\ -{Q}_{1}+{Q}_{2}-{Q}_{3}+{Q}_{4}\end{array}\right],$$

$${\tau}_{gy}=\left[\begin{array}{c}-{j}_{r}q({\mathsf{\Omega}}_{1}-{\mathsf{\Omega}}_{2}+{\mathsf{\Omega}}_{3}-{\mathsf{\Omega}}_{4})\\ {j}_{r}p({\mathsf{\Omega}}_{1}-{\mathsf{\Omega}}_{2}+{\mathsf{\Omega}}_{3}-{\mathsf{\Omega}}_{4})\\ 0\end{array}\right],$$

$$\begin{array}{ccc}\hfill {T}_{i}& =& {k}_{T}{\mathsf{\Omega}}_{i}^{2}\hfill \end{array}$$

$$\begin{array}{ccc}\hfill {Q}_{i}& =& {k}_{Q}{\mathsf{\Omega}}_{i}^{2},\hfill \end{array}$$

$$\left[\begin{array}{c}{\tau}_{\varphi}\\ {\tau}_{\theta}\\ {\tau}_{\psi}\\ \tau \end{array}\right]=\left[\begin{array}{cccc}-\frac{l}{\sqrt{2}}{k}_{T}& -\frac{l}{\sqrt{2}}{k}_{T}& \frac{l}{\sqrt{2}}{k}_{T}& -\frac{l}{\sqrt{2}}{k}_{T}\\ \frac{l}{\sqrt{2}}{k}_{T}& \frac{l}{\sqrt{2}}{k}_{T}& -\frac{l}{\sqrt{2}}{k}_{T}& -\frac{l}{\sqrt{2}}{k}_{T}\\ -{k}_{Q}& {k}_{Q}& -{k}_{Q}& {k}_{Q}\\ {k}_{T}& {k}_{T}& {k}_{T}& {k}_{T}\end{array}\right]\left[\begin{array}{c}{\mathsf{\Omega}}_{1}^{2}\\ {\mathsf{\Omega}}_{2}^{2}\\ {\mathsf{\Omega}}_{3}^{2}\\ {\mathsf{\Omega}}_{4}^{2}\end{array}\right].$$

Finally, the parameters of the rolling spider micro drone are displayed in Table 1.

## 3. Embedded Flight Control Design

In this section, the proposed flight controller is addressed. The control objective was to stabilize the quadrotor MAV in spite of uncertainties and external perturbations. An adaptive sliding mode strategy was used as the core of the proposed method. Then, in order to design the controller, we used a simplified model under the following assumptions:

**Assumption**

**1.**

We considered that linear and angular accelerations in the body frame are equal to the inertial frame, and this is based on the small angles theorem.

**Assumption**

**2.**

We separated the problem into the actuated system, which refers to the $\varphi ,\theta ,\psi $ and z dynamics and an underactuated system, corresponding to the x and y dynamics. Hence, the model for control design purposes is given by:

$$\begin{array}{cc}\hfill Actuated& \left\{\begin{array}{c}\ddot{\varphi}=\frac{({I}_{y}-{I}_{z})}{{I}_{x}}\dot{\theta}\dot{\psi}-\frac{{j}_{r}}{{I}_{x}}{\mathsf{\Omega}}_{a}\dot{\theta}+\frac{{\tau}_{\varphi}}{{I}_{x}}+{d}_{\varphi}\\ \ddot{\theta}=\frac{({I}_{z}-{I}_{x})}{{I}_{y}}\dot{\varphi}\dot{\psi}+\frac{{j}_{r}}{{I}_{y}}{\mathsf{\Omega}}_{a}\dot{\varphi}+\frac{{\tau}_{\theta}}{{I}_{y}}+{d}_{\theta}\\ \ddot{\psi}=\frac{({I}_{x}-{I}_{y})}{{I}_{z}}\dot{\theta}\dot{\varphi}+\frac{{\tau}_{\psi}}{{I}_{z}}+{d}_{\psi}\phantom{\rule{1.em}{0ex}}\phantom{\rule{1.em}{0ex}}\phantom{\rule{1.em}{0ex}}\\ \ddot{z}=\frac{\tau}{m}\left({C}_{\varphi}{C}_{\theta}\right)+g+{d}_{z}\phantom{\rule{1.em}{0ex}}\phantom{\rule{1.em}{0ex}}\phantom{\rule{1.em}{0ex}}\end{array}\right.\hfill \end{array}$$

$$\begin{array}{cc}\hfill Underactuated& \left\{\begin{array}{c}\ddot{x}=\frac{\tau}{m}({C}_{\psi}{S}_{\theta}{C}_{\psi}+{S}_{\varphi}{S}_{\psi})+{d}_{x}\\ \ddot{y}=\frac{\tau}{m}({C}_{\psi}{S}_{\theta}{S}_{\psi}+{S}_{\varphi}{C}_{\psi})+{d}_{y}\end{array}\right.\hfill \end{array}$$

Thus, we proposed two controllers, one in order to control the actuated system, where an adaptive sliding mode control is adopted, and a virtual control concept used to solve the underactuated dynamics.

#### 3.1. Actuated System

Consider the uncertain and disturbed actuated dynamics as:
where the state is denoted by $\zeta ={[\varphi ,\theta ,\psi ,z]}^{T}$, and:
where ${f}_{0}(t,x)={[{a}_{1},{a}_{2},{a}_{3},{a}_{4}]}^{T}$ and ${g}_{0}\left(x\right)=[{b}_{1},{b}_{2},{b}_{3},{b}_{4}]$ are the nominal model, whereas ${f}_{u}(x,t)=\Delta {[{a}_{1},{a}_{2},{a}_{3},{a}_{4}]}^{T}$ and ${g}_{u}\left(x\right)=\Delta [{b}_{1},{b}_{2},{b}_{3},{b}_{4}]$ are parametric uncertainties. Furthermore, ${a}_{1}=\frac{({I}_{y}-{I}_{z})}{{I}_{x}}\dot{\theta}\dot{\psi}-\frac{{j}_{r}}{{I}_{x}}\dot{\theta}{\mathsf{\Omega}}_{a}$, ${a}_{2}=\frac{({I}_{z}-{I}_{x})}{{I}_{y}}\dot{\varphi}\dot{\psi}+\frac{{j}_{r}}{{I}_{y}}\dot{\varphi}{\mathsf{\Omega}}_{a}$, ${a}_{3}=\frac{({I}_{x}-{I}_{y})}{{I}_{z}}\dot{\theta}\dot{\varphi}$, ${a}_{4}=g$, ${b}_{1}=\frac{1}{{I}_{x}}$, ${b}_{2}=\frac{1}{{I}_{y}}$, ${b}_{3}=\frac{1}{{I}_{z}}$, ${b}_{4}=\frac{1}{m}\left({c}_{\varphi}{c}_{\theta}\right)$, and $d\left(t\right)$ includes uncertainties and perturbations satisfying $\left|d\right(t\left)\right|\le L$, where $L>0$ is an upper bound of the perturbation. Hence, by defining the error as:
where ${\zeta}_{1d}={[{\varphi}_{d},{\theta}_{d},{\psi}_{d},z]}^{T}$ and ${\zeta}_{2d}={[{\dot{\varphi}}_{d},{\dot{\theta}}_{d},{\dot{\psi}}_{d},{\dot{z}}_{d}]}^{T}$ are the tracking references. Now, we define the following sliding surface:
where $\lambda >0$. Then, deriving Equation (26), one gets:

$$\begin{array}{ccc}\hfill \ddot{\zeta}& =& f(\zeta ,t)+g\left(\zeta \right)u+d\left(t\right)\hfill \end{array}$$

$$\begin{array}{ccc}\hfill y& =& h\left(\zeta \right)\hfill \end{array}$$

$$\begin{array}{ccc}\hfill f(\zeta ,t)& =& {f}_{0}(\zeta ,t)+{f}_{u}(\zeta ,t)\hfill \end{array}$$

$$\begin{array}{ccc}\hfill g\left(\zeta \right)& =& {g}_{0}\left(\zeta \right)+{g}_{u}\left(\zeta \right)\hfill \end{array}$$

$$\begin{array}{ccc}\hfill u& =& {[{\tau}_{\varphi},{\tau}_{\theta},{\tau}_{\psi},{T}_{t}]}^{T}\hfill \end{array}$$

$$\begin{array}{ccc}\hfill d\left(t\right)& =& {[{d}_{\varphi},{d}_{\theta},{d}_{\psi},{d}_{z}]}^{T},\hfill \end{array}$$

$$e={\zeta}_{1d}-{\zeta}_{1},\phantom{\rule{28.45274pt}{0ex}}\dot{e}={\zeta}_{2d}-{\zeta}_{2},$$

$$s=\dot{e}+\lambda e$$

$$\begin{array}{ccc}\hfill \dot{s}& =& \ddot{e}+\lambda \dot{e}\hfill \\ & =& {\ddot{\xi}}_{1d}-f(\xi ,t)+g\left(\xi \right)u+\lambda \left({\dot{\xi}}_{1d}-{\dot{\xi}}_{1}\right)\hfill \end{array}$$

Thus, considering a feedback controller:
where the auxiliary control ${u}_{a}$ is given by the following adaptive sliding mode strategy:
where ${K}_{a}\left(t\right)$ is the control gain, which adapts according to:
and ${k}_{2*}>0$ is a design fixed gain. This controller Equation (29) adapts one of its gains Equation (30) in order to establish minimal control effort according to ${K}_{min}$ and maintain stability, where k regulates the rate of adaptation; as a consequence, this parameter regulates how fast the controller responds to perturbations. $\mu $ is a parameter to detect the loss of the sliding mode and thus increase the gain if required. As has already been presented, this control method is robust against bounded perturbations/uncertainties, and the control gain is not overestimated, reducing the chattering effect.

$$u=g{\left(\xi \right)}^{-1}\left(f(\zeta ,t)-{\ddot{\zeta}}_{1d}-\lambda ({\dot{\zeta}}_{1d}-{\dot{\zeta}}_{1})+{u}_{a}\right)$$

$${u}_{a}=-{K}_{a}\left(t\right){\left|s\right|}^{1/2}sign\left(s\right)-{k}_{2}s$$

$$\begin{array}{ccc}{\dot{K}}_{a}\left(t\right)\phantom{\rule{-0.166667em}{0ex}}& =& \phantom{\rule{-0.166667em}{0ex}}\left\{\begin{array}{cc}{\displaystyle k\mathrm{sign}\left(\right|s|-\mu )},\hfill & \phantom{\rule{1.42262pt}{0ex}}\mathrm{if}\phantom{\rule{4pt}{0ex}}{K}_{a}>{K}_{min},\hfill \\ {K}_{min},\hfill & \phantom{\rule{1.42262pt}{0ex}}\mathrm{if}\phantom{\rule{4pt}{0ex}}{K}_{a}\le {K}_{min},\hfill \end{array}\right.\hfill \end{array}$$

#### 3.2. Underactuated System

In order to control the x and y coordinates, the virtual control strategy is followed, where the objective is to achieve ${x}_{d},{y}_{d}$ desired coordinates. Then, by defining now the error as:
with time derivative:

$$e={\xi}_{d}-\xi =\left[\begin{array}{c}{x}_{d}-x\\ {y}_{d}-y\end{array}\right]$$

$$\dot{e}={\dot{\xi}}_{d}-\dot{\xi}=\left[\begin{array}{c}{\dot{x}}_{d}-\dot{x}\\ {\dot{y}}_{d}-\dot{y}\end{array}\right]$$

Now, given a desired trajectory ${x}_{d},{y}_{d},{\psi}_{d}$, the $x,y$ positions can be reached via desired roll and pitch angles ${\varphi}_{d},{\theta}_{d}$. From Equation (18), the following virtual control is obtained:
where:
where ${K}_{p}>0$ and ${K}_{d}>0$.

$$\begin{array}{ccc}\hfill {\varphi}_{d}& =& si{n}^{-1}\left(\frac{m}{{T}_{t}}({s}_{{\psi}_{d}}{u}_{v1}-{c}_{{\psi}_{d}}{u}_{v2})\right)\hfill \end{array}$$

$$\begin{array}{ccc}\hfill {\theta}_{d}& =& si{n}^{-1}\left(\frac{\frac{m}{{T}_{t}}{u}_{v1}-{s}_{{\psi}_{d}}{s}_{{\varphi}_{d}}}{{c}_{{\psi}_{d}}{c}_{{\varphi}_{d}}}\right).\hfill \end{array}$$

$${u}_{v}=\left[\begin{array}{c}{u}_{v1}\\ {u}_{v2}\end{array}\right]={K}_{p}e+{K}_{d}\dot{e},$$

#### 3.3. Closed-Loop Stability

The closed-loop stability of the the fully-actuated system Equation (19) in a closed loop with the controller Equation (28) is analyzed. First, let us express the system in a closed loop as:
where $\Delta \left(t\right)$ lumps all uncertainties of the model relative to ${f}_{u}(x,t)$ and ${g}_{u}\left(x\right)$ satisfying $\frac{|{g}_{u}\left(x\right)|}{|{g}_{0}\left(x\right)|}\le {\gamma}_{2}<<1,\forall x$ with $t>0$, respectively. Therefore, we define a new variable:
which includes all uncertainties and external disturbances, which is supposed to be globally bounded by:

$$\dot{s}=\Delta \left(t\right)+d\left(t\right)+{u}_{a},$$

$$\phi \left(t\right)=\u25b5\left(t\right)+d\left(t\right),$$

$$\left|\phi \right(t\left)\right|\le L,\phantom{\rule{28.45274pt}{0ex}}L>0.$$

Thus, Equation (36) becomes:

$$\dot{s}=-{K}_{a}\left(t\right){\left|s\right|}^{1/2}sign\left(s\right)-{k}_{2}s+\phi \left(t\right),$$

Now, in order to verify the stability, we propose the following candidate Lyapunov function:
with $V\left(0\right)=0$ and $V\left(t\right)>0$ for $s\ne 0$. A sufficient condition to guarantee that the trajectory of the error from reaching the phase to sliding mode is to choose a control approach such that it fulfills:

$$V\left(t\right)={s}^{T}s$$

$$\dot{V}\left(t\right)=s\dot{s}<0,\phantom{\rule{28.45274pt}{0ex}}s\ne 0.$$

By substituting Equation (39) into Equation (41), one gets:
stability under the bounded uncertainties/perturbations. ${\phi}_{i}\left(t\right)$ is guaranteed if:
is fulfilled, i.e., the control signal is greater than the uncertainty/perturbation, leading to the following constraint on the adaptive gain:

$$\begin{array}{ccc}\hfill \dot{V}\left(t\right)\phantom{\rule{-0.166667em}{0ex}}& \phantom{\rule{-0.166667em}{0ex}}=\phantom{\rule{-0.166667em}{0ex}}& \phantom{\rule{-0.166667em}{0ex}}s\left(-{K}_{ai}\left(t\right){\left|s\right|}^{1/2}sign\left(s\right)-{k}_{2}s+\phi \left(t\right)\right)\hfill \\ & =\phantom{\rule{-0.166667em}{0ex}}& \phantom{\rule{-0.166667em}{0ex}}-\left|s\right|{K}_{ai}\left(t\right){\left|s\right|}^{1/2}-{k}_{2}{s}^{2}+s\phi \left(t\right)\hfill \\ & \le \phantom{\rule{-0.166667em}{0ex}}& \phantom{\rule{-0.166667em}{0ex}}-\left|s\right|{K}_{a}{\left(t\right)\left|s\right|}^{1/2}-{k}_{2}{s}^{2}+\left|s\right|L\hfill \end{array}$$

$$\begin{array}{ccc}\hfill 0& >& -\left|s\right|{K}_{a}{\left(t\right)\left|s\right|}^{1/2}-{k}_{2}{s}^{2}+\left|s\right|L\hfill \\ \hfill L& <& {K}_{a}{\left(t\right)\left|s\right|}^{1/2}+{k}_{2}\left|s\right|\hfill \end{array}$$

$${K}_{a}\left(t\right)>\frac{1}{{\left|s\right|}^{1/2}}\left(L-{k}_{2}\left|s\right|\right).$$

The stability of the under-actuated part, i.e., the x and y dynamics, is analyzed as follows: recalling that the calculation of the desired roll and pitch angles ${\varphi}_{d},{\theta}_{d}$ and ${\psi}_{d}$ via the virtual controller strategy and due to the attitude control ensures convergence from ${[\varphi ,\theta ,\psi ]}^{T}$ to ${[{\varphi}_{d},{\theta}_{d},{\psi}_{d}]}^{T}$ in spite of the uncertainties/perturbations.

## 4. Simulation and Experimental Results

In this section, with the aim to verify the performance of the proposed embedded flight controller, simulation and experimental tests are carried out.

#### 4.1. Simulation Results

The simulation scheme consists of the controller Equation (28) in closed loop with the quadrotor MAV dynamics Equations (1)–(4). Simulations were conducted through MATLAB Simulink. A second order solver with a sample time of $0.005$ s was implemented. The case of regulation of the actuated system, i.e., $\varphi ,\theta ,\psi ,z$ dynamics was evaluated. On the other hand, the presence of persistent disturbances was considered as well, which is a constant vector of force defined as $d\left(t\right)={[{d}_{\varphi},{d}_{\theta},{d}_{\psi},{d}_{z}]}^{T}={[0.0005,0.0005,0.00005,0.01]}^{T}N$ at time interval $d\left(t\right)>8$ s. This value stands and an excitation of $30\%$ of the energy required for flight. Now, to evaluate the advantages of our adaptive controller, a comparison versus standard nonlinear feedback linearization, represented by Equation (28) with:
with ${K}_{p}>0$ and ${K}_{d}>0$, and also versus the proportional integral derivative with gravity compensation controller, expressed as:
where e and $\dot{e}$ are defined in Equation (25), ${K}_{p}>0$, ${K}_{i}>0$, and ${K}_{d}>0$. Notice that the x and y controllers were not verified due to them being the same for each controller. Figure 2 displays the stabilization of state variables. It is clear that all controllers work properly to convergence to zero, where adaptive sliding mode control presented a better response. Also, the robustness of the controllers to reject external perturbations can be appreciated, where our proposed control rejected better than feedback linearization, which needed information of the perturbations to mitigate them, and than PID control, which due to the integral action, can deal with this problem.

$${u}_{a}={K}_{p}e+{K}_{d}\dot{e}$$

$$u={K}_{p}e+{k}_{i}\int e+{K}_{d}\dot{e}+{[0,0,0,mg]}^{T},$$

In Figure 3, the control input signals are presented. A similar energy consumption is shown, where adaptive sliding mode control (asmc) spent more energy; this is related to the rejection of perturbations. In the end, adaptive gains are illustrated; its behavior verified the design mechanics due to the increase toward convergence and when disturbances appeared.

#### 4.2. Experimental Results

The proposed embedded flight control was implemented in the rolling spider micro quadrotor by Parrot depicted in Figure 1. This experimental platform allowed designing and building flight control algorithms for the Parrot rolling spider. The algorithms were deployed over Bluetooth. Moreover, state information was obtained via sensor fusion from on-board sensors such as the ultrasonic sensor, IMU, air pressure, and the downward-facing camera through Kalman filters, which are defined by the rolling spider toolbox package.

The adaptive sliding mode controller was applied via MATLAB/Simulink, and we used the following control parameters: $k=diag[0.7,0.7,0.7,0.7]$, ${k}_{2}=diag[0.1,0.1,0.1,0.2]$, $\lambda =diag[1,1,1,0.3]$, $\mu =diag[0.05,0.05,0.05,0.02]$, ${K}_{min}=diag[0.01,0.01,0.01,0.01]$. For the position controller, the gains were: ${k}_{p}=diag[0.24,0.24]$ and ${K}_{d}=diag[0.1,0.1]$. Two scenarios were tested. The first one considered the uncertainties of modeling without external perturbation.

#### 4.2.1. Case without Perturbations

In Figure 4, linear and angular responses are plotted, where the roll, pitch, yaw, x, and y variables were forced to converge to zero, while z was commanded to achieve $1.1$ m. Notice that a transition phase is clearly shown; this was always different because of the initial conditions of the experiments differed. Furthermore, the controller was based on the nominal model. Therefore, uncertainties such as parametric variations (the vehicle had external wheels, which increased the weight and inertia moments), battery discharge, and electronic issues (response of the microcontroller, speed controllers of the motors, and more), affect the performance of the vehicle. However, due to the robustness properties of the control, stabilization was guaranteed.

The errors of the state variables with respect to references are illustrated in Figure 5. It is possible to note that the controlled variables by the adaptive sliding strategy, i.e., angles and altitude, kept a small error, less that 0.1 rad, regarding the x and y variables.

Figure 6 shows the applied angular velocities of the motors. Note that Motors 2 and 4 have a negative sign. This is because they spin in the opposite sense with respect to Motors 1 and 3. The adaptive gains of the controllers allow stabilizing once the MAV has achieved the proper altitude.

Figure 7 displays the evolution of the adaptive control gains. It is clear that at the start, the gains increased their values to reach the control objective, then they decreased until a defined minimal value, where stability was guaranteed.

#### 4.2.2. Case with Perturbations

The second scenario considered model uncertainties, as well as external disturbances. Then, a perturbation, which consisted of a force induced by hand, was applied to the vehicle approximately in $t=10$ s. Recalling that this quadrotor MAV is tiny, external disturbances notably affect its performance. Figure 8 displays the state response, where the stabilization was clearly more difficult. Nevertheless, the adaptive flight control could achieve and keep stability even in the presence of such uncertainties and external perturbations.

Figure 9 shows the error response subject to external disturbances.

In Figure 10 as well, the corresponding angular velocities, which are the control inputs of the systems, are depicted. Again, due to its adaptive controller gains, the vehicle achieved and kept stability against uncertainties and external perturbations.

Finally, Figure 11 shows the adaptive control gains’ behavior under a perturbed environment; such a picture demonstrates that gains increase or decrease their values to reject such disturbances.

## 5. Conclusions

An embedded flight control for a quadrotor micro air vehicle subject to uncertainties and perturbations was designed and implemented. An adaptive sliding mode technique was the core of the approach, which was robust against bounded disturbances. Due to adaptive gains, necessary control was employed as the task requirement, reducing the chattering effect, and it was able to reject external perturbations. Even more, a stability analysis of the closed-loop system was provided. Finally, simulations and two experimental scenarios were conducted on a Parrot rolling spider micro drone, first with no perturbations and second disturbed, where the feasibility and advantages of the proposed control were demonstrated.

## Author Contributions

Conceptualization, methodology, and formal analysis H.C.; supervision, J.L.G.

## Funding

This research received no external funding.

## Acknowledgments

The authors thank Sergio Lopez and Horacio Vorrath for their help in achieving the experiments and Laboratorio Nacional de Robotica del Centro y Norte de Mexico and Tecnologico de Monterrey for the facilities to carry out this research project.

## Conflicts of Interest

The authors declare no conflict of interest.

## Abbreviations

The following abbreviations are used in this manuscript:

MAV | Micro Air Vehicle |

UAV | Unmanned Aerial Vehicle |

IMU | Inertial Measurement Unit |

## References

- Cai, G.; Dias, J.; Seneviratne, L. Survey of Small-Scale Unmanned Aerial Vehicles: Recent Advances and Future Development Trends. Unmanned Syst.
**2014**, 2, 175–199. [Google Scholar] [CrossRef] - Mathworks. Parrot Minidrones Support from Simulink. Available online: https://la.mathworks.com/hardware-support/parrot-minidrones.html (accessed on 14 June 2019).
- Available online: https://github.com/Parrot-Developers/RollingSpiderEdu (accessed on 14 June 2019).
- Dydek, Z.T.; Annaswamy, M.A.; Lavretsky, E. Adaptive Control of Quadrotor UAVs: A Design Trade Study With Flight Evaluations. IEEE Trans. Control Syst. Technol.
**2013**, 4, 1400–1406. [Google Scholar] [CrossRef] - Mohd Basri, M.A.; Husain, A.R.; Danapalasingam, K.A. Enhanced Backstepping Controller Design with Application to Autonomous Quadrotor Unmanned Aerial Vehicle. J. Intell. Robot. Syst.
**2015**, 79, 295–321. [Google Scholar] [CrossRef] - Satici, A.C.; Poonawala, H.; Spong, M.W. Robust Optimal Control of Quadrotor UAVs. IEEE Access
**2013**, 1, 79–93. [Google Scholar] [CrossRef] - Gautam, D.; Ha, C. Control of a quadrotor using a smart self-tuning fuzzy PID controller. Int. J. Adv. Robot. Syst.
**2013**, 10, 1–9. [Google Scholar] [CrossRef] - Guo, Y.; Jiang, B.; Zhang, Y. A novel robuts attitude control for quadrotor aircraft subject to actuator faults and wind gusts. IEEE/CAA J. Autom. Sin.
**2018**, 1, 292–300. [Google Scholar] [CrossRef] - Xiong, J.; Zhang, G. Global fast dynamical terminal sliding mode control for a quadrotor UAV. ISA Trans.
**2017**, 66, 233–240. [Google Scholar] [CrossRef] - Xiong, J.; Zheng, E. Position and attitude tracking control for a quadrotor UAV. ISA Trans.
**2014**, 53, 725–731. [Google Scholar] [CrossRef] - Zheng, E.; Xiong, J.; Luo, J. Second order sliding mode control for a quadrotor UAV. ISA Trans.
**2014**, 53, 1350–1356. [Google Scholar] [CrossRef] - Besnard, L.; Shtessel, Y.; Landrum, B. Quadrotor vehicle control via sliding mode controller driven by sliding mode disturbance observer. J. Frankl. Inst.
**2012**, 349, 658–684. [Google Scholar] [CrossRef] - Luque-Vega, L.; Castillo-Toledo, B.; Loukianov, A. Robust block second order sliding mode control for a quadrotor. J. Frankl. Inst.
**2012**, 349, 719–739. [Google Scholar] [CrossRef] - Rida, M.; Cherki, B. A new robust control for minirotorcraft unmanned aerial vehicles. ISA Trans.
**2014**, 56, 86–101. [Google Scholar] [CrossRef] - Ramirez-Rodriguez, H.; Parra-Vega, V.; Sanchez-Orta, A.; Garcia-Salazar, O. Robust Backstepping Control Based on Integral Sliding Modes for Tracking of Quadrotors. J. Intell. Robot. Syst.
**2014**, 73, 51–66. [Google Scholar] [CrossRef] - Sumantri, B.; Uchiyama, N.; Sano, S. Generalized super-twisting sliding mode control with a nonlinear sliding surface for robust and energy-efficient controller of a quad-rotor helicopter. Proc. Inst. Mech. Eng. Part C J. Mech. Eng. Sci.
**2017**, 231, 2042–2053. [Google Scholar] [CrossRef] - Villanueva, A.; Castillo-Toledo, B.; Bayro-Corrochano, E.; Luque-Vega, L.; González-Jiménez, L.E. Multi-mode flight sliding mode control system for a Quadrotor. In Proceedings of the 2015 International Conference on Unmanned Aircraft Systems (ICUAS), Denver, CO, USA, 9–12 June 2015. [Google Scholar]
- Derafa, L.; Benallegue, A.; Fridman, L. Super twisting control algorithm for the attitude tracking of a four rotors UAV. J. Frankl. Inst.
**2012**, 349, 685–689. [Google Scholar] [CrossRef] - Rajappa, S.; Masone, C.; Bulthoff, H.H.; Stegagno, P. Adaptive Super Twisting Controller for a Quadrotor UAV. In Proceedings of the IEEE International Conference on Robotics and Automation (ICRA), Stockholm, Sweden, 16–21 May 2016. [Google Scholar]
- Castañeda, H.; Gordillo, J.L. Spatial Modeling and Robust Flight Control Based on Adaptive Sliding Mode Approach for a Quadrotor MAV. Int. J. Intell. Robot. Syst.
**2019**, 93, 101–111. [Google Scholar] [CrossRef] - Valavanis, K.P.; Vachtsevanos, G.V. Handbook of Unmanned Aerial Vehicles, 1st ed.; Springer: Dordrecht, The Netherlands, 2015. [Google Scholar]
- Haifeng, L. Multivariable Control of a Rolling Spider Drone. Master’s Thesis, University of Rhode Island, Kingston, RI, USA, 2017. Paper 1064. Available online: http://digitalcommons.uri.edu/theses/1064 (accessed on 14 June 2019). [Google Scholar]

**Figure 2.**Regulation. Controllers comparison: adaptive sliding mode control (asmc), feedback linearization (fbl), and proportional integral derivative with gravity compensation control (PID).

**Table 1.**Quadrotor MAV model parameters [22].

Parameter | Value | Unit |
---|---|---|

Weight m | $0.068$ | kg |

Arm length l | $0.062$ | m |

Gravity g | $9.81$ | m/s${}^{2}$ |

Inertia moment ${I}_{x}$ | $6.86\times {10}^{-5}$ | kgm${}^{2}$ |

Inertia moment ${I}_{y}$ | $9.2\times {10}^{-5}$ | kgm${}^{2}$ |

Inertia moment ${I}_{z}$ | $1.366\times {10}^{-4}$ | kgm ${}^{2}$ |

Thrust coefficient ${K}_{T}$ | $0.01$ | N/(rad${}^{2}$/s${}^{2}$) |

Torque coefficient ${K}_{Q}$ | $7.8263\times {10}^{-4}$ | Nm/(rad${}^{2}$/s${}^{2}$) |

© 2019 by the authors. Licensee MDPI, Basel, Switzerland. This article is an open access article distributed under the terms and conditions of the Creative Commons Attribution (CC BY) license (http://creativecommons.org/licenses/by/4.0/).