# Sensor Fault Diagnosis and Fault Tolerant Control of Quadrotor UAV Based on Genetic Algorithm

Authors: Lianghao Hua; Jianfeng Zhang; Dejie Li; Xiaobo Xi; Mohd Asif Shah
Journal: Journal of Sensors
 (2022)

---

## Abstract

The quadrotor drone is small in size and light in weight, the mechanical structure is simple, and the requirements for the working environment are low. The development of a quadrotor UAV technology is also the focus of the current technical personnel. The author proposes a four-rotor UAV sensor fault diagnosis and fault-tolerant control based on genetic algorithm and introduces common sensor failures, and based on the improved BP neural network of the GA algorithm, the genetic algorithm is improved. This paper uses a classical BP algorithm, a classical GA-BP algorithm, and an improved GA-BP algorithm for training. Using a total of 150 sets of training data and training function using LevenbregMarquardt (trainlm), MeanSquaredError (performance function using mse), in the same noise background, the improved GA-BP algorithm has the highest detection rate, the classical GA-BP algorithm followed, and classical BP algorithm is the worst. Therefore, using the improved GA-BP algorithm, various errors of the sensor can be detected quickly and accurately.


---

## Body

## 1. Introduction

The quadrotor unmanned aerial vehicle is a kind of direct torque that achieves six degrees of freedom (position and attitude) control and a small UAV system that can take off and land vertically [1]. It is multivariable and nonlinear, has strong coupling and interference sensitivity, and is a multirotor unmanned aerial vehicle with strong maneuverability and simple structure. The micro-multirotor drone has the following advantages: small size and lightweight, low requirements for the working platform and space environment, even the requirements for take-off and landing space are not high [2]. It can be in a relatively small and enclosed space; in order to complete the specified tasks, the flight altitude requirements are low; it can work close to the ground; and the requirements for the working environment are also low—even if it is complex and harsh, it can work [3]. The mechanical structure design is relatively simple, and the cost of components is low, but it also guarantees a certain degree of reliability [4]. Using it in the fields of military operations and civil aerospace, there is a broad space for development and application [5]. At present, military and commercial use generally choose quadrotor drones; compared with other types of multirotor drones, the mechanical structure design of the four-rotor UAV aircraft is simpler and the volume of the aircraft can be made smaller. And its output control volume is also small; the lift provided by the quadcopter is already enough to bear the general load [6]. Therefore, quadrotor drones can currently play a role in many fields. The development of the quadrotor UAV technology is also the focus of current scientific research workers. It is also one of the hot research issues that many countries are vigorously developing. A fault detection process for a UAV longitudinal flight control system based on nonlinear adaptive observer is shown in Figure 1 [7].Figure 1
Control system fault detection process.


## 2. Literature Review

