Attitude Active Disturbance Rejection Control of the Quadrotor and Its Parameter Tuning

The internal uncertainty and external disturbance of the quadrotor will have a significant impact on flight control. Therefore, to improve the control system’s dynamic performance and robustness, the attitude active disturbance rejection controller (ADRC) of the quadrotor is established. Simultaneously, an adaptive genetic algorithm-particle swarm optimization (AGA-PSO) is used to optimize the controller parameters to solve the problem that the controller parameters are difficult to tune. The performance of the proposed ADRC is compared with that of the sliding mode controller (SMC). The simulations revealed that the dynamic performance and robustness of the ADRC is better than that of the SMC.


Introduction
A quadrotor aircraft is a kind of multirotor helicopter which can realize vertical take-off and landing. It can complete the mission in various harsh environments and is widely used in military and civil fields. With the increase of application fields, the requirements for quadrotor aircraft's actual control effect are higher and higher. There are always internal uncertainty (unmodeled dynamic or parameter uncertainty) and external uncertainty (unknown disturbance of external environment) in quadrotor aircraft, which will lead to a large error between the mathematical model and the actual flight, so the accuracy of attitude control cannot be guaranteed in the real plane, which makes the design of flight controllers more difficult. Early researchers used the Proportional Integral Differential (PID) algorithm to design the flight control system of quadrotor aircraft [1][2][3]. The structure is simple and easy to implement, but the antidisturbance ability is weak, and the control effect is general. Researchers have recently turned their attention to intelligent control, such as the fuzzy control [4][5][6] and neural network [7][8][9]. Although good results have been achieved, it still has the disadvantages of weak robustness and difficulty in improving system performance.
Active disturbance rejection control (ADRC) [10][11][12][13][14] is a new control technology that does not depend on the system model. It can estimate and compensate for the sum disturbance caused by various external disturbances and internal disturbances determined by the system's mechanism in real time. Combined with the exceptional nonlinear state error feedback, excellent control quality can be obtained. ADRC has small overshoot characteristics, fast response speed, high control precision, strong antidisturbance ability, and simple structure [15,16]. Reference [17] designed an ADRC based on an improved extended state observer for multiple-input multiple-output systems and achieved good control results. Reference [18] designed four improved ADRC for the nonlinear model of a 6-DOF quadrotor system for height and attitude stabilization and compared the PID controller's performance. The simulation results showed that the improved ADRC is stable and can offset external disturbance and system uncertainty, which is better than the PID controller.
The defect of ADRC is that there are many controller parameters, so it is difficult to tune the controller parameters. The particle swarm optimization (PSO) algorithm is widely used in the optimization of controller parameters. This method integrates the idea of "individual learning" by simulating the foraging activities of natural creatures. The algorithm is simple and has a memory function, and it also has the characteristics of rapid convergence [19][20][21]. Reference [22] used the PSO algorithm to optimize the parameters of the ADRC and achieved good results. However, the PSO algorithm's global search ability is low, the search accuracy is not high, and it is easy to fall into the optimal local solution [23]. The genetic algorithm (GA) is a natural optimization algorithm with a diverse population and strong global search ability [24]. Reference [25] used GA to optimize the ADRC's parameters and achieved good results. Because of this, this paper proposes an adaptive genetic algorithm-particle swarm optimization (AGA-PSO), which combines the excellent global search ability of AGA to avoid particles falling into the local extremum prematurely, thus increasing the rate of obtaining optimal global solution and accelerating the convergence speed of the algorithm.
Aiming at the quadrotor's attitude control problem, this paper designs an ADRC strategy by analyzing the mathematical model of the quadrotor and considering the uncertain internal disturbance and external disturbance of the system. Aiming at the problem that the ADRC's parameters are difficult to tune, a parameter tuning method of the ADRC based on the AGA-PSO hybrid optimization algorithm is designed. Its effect is verified through simulation experiments. Finally, the quadrotor's attitude control with disturbance is simulated, which demonstrates the robustness and antidisturbance of the ADRC.  Figure 1 is a typical nonlinear controlled plant. Four-rotor systems generate control forces and control moments and form attitude motion under control forces and control moments. Therefore, the controlled plant of the quadrotor is a multiple-input multiple-output nonlinear system. The specific parameters of the quadrotor are shown in Table 1. The figure shows two sets of coordinate systems, namely, the North-East-Earth navigation coordinate system (indicated by G, the origin is at the take-off point, the coordinate axis x G points north, y G points east, and z G is perpendicular to the ground down) and the aircraft body coordinate system (represented by P, the origin is at the center of mass of the body, the coordinate axis x P is parallel to the plane of the paddle and points forward, y P is parallel to the plane of the paddle and points to the right, and z P is perpendicular to the plane of the paddle and points downward).

