## Abstract

This chapter presents an adaptive control technique to stabilize the attitude dynamics of unmanned aerial vehicle (UAV) type quadrotor in the presence of disturbances and/or uncertainties in the parameters due to changes in the payload, nonlinear actuators, and change in environmental conditions. To address the above problem, MRAC (model reference adaptive control) strategy is used. In this schema, a cost function is defined as a function of the error between the output of the system and a desired response from a reference model. Based on this error, the controller parameters are updated. To guarantee the global asymptotic stability of the system, Lyapunov’s theory is applied. Simulation results using MATLAB-Simulink platform are presented to demonstrate the convergence of the controller parameters.

### Keywords

- Quadrotor UAV
- adaptive control
- Lyapunov’s method
- aircraft
- attitude control

## 1. Introduction

Unmanned aerial vehicles (UAVs) are aircrafts that do not require a pilot on board to be controlled. In the beginning, they were solely used for military purposes. One of the first applications of these vehicles was aerial photography. In the 1883, an Englishman named Douglas Archibald provided one of the world’s first reconnaissance UAVs. However, it was not until the World War I that UAVs became recognized systems. Since then, they are being widely used in military missions such as surveillance of enemy activity, airfield base security, airfield damage assessment, elimination of unexploded bombs, etc.

In the last decades, advances in technology and costs reduction permitted to adopt this technology in civil applications such as aerial photography, video and mapping, pollution and land monitoring, powerline inspection, fire detection, agriculture, and among other applications [1].

Quadrotors are a kind of mini-UAV’s with vertical take-off and landing, controlled completed through four rotors mounted on each end of the crossed axes, which provide lift forces for the quadrotor move, this vehicle is very popular in the research community due to their special features like strong coupling subsystems, unknown physical parameters, and nonparametric uncertainties in inputs and external disturbances. Therefore, a suitable control system for stabilizing the closed loop control system is required; to do this, various control techniques, linear and nonlinear, have been implemented such as control PD [2, 3], control PID [4, 5], control of position and orientation by vision [6], sliding mode control [1, 7], fuzzy logic [8, 9], and adaptive control in [10].

The dynamic behavior of quadrotor has been published in varying complexity [11, 12]; particularly, the model we used is based on [13], where an extended mathematical description by the full consideration of nonlinear coupling between the axes is presented. We assume elastic deformations sufficient stiffness and realistic flight maneuvers were omitted, mass distributions of the quadrotor are symmetrical in the x-y plane, drag factor and thrust factor of the quadrotor are constant, and air density around the quadrotor is constant.

In this work, we develop an adaptive control strategy to stabilize the attitude dynamics of a quadrotor UAV. The adaptive control permit deals with modeling errors and disturbance uncertainty, variations of the mass, inertia, actuators faults, nonlinear aerodynamics, etc.

This chapter is organized as follows: Section 2 presents the mathematical model of the quadrotor obtained using Newton-Euler equations. Section 3 provides brief introduction about the adaptive control theory and the methodology used is based to obtain the adaptive law equations. In Section 4, simulations and analysis are presented to verify the performance of MRAC schema, and finally in Section 5, conclusions of this work are presented.

## 2. Mathematical model

### 2.1. ESC + motor + propeller

The rotors of quadrotor are modeled by

For * i* = (1, 2…, 4), where

*represents the PWM input, the gain*u

_{i}

*> 0 and*K

*are the rotor bandwidth,*ω

_{M}

*is the actuator dynamics. We assume*v

_{i}

*and*K

*are the same for all rotors [5].*ω

_{M}

### 2.2. Description of Quadrotor system

The configurations of quadrotor are described in Figure 1 and consist of a body-fixed frame denoted by F_{b} = {* F*,

_{bx}

*,*F

_{by}

*}, the center mass that coincident with the body-frame origin denoted by*F

_{bz}

*, the earth-fixed inertial frame is denoted by F*C

_{m}

_{e}= {F

_{ex}, F

_{ey}, F

_{ez}}, the position in earth-fixed inertial frame is given by a vector

*= (*r

_{I}

*,*x

*,*y

*)*z

*, four rotors denoted each one as*

^{T}

*with*M

_{i}

*= (1, 2, …, 4).*i

To obtain the position of CM in the NED (North-East-Down) coordinate system with respect to the inertial frame * F*, we use the Euler angles (roll

_{e}

*, pitch*ϕ

*, yaw*θ

*) combined in a vector Ω = (*ψ

*,*ϕ

*,*θ

*)*ψ

^{T}, where roll angle is generated by differential thrust betweet