In response to this research question, Peng et al. proposed fault diagnosis and fault-tolerant control: as the name implies, fault diagnosis part and fault tolerance control part. These two parts can be designed separately in the general system, but they are interdependent on and complement each other. Fault detection and diagnosis are the basis for achieving fault tolerance control [8]. Khil et al. suggested that, in general, some functions of the actuator mechanism that are partially disabled, or have failed completely, are defined as actuator failure. This type of fault is in fault diagnosis and separation research, the most common type of failure. If we follow the severity of its failure, the fault can be further divided into partial failure (the output of the actuator has an error, but there are some basic functions) and completely invalid (the actuator completely loses its original function); that is, regardless of the input signal, the actuator will not make any response [9]. Wang et al. believe that when the sensor cannot output with high precision or outputs wrong data or no data, the performance of these sensors can be considered a sensor failure [10]. Chen et al. believe that according to the degree of impact caused by the failure, it can also be classified as complete failure—that is, the reading of the sensor has nothing to do with the actual status information of the system— and partial failure—that is, the reading deviates from the true state of the system, but its readings still have a certain reference value [11]. Chung et al. in their work on a knowledge-based fault diagnosis method proposed that, due to the characteristics of prior knowledge of the model, it is generally used in the fault diagnosis of offline systems [12]. Yang et al. on the XV215 tilting propeller platform use the extended adaptive neural network for fault diagnosis to test and verified on this basis a nonlinear adaptive controller structure, which can perform fault diagnosis and is very effective [13]. Yang et al.’s paper is based on the analytical model method. Its realization idea can be explained in detail as making full use of existing knowledge in order to build a mathematical model of the system, then pass the input and output of the system to the established mathematical model [14]. Vahidi-Moghaddam et al. designed another one for an actuator fault diagnosis based on the analytical model and fault diagnosis method; this method is also based on the Romberg observer residue generation method [15]. Guangming used the Romberg observer residue generation method and applied it to the sensor fault diagnosis of the unmanned helicopter control system. Finally, the method passes simulation and actual flight test and proved that its application in sensor fault diagnosis is effective [16]. Rajeswari and Neduncheliyan also proposed a brand new sensor fault diagnosis method based on the analytical model; this method constructs a set of full-order unknown observers in order to estimate the local state of the system. Moreover, these local state estimates do not require any local information. Finally, the residual error of the observer is used to detect and reconstruct the fault signal [17]. Nguyen and Ha tested the extended adaptive neural network for fault diagnosis on the XV215 tilt paddle rotor platform and verified that the nonlinear adaptive controller structure can be fault diagnosis and very effective [18]. On the basis of current research, the author proposes a four-rotor UAV sensor fault diagnosis and fault-tolerant control based on genetic algorithm and introduced common sensor failures, and based on the improved BP neural network of the GA algorithm, the genetic algorithm is improved. This paper considers the fault of the accelerometer sensor and designs three detection models using MATLAB—the first is the classical BP neural network detection model, the second is the classical GA-BP neural network detection model, and the third is the improved GA-BP neural network detection model—so as to compare the advantages of the three models. The neural network constructed in this paper has three layers: a transmission layer, a hidden layer, and an output layer—100 neurons in the transmission layer, 6 neurons in the hidden layer, and 1 neuron in the output layer. It is very necessary for us to perform fault diagnosis and fault-tolerant control of the actuator mechanism of the quadrotor UAV: on the one hand, it can improve the safety of the entire quadrotor UAV control system, and on the other hand, it can ensure that the entire quadrotor UAV system is not affected by external environmental factors, maintaining the stability of the system.


## 3. Methods

### 3.1. Common Sensor Failures

The main sensor faults studied by the author are sensor stuck, sensor gain change, and sensor constant deviation. Supposecout is actually output, cin is normal output, and i=1,2,⋯,m.(1)Failure phenomenon: this phenomenon is mainly stuck due to the failure of the mechanical parts of the actuator or the lack of mechanical lubrication. Regardless of any adjustment and change of the input signal of the actuator, the output of the actuator maintains a fixed value. This failure type will have a serious impact on the stability of the system and is a complete failure fault. The sensor is stuck:
(1)cioutt=αi,whereai is a constant(2)Sensor gain change:
(2)cioutt=βicint,whereβi is the proportional coefficient of gain change(3)Constant deviation of sensor:
(3)cioutt=βcint+Δ,whereΔ is a constant(4)Pine float: the main sign of failure is that the voltage signal interrupted, resulting in the free deflection of the operating surface and the actuator produces no control force, the output of the actuator is zero, so the propeller stops turning(5)Saturate: the main sign of failure is that the actuator enters saturation after the one-set limit value. The input signal cannot drive the actuator, the actuator is stuck in the limit state of the saturation value, the essence of the time dead failure, which can be described as:
(4)uFt=satut(6)Failure: the main failure signs are the reduced gain of the actuator, the output control signal is not consistent with the actual situation, the function of the actuator changes compared with the expected situation, and the system control parameter value changes, which leads to the decline of the flight performance of the aircraft. The failure of the deviation also includes constant deviation, drift, and precision damage


### 3.2. Improved BP Neural Network Based on GA Algorithm