ADRC for Quadrotor Attitude Control
Assuming that the quadrotor is a uniformly symmetrical rigid body, and ignoring factors such as the rotor gyro effect, References [26,27] obtain the quadrotor attitude mathematical model as follows.
where ψ, θ, and ϕ are the yaw angle, pitch angle, and roll angle, respectively; u 1 , u 2 , u 3 , and u 4 are the voltage of the 4 rotor motors; l is the distance from the rotor axis to the center of mass of the quadrotor; J x , J y , and J z are the moment of inertia of the pitch, roll, and yaw axes, respectively; K L is the propeller lift coefficient; K s is the clockwise torque coefficient of the rotor; and K n is the counterclockwise torque coefficient of the rotor. The attitude angle dynamic equations are second-order nonlinear coupled equations, so that the unknown nonlinear function of each attitude angle dynamic equation is the unknown disturbance quantity is ω 1 , ω 2 , and ω 3 , and the virtual control quantity is recorded as ; then, the three-axis attitude angle dynamic Figure 1: Schematic diagram of the quadrotor shape and coordinate system.
and the dynamic coupling ω i + f i ð•Þ of the internal and external disturbances is estimated by ESO through state expansion and is dynamically compensated as the feedback signal of the control law. The system becomes a linear integrator series control system. The system output after dynamic compensation linearization is Y = y 1 y 2 y 3 ½ T = θ ϕ ψ ½ T . The actual control quantity U = u 1 u 2 u 3 u 4 ½ of the four motors of the quadrotor is obtained by transforming the virtual control quantity, namely, 2.2. ADRC Features. ADRC consists of the tracking differentiator (TD), extended state observer (ESO), and state error nonlinear control law (SENCL), as shown in Figure 2. TD is used to quickly obtain the tracking signal and its derivative signal of the input signal. ESO estimates the extended state formed by the state quantity, internal uncertainty, and external disturbances. Then, the nonlinear combination of the state quantity's error is used as the control quantity of the system to realize the effective control of the quadrotor.

TD.
Taking the second-order system as an example, a discrete form of the nonlinear tracking differentiator is designed as follows: The output state variable x 1 ðkÞ is the fast tracking signal of the input signal vðkÞ, and the state variable x 2 ðkÞ is its differential signal. It not only overcomes the influence of noise signal amplification but also eliminates the phenomenon of origin flutter. In the formula, k is expressed as the k-th moment of signal sampling, h is the discrete sampling time step, r is the speed factor, and the h and r parameters are adjustable, which determine the speed of the output signal tracking.

Simulation Verification of TD.
Given the input signal vðtÞ = 4 cos ð2πtÞ + nðtÞ, as shown in Figure 3, the discrete sampling period is h = 0:001, the velocity factor is r = 800, and the noise signal nðtÞ is the random white noise of amplitude 2.
When a classic differentiator implemented with a short time constant inertia link performs signal differentiation processing, the differentiator's signal amplification effect is Figure 2: Block diagram of ADRC. 3 International Journal of Aerospace Engineering noticeable. Equation (15) is the classic differentiator processing formula.
Record the output of the second inertia link as v = ð1/Ts + 1Þv; then, when the input signal changes slowly and the time constant T is small, there is Obviously, the smaller the time constant T, the closer the output yðtÞ is to the derivative _ vðtÞ.
The tracking signal and differential signal simulation results of the classical differentiator and tracking differentiator are shown in Figure 4. The noise amplification effect of the products shown in Figure 4(a) is noticeable. As shown in Figure 4(b), the noise suppression effect of the results is noticeable.