M

_{2}and

M

_{4}, pitch angle is generated by differential thrust between

M

_{1}and

M

_{3}, and yaw angle is generated by diferential torque between clock wise and anticlock wise rotors, i.e., (

M

_{1}−

M

_{2}+

M

_{3}−

M

_{4}). This kind of device is considered an underactuated system with six degree of freedom (DOF). Rotation matrix

*is used to map from F*R

_{b}to F

_{e}, applying three consecutive rotations denoted by

where S and C refer to sin and cos function, respectively.

### 2.3. Rigid body dynamics

The dynamics of a rigid body under external forces and moments in the fcan be formulated as follows [14]

_{b}

where * i* = (1, 2, …, 4), ∑

*∈*F

_{i}

*∈*M

_{i}

*is the velocity in the*v

*,*F

_{b}

*is the quadrotor mass,*m

*= (*W

*,*wx

*,*wy

*)*wz

*determines the angular velocity vector which has its origin in at the center of mass of the rigid body, and*

^{T}

*is the inertial tensor of the symmetric rigid body around its center of mass.*J

To obtain the thrust force contribution of each rotor applied to * F*, we use the following formula

_{b}

with * f*force from rotor

_{xi}

*applied in*i

*respect*F

_{b}

*axes,*x

*force from rotor*f

_{yi}

*applied in*i

*respect*F

_{b}

*axes and*y

*force from rotor*f

_{zi}

*applied in*i

*respect*F

_{b}

*axes,*z

*as rotor’s angle speed,*ω

_{i}

*as proportional gain related with air density, the geometry of the rotor blade and its pitch angles. As*k

*and*f

_{xi}

*is zero, since they form an angle of 90 degrees respect to the rotor thrust, rewriting Eq. (6), we have*f

_{yi}

By transforming * F*to F

_{i}

*and making use of the principle of linear momentum, the following equations can be introduced for a quadrotor of mass*

_{e}

*under gravity*m

The rotatory moment of the body is described by Eq. (4) can be rewrite as

where * M*is the vector of external torques and is composed of the thrust differences and drag moments of the individual rotors and under considerations of the rotatory directions and can be calculated by

_{B}

where * d*is called drag factor and it is related with the air resistance,

*is a parameter which represents the length of the lever between center of mass and the four rotors.*L

*is the vector of gyroscopic torques generated due to the propellers rotational movements and can be calculated by the follow formula*M

_{G}

where * J*represents the inertia of rotating rotors. The follow equations permit us to determine the rate of change of the Euler angles in the inertial frame

_{R}

F

_{e}

The relationship that maps rotor angular velocities to forces and moments on the vehicle is

where the variable _{1} = _{1} + _{2} + _{3} + _{4}. The variables _{2} and _{3} correspond the forces from rotors necessary to generate the pitch and roll moments, and _{4} represents the yaw moment.

The translation motion is obtained combining Eqs. (3), (7), (8), and (13), as a result, we have the follow equations

On the other hand, if we assume small perturbations in hover flight,

### 2.4. Linearization of quadrotor dynamics

To simplify the earlier equations, we have linearized the rotatory system around hover state assuming small change in Euler angles, _{1} ≈ * mg*in x and y directions, cos(

*) = 1, sin(*α

*) =*α

*and neglected the gyroscopic torques; therefore,*α

This work only considers the angular momentum corresponding to the orientation of the vehicle, so that the displacement in (x, y, z) axes will not be used for mathematical analysis.

Therefore, the transfer function for dynamic correspondence of orientation is expressed as

and adding rotor’s model, we have

where _{p1} = * Lk*/

_{ϕ}

*,*J

_{x}

K

_{p2}=

*/*Lk

_{θ}

*,*J

_{y}

K

_{p3}=

*/*Lk

_{ψ}

*. These parametres were computed for a X4-flyer and have the following values:*J

_{z}

K

_{p1}=

K

_{p2}= 33.23,

K

_{p3}= 16.95,

*=*a

_{ϕ}

*=*a

_{θ}

*= 4.1 and*a

_{ψ}

*= 0.017. This mathematical model will be used to synthesize the control law to stabilize the closed-loop system [15].*τ

The overall control schema is showed in Figure 2 , where position and attitude control are presented. This schema consist in two loops, first one is used to perform the quadrotor tracking of desired trajectory * r*, while the second one is used to achieve the desired Euler (

_{d}

*,*ϕ

_{d}

*,*θ

_{d}

*). Due that we are only interested in attitude control, the above schema is redrawn as is showed in Figure 3 .*ψ

_{d}