The BP neural network contains an input layer, an output layer, and a hidden layer. The BP algorithm divides the training process into two steps. In the forward operation stage, the signal is transmitted from the loser and the layer to the output layer, reducing the actual value and the expected value to obtain the residual signal. If the error requirement is not met, the residual signal is transmitted from the output layer to the loser layer, and the error is assigned to the connection weights are adjusted according to the error. The BP algorithm is to find the minimum error, using the steepest descent method, the gradient of the error is obtained, and adjust the weight according to its negative gradient direction. In order to illustrate the BP algorithm, first define the error functionε. Subtract the expected output from the actual output, and the squared sum of the difference is used as the error function, then:
(5)ε=12∑i=1mcit−c∧t2.Among them,cit is the expected output, and c^it is the Δωijactual output.The BP algorithm adjusts the weight according to the negative gradient direction of the errorε, then the modification amount Δωij of weight ωij is:
(6)Δωijn=−ηgn+αΔωijn−1.Among them,α is the momentum factor, n is the number of iterations, η is the adaptive learning rate, and gn is the gradient of the error function to the weight [19].


## 3.1. Common Sensor Failures

The main sensor faults studied by the author are sensor stuck, sensor gain change, and sensor constant deviation. Supposecout is actually output, cin is normal output, and i=1,2,⋯,m.(1)Failure phenomenon: this phenomenon is mainly stuck due to the failure of the mechanical parts of the actuator or the lack of mechanical lubrication. Regardless of any adjustment and change of the input signal of the actuator, the output of the actuator maintains a fixed value. This failure type will have a serious impact on the stability of the system and is a complete failure fault. The sensor is stuck:
(1)cioutt=αi,whereai is a constant(2)Sensor gain change:
(2)cioutt=βicint,whereβi is the proportional coefficient of gain change(3)Constant deviation of sensor:
(3)cioutt=βcint+Δ,whereΔ is a constant(4)Pine float: the main sign of failure is that the voltage signal interrupted, resulting in the free deflection of the operating surface and the actuator produces no control force, the output of the actuator is zero, so the propeller stops turning(5)Saturate: the main sign of failure is that the actuator enters saturation after the one-set limit value. The input signal cannot drive the actuator, the actuator is stuck in the limit state of the saturation value, the essence of the time dead failure, which can be described as:
(4)uFt=satut(6)Failure: the main failure signs are the reduced gain of the actuator, the output control signal is not consistent with the actual situation, the function of the actuator changes compared with the expected situation, and the system control parameter value changes, which leads to the decline of the flight performance of the aircraft. The failure of the deviation also includes constant deviation, drift, and precision damage


## 3.2. Improved BP Neural Network Based on GA Algorithm

The BP neural network contains an input layer, an output layer, and a hidden layer. The BP algorithm divides the training process into two steps. In the forward operation stage, the signal is transmitted from the loser and the layer to the output layer, reducing the actual value and the expected value to obtain the residual signal. If the error requirement is not met, the residual signal is transmitted from the output layer to the loser layer, and the error is assigned to the connection weights are adjusted according to the error. The BP algorithm is to find the minimum error, using the steepest descent method, the gradient of the error is obtained, and adjust the weight according to its negative gradient direction. In order to illustrate the BP algorithm, first define the error functionε. Subtract the expected output from the actual output, and the squared sum of the difference is used as the error function, then:
(5)ε=12∑i=1mcit−c∧t2.Among them,cit is the expected output, and c^it is the Δωijactual output.The BP algorithm adjusts the weight according to the negative gradient direction of the errorε, then the modification amount Δωij of weight ωij is:
(6)Δωijn=−ηgn+αΔωijn−1.Among them,α is the momentum factor, n is the number of iterations, η is the adaptive learning rate, and gn is the gradient of the error function to the weight [19].


## 4. Improved Genetic Algorithm

The basic GA algorithm has a good solution ability for the unimodal function, but the nonlinear problem in practice is very serious, so it is very necessary to improve the algorithm. This paper effectively improves the accuracy of the algorithm by adjusting the coding method while improving parameters such as crossover and variant operator.