ESO. Suppose the nonlinear uncertain plant with external disturbance is
Let x 3 = f ðx, w, tÞ + ðbðtÞ − b 0 Þu be the new expanded state variable, and x 3 contains its own uncertainties and Ideal signal TD-signal Ideal differential signal TD-differential signal (b) Output tracking signal and differential signal of TD  International Journal of Aerospace Engineering external disturbances; let _ x 3 = gðtÞ, and the system (17) expands into a new control system, namely, where u and y are the input and output signals of the system; f ðx, w, tÞ is the unknown nonlinear system function; wðtÞ is the disturbance; x and _ x represent the corresponding derivative of x; and b 0 is the compensation coefficient.
Design the following ESO for the extended system (18) of the system (17).
where λ i > 0 (i = 1, 2, 3, ⋯, n), β i (i = 1, 2, 3, ⋯, n + 1) is the gain coefficient, ζ is the step size, and falð•Þ is the saturation nonlinear function; the output variable of ESO (19) can track the state variable of the system (18), namely,    The estimated value z n+1 of the expanded state variable is used as a compensation value for the unknown plant and external disturbance, which linearizes the controlled system and can effectively suppress the interference signal in the state variable.
The control signal of the system (17) is designed as u = Under the extended state estimation value compensation, the system becomes linear controlled plants, namely, that is, the dynamic compensation linearization processing of the nonlinear controlled plant. The essence of the system (18) is to regard the series part of the system (17) which is different from the standard integral series type as the total disturbance (including internal disturbance and external disturbance). ESO estimates the total disturbance by using the input and output information of the system and compensates for the total disturbance by designing a control law, thus transforming the system into a standard integral series structure.

SENCL.
Taking the second-order system as an example, a SENCL algorithm using a combination of fal functions is where v 11 and v 21 are the tracking signal and differential signal of TD, respectively; β 01 and β 02 are the adjustable control Increase β 1 to suppress the overshoot of the system, but too large will lead to longer rise time β 2 Increase can reduce the steady-state error of the system, but too large will cause oscillation β 3 Increase can reduce the lag of ESO's estimation of the total disturbance of the controlled system, but too large will cause oscillation ζ 1 Too large causes the current linear feedback to be too large, ESO cannot track the nonlinear signal well, and too small will cause jitter SENCL β 01 Too large causes the system overshoot to increase, the rise time becomes shorter, and the system oscillates β 02 Increase can reduce the oscillation, but too large will lead to longer rise time ζ 2 Same as ζ 1  International Journal of Aerospace Engineering gain; and fal function can effectively suppress the occurrence of signal chattering and has a good signal filtering effect.
After discretizing the abovementioned continuous domain controlled plant, simulation is performed with a square wave signal with an amplitude of 2. TD is designed according to Section 2.2.1, ESO is designed according to Section 2.2.3, and SENCL is designed according to Section 2.2.4; the relevant parameters are shown in Table 2.
The simulation results are shown in Figure 5. z 1 , z 2 , and z 3 are the state estimates of ESO that respond to the process curve; x 1 , x 2 , and x 3 are the response curves of the system (25) state variables and expansion state. It can be seen from the figure that the output estimation value of ESO can track the state variables of the system well, including the extended  Figure 6 shows the results of the square wave input control response under the action of SENCL, including the white noise to measure the interference signal. It can be seen that the control has no overshoot and can quickly enter a stable state, indicating that the controller has strong robustness.  Table 3 lists the parameters and functions of the ADRC that need to be tuned. It can be seen that the ADRC needs to tune 9 parameters, of which ζ 1 and ζ 2 are predetermined according to the characteristics of the controlled plant and do not need to be changed within a certain range. For this reason, the following AGA-PSO algorithm only sets 7 parameters.