## 3. Adaptive controller design

The adaptive control is an advance control technique which provides a systematic approach for automatic adjustment of controllers in real time, in order to achieve or to maintain a desired level of control system performance, when the parameters of the plant dynamic model are unknown and/or change in time [16]. Two different approaches can be distinguished: indirect and direct approaches. In the first approach, the plant parameters are estimate online and used to calculate the controller parameters. In the second, the plant model is parameterized in terms of the controller parameters that are estimated directly without intermediate calculations involving plant parameter estimates [17].

The model reference adaptive control or MRAC is a direct adaptive strategy which consists of some adjustable controller parameters and an adjusting mechanism to adjust them. The goal of the MRAC approach is adjusting the controller parameters so that the output of the plant tracks the output of the reference model having the same reference input. The MRAC schema is combine two loops: the inner or primary loop where controller and plant are feedback as in normal loop and outer loop or also called adjustment loop where some adaptive mechanisms and a model reference are used to obtain the some performance [18]. In Figure 4 , an overall MRAC schema is presented.

This section presents the design of an adaptive controller MRAC using the Lyapunov‘s stability theory. This allows us to ensure the tracking trajectory of an X4 to our reference model and makes the system insensitive to parameter variation and external disturbances, leading the state error to zero. Based on this, the process model can be represented by state space as follows:

where * A*and

_{p}

*represent the matrix and the vector of unknown constant parameters of the system,*B

_{p}

*is the output signal of the controller, and*u

*is the state vector.*x

The reference model is defined as follows:

Then, the control law is selected as:

where * L*and

_{r}

*are the matrix containing the parameters of the controller, which can be freely selected, and*L

*is the reference signal.*u

_{c}

Substituting (Eq. (22)) in (Eq. (18)), the closed loop system is expressed as follows:

Now we introduce the error equation as follows

Differentiating the error with respect to time, we obtain:

and adding * A*and subtracting to the left side of the equation

_{m}x

The error goes to zero if * A*is stable and

_{m}

If we assume that the closed-loop system can be described by (Eq. (14)), where the matrices * A*and

*depend on the parameter*B

*, and it is some combination of*θ

*and*L

_{r}

*, then we can define the following Lyapunov function for the parameter adaptation law:*L

where * V*is a positive definite function. If its first derivative to time

*is not positive definite, then*V

*is Lyapunov function. Now we can solve the derivative of*V

*to time*V

*.*t

where * Q*is a positive definite matrix such that meet the follow equation:

Therefore, if we choose a stable * A*matrix, we will get always a

_{m}

*and*P

*positive definite matrix.*Q

Accordingly, the derivative to time of function * V*is

Where the function * V*is a Lyapunov function negative semi-definite ensures the output error between the real system and the reference model will tend to be zero, and the system is asymptotically stable.

Thus, we obtain the following parameter adaptation laws

Then, the resulting control diagram is shown in Figure 5 .

## 4. Simulation and analysis

This section presents several simulations test made to prove the performance of MRAC controller to stabilize a mini-UAV quadrotor. As mentioned before, only orientation dynamic (angle position, angular velocity and acceleration) are considered. Analyzing Eq. (18), it is easy to see that roll, pitch, and yaw dynamics are very similar; for this reason, only roll moment is used as example in simulation.

The test begins considering controller parameters are unknown and by using an online adaptive mechanism to determine the values that permit the convergence of plant response to reference model response. It is important to note that the MRAC approach seeks to keep the tracking error (* x* −

*) equal to zero by an adjustment of the controller parameters and do not to seek to identify the real parameters of the plant.*x

_{m}

Figures 6 – 8 shows a comparative between the states response of the plant and the state response of the model reference, where can be observer than all states of the plant converge asymptotical to the reference model states. To verify this, the Figures 9 – 11 are presented; these figures show the tracking error of states goes to zero. Additionally, in Figure 12 , the reference input is compared to the plant and model reference output.

Figure 13 shows the variations of the controller parameters during the adjustment process. This mechanism started many times is necessary to assure the perfect tracking of the plant to the desire response. Finally, in Figure 14 , the simulation diagram is presented.

## 5. Conclusions

This work presents an adaptive control technique to stabilize the attitude of a quadrotor UAV using MRAC schema, which requires no information of the plant model. The asymptotic stability was demonstrated using the well-known Lyapunov’s theory, obtaining in this way the adaptation law of the controller parameters. Simulations results demonstrate that the adaptive control approach proposed have a good performance to perform the asymptotic tracking of model reference output. It is important to note that the adaptive mechanism is started only when it is needed.