### 4.1. Hybrid Coding Scheme

The advantage of binary coding is simple operation, the search ability is strong, and the real number coding is characterized by high precision and fast efficiency [20]. In this paper, we combine binary and real number coding optimization. This hybrid encoding approach increases the genetic search range while improving the algorithm accuracy.


### 4.2. Selection of Fitness Function

The fitness value is expressed as:(7)fXi=eXi−1.The objective function is expressed as:(8)eXi=12n∑j=1n∑k=1mcjk−qjki2,whereqjki is the output of the jth node of the kth input, cjk is the expected output, n is the number of training samples, and m is the number of output neurons [21].


### 4.3. Mixed Selection Operator

The author’s selection operation is divided into the following steps: sort by fitness value, then randomly selectm samples, and cross and mutate m samples [22]. Keep the best sample of the parent.


### 4.4. Crossover Operator

When coding real numbers, use an arithmetic crossover operator [23]. The arithmetic crossover operator can be expressed as follows:
(9)Ci1=Pi1+ai1Pi2−Pi1,i=1,2,⋯,nCi2=Pi2+ai2Pi2−Pi1,i=1,2,⋯,n,whereCi1, Ci1 are the individuals after crossover, Pi1,Pi2 are the individuals before the crossover, and ai1, ai2 are random numbers from 0 to 1 [24].


### 4.5. Mutation Operator

The mutation operation can strengthen the diversity of the population. It is very important to search for the optimal solution. The author uses basic bit mutation operations in binary coding; in real coding, a nonuniform mutation is used [25]. The new gene value xk′ used in the nonuniform mutation is:
(10)xk′=xk+Δt,Umaxk−ηk,random0,1=0,xk−Δt,ηk−Umaxk,random0,1=1,whereΔt,Umaxk is a random number in the range of 0,Umaxk−ηk and Δt,ηk−Umaxk is a random number in the range of 0,ηk−Umaxk.


### 4.6. Crossover Probability and Mutation Probability

In the GA algorithm, crossover probabilityPc and mutation probability Pm will affect the convergence of the algorithm; therefore, the choice of Pc and Pm is very important to the algorithm. The author chooses the adaptive crossover and mutation probability:
(11)Pc=λ1fmax−f′/fmax−f¯,f′≥f¯,λ2,f′<f¯,Pm=λ3fmax−f/fmax−f¯,f′≥f¯,λ4,f′<f¯,whereλ1, λ2, λ3, and λ4 are constants of 0-1, fmax is the maximum fitness value, 1 is the average value of fitness, f¯ is the larger cross fitness value, and f is the fitness value of the variant individual.


## 4.1. Hybrid Coding Scheme

The advantage of binary coding is simple operation, the search ability is strong, and the real number coding is characterized by high precision and fast efficiency [20]. In this paper, we combine binary and real number coding optimization. This hybrid encoding approach increases the genetic search range while improving the algorithm accuracy.


## 4.2. Selection of Fitness Function

The fitness value is expressed as:(7)fXi=eXi−1.The objective function is expressed as:(8)eXi=12n∑j=1n∑k=1mcjk−qjki2,whereqjki is the output of the jth node of the kth input, cjk is the expected output, n is the number of training samples, and m is the number of output neurons [21].


## 4.3. Mixed Selection Operator

The author’s selection operation is divided into the following steps: sort by fitness value, then randomly selectm samples, and cross and mutate m samples [22]. Keep the best sample of the parent.


## 4.4. Crossover Operator

When coding real numbers, use an arithmetic crossover operator [23]. The arithmetic crossover operator can be expressed as follows:
(9)Ci1=Pi1+ai1Pi2−Pi1,i=1,2,⋯,nCi2=Pi2+ai2Pi2−Pi1,i=1,2,⋯,n,whereCi1, Ci1 are the individuals after crossover, Pi1,Pi2 are the individuals before the crossover, and ai1, ai2 are random numbers from 0 to 1 [24].