AGA-PSO.
The core idea of the AGA-PSO algorithm is to use the PSO algorithm to quickly find the neighborhood of the global optimal solution to form a new population, in which the AGA is used to obtain the optimal global solution. Its advantage is to avoid the blindness of the initial stage of the AGA and shorten the global convergence time. The advantages of the two algorithms complement each other to achieve rapid acquisition of the optimal global solution. Figure 7 shows the relationship between the two algorithms.
Suppose that a population fX i g is composed of N particles, a single particle is composed of a D-dimensional space, and its position and velocity are described as The particle velocity determines the search direction of the particle, and the position x i of each particle is a potential solution to the target problem. The optimal position found by a single particle individual is the individual optimal, denoted as The optimal position found by all the particles in the population is the global optimal, denoted as g best = p g1 , p g2 , p g3 ,⋯,p gD : ð29Þ The particle individual optimization search velocity and position update formulas are where r 1 and r 2 are random numbers between ½0, 1, c 1 and c 2 are learning factors, w is the inertia weight, v ij is the particle velocity, and x ij is the particle position. Inertia weight w determines the influence of the previous velocity on the current velocity. A large w is good for the particles to jump out of the optimal local solution, where w min and w max are the minimum and maximum values of w, respectively; f is the current fitness of particles; f avg and f min are the average fitness and minimum fitness of all particles, respectively. The integral time absolute error (ITAE) criterion is used to calculate the particle fitness of a single control loop.
where jeðtÞj is the absolute value of the difference between the input and the actual output of the control system. The smaller the fitness value is, the better the solution is. The fitness calculation formula of the whole control system is where H is the number of channels in the control system and Q i ðtÞ represents the channel input signal, so as to ensure that the influence weight of each channel error on the fitness value is the same, that is, normalization processing.
The process of the PSO algorithm is as follows: (1) The particle swarm is randomly initialized, including the number of particles and the position and velocity of each particle. The dimension of each particle   (4) Analyze and determine the optimal solution of the current individual particle and the optimal global solution of the particle swarm, and update p best and g best (5) Judge whether it has reached the number of iteration steps; if it is satisfied, output the final p best and the corresponding fitness value, jump out of this algorithm, and enter the subsequent process; otherwise, return to (2) The parameters of the ADRC obtain the global optimal neighborhood solution through the PSO algorithm. Then, through the iterative operation of selection, crossover, and mutation of the AGA, the target problem gradually approaches the optimal global. The process is as follows: (1) Coding. Use real number codes to initialize population genes.
(2) Selection. Take out a certain number of individuals from the population, select them according to their fitness, and enter the progeny population to reproduce until the new population size is the same as the original population size.
(3) Crossover. As a core operation of the genetic algorithm, new individuals can be obtained, that is, new possible solutions. If the crossover probability is too large, the randomness of the algorithm is too strong, and the convergence speed of the algorithm is too slow to effectively suppress premature maturity. The adaptive crossover probability operation as shown below will benefit parameter optimization:  where f c is the larger fitness of the cross individuals; f avg is the average fitness of the population; and generally, k 1 = 0:9 and k 2 = 0:6.
Randomly select two chromosomes from the population for crossover. First, determine the crossover probability P c by formula (35) and then generate a random number in the range ð0, 1Þ. When the random number is more significant than P c , use the arithmetic crossover to develop a new chromosome. Otherwise, no crossover will be formed. The specific operation of the cross is as follows: where p k i is the chromosome before crossing, C k i is the chromosome after crossing, and λ is a constant. When two chromosomes are crossed, two chromosomes are randomly selected for crossover operation again until the crossing times reach the set number.
(4) Mutation. As another core operation of the genetic algorithm, it can also obtain new individuals, that is, new possible solutions. If the mutation probability is too large, it will weaken the inheritance of excellent genes. If it is too small, it will easily fall into the local optimum, which cannot optimize the parameters.
The following adaptive mutation probability operation is beneficial to parameter optimization: where f is the fitness of the variant individual; f max is the maximum fitness of the population; and generally, k 3 = 0:1 and k 4 = 0:01. A chromosome is randomly selected from the population to mutate. Firstly, the mutation probability P m is determined by formula (39), and then a random number in the range of ð0, 1Þ is generated. When the random number is greater than P m , the polynomial mutation method is used to mutate; otherwise, no mutation will be carried out. The specific operation of mutation is as follows: where c i is the quasimutated gene, c i ′ is the mutated gene, u is a random number between ð0, 1Þ, η is the distribution index, and △ max is the maximum allowable disturbance range. After

