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

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.


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.
The organization of this paper is as follows: Section 2 provides the modeling of the micro air vehicle, whereas the design of the embedded flight controller is detailed in Section 3. Experimental results are described in Section 4. At the end, some conclusions are given.

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 p = [x, y, z] T ∈ R 3 and Θ = [φ, θ, ψ] T ∈ {−π, π}, which are the linear and angular positions, respectively in the inertial reference frame, whereas ν = [u, v, w] T ∈ R 3 and ω = [p, q, r] T ∈ 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 R 1 (Θ) ∈ SO(3) and R 2 (Θ) ∈ R 3×3 transform the body frame to inertial frame. The matrices are denoted by: and: where s x , c y , and t z are sin(x), cos(y), and tan(z), respectively. The inertia assuming that the vehicle is symmetric I ∈ R 3×3 is given by: 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 Ω i for i = 1, 2, 3, 4 is the angular rate of the i 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., τ φ , τ θ , τ ψ , τ, which represent the roll, pitch, yaw, and throttle torques, respectively, are explicitly given by: Finally, the parameters of the rolling spider micro drone are displayed in Table 1. Table 1. Quadrotor MAV model parameters [22].

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 φ, θ, ψ and z dynamics and an underactuated system, corresponding to the x and y dynamics. Hence, the model for control design purposes is given by: 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.

Actuated System
Consider the uncertain and disturbed actuated dynamics as: where the state is denoted by ζ = [φ, θ, ψ, z] T , and: , and d(t) includes uncertainties and perturbations satisfying |d(t)| ≤ L, where L > 0 is an upper bound of the perturbation. Hence, by defining the error as: where are the tracking references. Now, we define the following sliding surface: where λ > 0. Then, deriving Equation (26), one gets: Thus, considering a feedback controller: where the auxiliary control u a is given by the following adaptive sliding mode strategy: where K a (t) 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. µ 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.

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: Now, given a desired trajectory x d , y d , ψ d , the x, y positions can be reached via desired roll and pitch angles φ d , θ d . From Equation (18), the following virtual control is obtained: where: where K p > 0 and K d > 0.

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 ∆(t) lumps all uncertainties of the model relative to f u (x, t) and g u (x) satisfying |g u (x)| |g 0 (x)| ≤ γ 2 << 1, ∀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: Thus, Equation (36) becomes: Now, in order to verify the stability, we propose the following candidate Lyapunov function: with V(0) = 0 and V(t) > 0 for s = 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: By substituting Equation (39) into Equation (41), one gets: stability under the bounded uncertainties/perturbations. ϕ i (t) 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: 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 φ d , θ d and ψ d via the virtual controller strategy and due to the attitude control ensures convergence from [φ, θ, ψ] T to [φ d , θ d , ψ d ] T in spite of the uncertainties/perturbations.

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.

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., φ, θ, ψ, 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 with K p > 0 and K d > 0, and also versus the proportional integral derivative with gravity compensation controller, expressed as: where e andė 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. 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.

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.

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.

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.

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.
Funding: This research received no external funding.