## 4.5. Mutation Operator

The mutation operation can strengthen the diversity of the population. It is very important to search for the optimal solution. The author uses basic bit mutation operations in binary coding; in real coding, a nonuniform mutation is used [25]. The new gene value xk′ used in the nonuniform mutation is:
(10)xk′=xk+Δt,Umaxk−ηk,random0,1=0,xk−Δt,ηk−Umaxk,random0,1=1,whereΔt,Umaxk is a random number in the range of 0,Umaxk−ηk and Δt,ηk−Umaxk is a random number in the range of 0,ηk−Umaxk.


## 4.6. Crossover Probability and Mutation Probability

In the GA algorithm, crossover probabilityPc and mutation probability Pm will affect the convergence of the algorithm; therefore, the choice of Pc and Pm is very important to the algorithm. The author chooses the adaptive crossover and mutation probability:
(11)Pc=λ1fmax−f′/fmax−f¯,f′≥f¯,λ2,f′<f¯,Pm=λ3fmax−f/fmax−f¯,f′≥f¯,λ4,f′<f¯,whereλ1, λ2, λ3, and λ4 are constants of 0-1, fmax is the maximum fitness value, 1 is the average value of fitness, f¯ is the larger cross fitness value, and f is the fitness value of the variant individual.


## 5. Results and Analysis

The author considered the failure of the accelerometer sensor. Three detection models are designed using MATLAB: the first is the classic BP neural network detection model, the second type is the classic GA-BP neural network detection model, and the third is the improved GA-BP neural network detection model, in order to compare the pros and cons of the three models. The neural network constructed by the author has 3 layers: the input layer, hidden layer, and output layer, each having 1 layer, and the input layer has 100 neurons, the hidden layer has 6 neurons, and the output layer has 1 neuron.In this paper, the classical BP algorithm, the classical GA-BP algorithm, and the improved GA-BP algorithm were trained, respectively, with a total of 150 sets of training data, with the training function using LevenbregMarquardt (trainlm), and the performance function using MeanSquaredError (mse). The simulation results are listed in Table1, and the convergence curves of the three algorithms are shown in Figures 2, 3, and 4.Table 1
Comparison of three algorithms.
AlgorithmTarget errorAverage number of iteration stepsClassic BP0.0110Classic GA-BP10e-1517Improve GA-BP10e-1517Figure 2
Convergence curve of a classic BP algorithm.Figure 3
Convergence curve of a classic GA-BP algorithm.Figure 4
Improved GA-BP algorithm convergence curve.For the three algorithms, the detection rate can also be used to evaluate the performance of the three methods, the detection rates of the three methods are shown in Figures5, 6, and 7.Figure 5
Type 1 failure.Figure 6
Type 2 failure.Figure 7
Type 3 failure.


## 6. Conclusion

In the quadrotor UAV aircraft system, due to issues such as manufacturing quality, working environment, and its own structure, the actuator mechanism is easy to cause the failure of the actuator mechanism. And as the application of quadrotor drones becomes more popular, the workplace and environment of this work have gradually come into people’s lives. Once the actuator mechanism fails, it is very easy to cause fatal errors and hazards to the entire quadrotor UAV system, seriously threatening people’s lives and property safety. Therefore, it is very necessary for us to perform fault diagnosis and fault-tolerant control on the actuator mechanism of the quadrotor UAV. On the one hand, it can improve the safety of the entire quadrotor UAV control system; on the other hand, it can ensure that the entire quadrotor UAV system is not affected by external environmental factors, maintaining the stability of the system. In the same background of noise, the improved GA-BP algorithm has the highest detection rate, the classic GA-BP algorithm is second, and the classic BP algorithm is the worst. Therefore, the improved GA-BP algorithm can quickly and accurately detect various errors of the sensor. Response to the failure can be accelerated by designing the failure regulation law in the future.



---

*Source: 8626722-2022-03-28.xml*