12
International Journal of Aerospace Engineering the chromosome mutation is completed, a chromosome is randomly selected for mutation operation again until the mutation number reaches the set number.
In summary, the schematic diagram of the combination of the AGA-PSO algorithm and the ADRC system is shown in Figure 8. The flow of the AGA-PSO algorithm is shown in Figure 9. The process is as follows: (1) Initialize the AGA-PSO algorithm parameters, including c 1 , c 2 , w min , and w max of PSO, maximum evolution algebra NG, and other parameters (2) Generate a population randomly and then enter the PSO algorithm flow (3) Judge whether the solution result of the PSO algorithm has reached the global optimal solution condition (the minimum fitness value is less than the set value). If the result is satisfied, the result will be directly output as the controller optimization parameter. Otherwise, the global optimal neighborhood solution obtained by the PSO algorithm will be substituted into the AGA for encoding, selecting, crossover, and mutation operations to seek the optimal global solution (4) Individuals of the new population enter the ADRC system simulation and calculate the fitness value to determine whether the number of iteration steps is reached (the minimum population fitness is less than the set value, or the number of iteration steps is reached). Then, it is determined whether the termination condition is met (the minimum population fitness is less than the set value). If it is satisfied, the optimization result will be output, and the controller optimization parameters will be obtained. Otherwise, it will return to the PSO algorithm flow 3.3. AGA-PSO Algorithm Verification. Figure 10 shows the control structure block diagram of the three-axis attitude ADRC, which is composed of three control loops: yaw angle, pitch angle, and roll angle. Each attitude loop needs to tune 7 parameters, and three loops need to tune a total of 21 parameters. The specific parameters of AGA-PSO and PSO are shown in Table 4. Given a step and square wave signal with an amplitude of 5°, Figures 11 and 12 show the attitude response and convergence curves of the unoptimized PSO and AGA-PSO algorithms, respectively. It can be seen that the AGA-PSO algorithm has a shorter adjustment time for the three attitude loops than the PSO algorithm, and the overshoot is smaller, indicating that the AGA-PSO algorithm is feasible.

Simulation Verification of Attitude Control
The initial condition of simulation is as follows: set the yaw angle, pitch angle, and roll angle as 3°, and the simulation time is 30 s. The expected input of each loop is a square wave signal with an amplitude of 3°. The sliding mode controller (SMC) and the ADRC with the same control structure are selected. The AGA-PSO algorithm tuning ADRC parameters is shown in Table 5. The SMC is designed according to the literature [28], and the specific parameters are shown in Table 5. Figure 13 shows the simulation results of the ADRC and SMC attitude angle control loops. It can be seen that the ADRC can track the set values of the three attitude loops more quickly without evident overshoot and steady-state error, which indicates that the ADRC attitude loop has better system performance.
To verify the ability of ADRC to overcome the model uncertainty (internal uncertainty), the ADRC and SMC parameters shown in Table 5 are kept unchanged, while the model parameter values are reduced by about 20%, as shown in Table 6. The simulation result is shown in Figure 14. It can be seen that the control performance of ADRC has little change, while the control performance of SMC has dropped sharply, and the three attitude angles can no longer be effectively controlled. This experiment shows that even if the internal parameters of the quadrotor change greatly, the ADRC can still maintain stable control performance.
In order to verify the resistance of ADRC to external disturbances, a step signal with an amplitude of 4°is given and a white noise with a peak value of 3°is added as an external disturbance in the attitude loops. The ADRC and SMC parameters are shown in Table 7. The simulation results shown in Figure 15 are obtained. It can be seen that the SMC has obvious oscillation in three attitude loops. However, the ADRC still keeps a good control effect, which shows that the ADRC designed in this paper has good response ability of tracking step input, and the control system also has better antidisturbance performance.

Conclusion
In this paper, the ADRC for attitude loops is designed by analyzing the quadrotor's dynamic attitude model. At the same  (1) The AGA-PSO algorithm combines the global convergence of the AGA and the fast convergence of the PSO algorithm. Compared with the unmodified PSO algorithm, the AGA-PSO algorithm's performance is much improved, and a better controller parameter optimization effect is achieved (2) Each loop of ADRC has better dynamic tracking performance, small steady-state error, short adjustment time, strong disturbance rejection, and better robustness than that of SMC (3) The ADRC can effectively suppress disturbance by observing and compensating the internal uncertainty and external disturbance of the system

Data Availability
The data is simulated by MATLAB. All of the used data can be verified and replicated by reading the manuscript and simulation. 14 International Journal of Aerospace Engineering