Abstract

Aiming at the problems of manual setting of control rules and low control accuracy of the fuzzy PID control method, an attitude control method of the unmanned aerial vehicle (UAV) based on the extended Kalman filter (EKF) and adaptive fuzzy PID (AF PID) is proposed. The dynamics equations and measurement equations of UAV are established, and the EKF is used to estimate and predict attitude changes; an adaptive fuzzy PID control algorithm is designed, and the adaptive adjustment method is adopted to revise fuzzy control rules and parameters online; a simulation platform of the attitude control system (ACS) of UAV is built to simulate and verify the control effect of the method. The simulation results show that the proposed algorithm can estimate the change of attitude angles accurately and improve the control accuracy; meanwhile, it also ensures the stability and rapidity of the attitude changes. The research results can resolve the contradiction between high precision and rapid stability of complex systems to a certain extent.

1. Introduction

Autonomous aerial refueling (AAR) is an activity of one UAV delivering fuel to another or multiple UAVs during flight, which can significantly improve the airborne time and endurance of UAVs and increase the payload of UAVs [1, 2]. During the aerial refueling phase, the speed and attitude of the UAVs must be consistent. Otherwise, it may cause refueling failure or crash, which causes significant economic losses [3]. The UAV is a typical under-driven and complex nonlinear system with such characteristics as strong coupling and susceptibility to disturbance from external factors, which increases the complexity and difficulty of the control method [4, 5]. Therefore, for ensuring the success of the air refueling phase, it is necessary to study a control algorithm with high control accuracy and strong anti-interference ability.

At present, many researchers have done various works on UAV control and designed many control algorithms and strategies [6], mainly including PID control [7, 8], neural network control [911], predictive control [12, 13], active disturbance rejection control [1, 14], sliding mode control [15], backstepping control [1618], and so on. Due to the characteristics of mature control technology, simple principle, and easy implementation, the PID control method is widely applied in many fields [6]. However, the problems of real-time parameter adjustment and high-precision control in PID control are still the research hotspots and difficulties of UAVs [1922]. Yu and Yang [23] proposed an attitude control method of UAVs based on improved dual closed-loop PID to optimize the flight result and improve its anti-jamming. Bolandi [7] used the frequency-domain analysis method to study the selection of control parameters of the UAV attitude controller, so as to optimize the PID control effect. Alexis [24] applied fuzzy PID to the attitude control system of the UAV by formulating fuzzy rules, and the control performance is improved. Zhang et al. [25] designed a cascade fuzzy PID attitude controller to enhance the anti-jamming ability and accelerate the responsiveness and improve control accuracy. Dong [26] designed a fuzzy adaptive PID controller with control parameters as variables to enhance the system stability and accelerate the response time. Zhang and Zhang [27] used the fuzzy neural network to design an adaptive PID control algorithm for UAV, which can improve the control accuracy and robustness. Liu et al. [28] proposed a robust PID attitude control algorithm to enhance the robustness of systems. Rosales et al. [29] combined the traditional PID and neural network to propose an improved attitude control algorithm, which can reduce the control errors. Islam et al. [30] used the neural network to design a PID attitude controller, which can decompose multiple variables of the system to obtain a good flight effect. Although the aforementioned control algorithms have made certain progress in the attitude control of the UAV, there are still problems such as manual setting of fuzzy control rules and low control accuracy; in response to these problems, an EKF-AF PID attitude control algorithm with adaptive adjustment of fuzzy rules is proposed to promote the control effect and accelerate the system response.

In Section 2, the motion model and measurement model of the UAV attitude are established, and the EKF is used to estimate and predict the attitude changes. The adaptive fuzzy PID control algorithm is presented, and the adaptive adjustment method is used to adjust control rules and parameters online. In Section 3, a simulation platform of the attitude control system (ACS) for UAV based on Simulink is built to simulate and verify the control effect. In Section 4, concluding remarks are made.

2. Attitude Estimation of UAV Based on EKF

2.1. Attitude Motion Model of UAV

Generally, the UAV attitude is often represented by Euler angles (φ, θ and ψ). The angular velocity vector of the UAV is . Assuming that the inertia matrix of the UAV is J = (Jx, Jy, Jz)T, the resultant matrix is M = (Mx, My, Mz)T, and the moment of momentum is H = (Hx, Hy, Hz)T; according to the moment of momentum theorem [31], we can get

Choosing O-xyz as the body coordinate system of the UAV, equation (1) can be rewritten as

The relative angular velocity vector obeys the following equation [2]:

The state-space model based on the first-order differential equation is adopted to express the attitude motion of the UAV. Specifically, a multi-dimensional state variable X=(φ, θ, ψ, ωx, ωy, ωz)T is constructed. The multi-dimensional state variable contains not only the rotation angle information of the UAV relative to a certain reference coordinate system but also the rotation speed information. According to equations (2) and (3), the motion state model is obtained aswhere

Considering the high complexity of body structure and flight environment of the UAV, as well as some external uncertain factors, equation (4) can be modified aswhere is the random disturbance term, which represents the comprehensive influence of the model fitting error, nonmodel component, and random disturbance on the attitude of the UAV.

2.2. Attitude Measurement Model of UAV

The attitude measurement system is used to determine the attitude of the UAV at any time, and it is a prerequisite for the control, management, and use of the UAV. At present, the equipment that measured the attitude of the UAV usually includes inertial navigation system (INS), vision navigation system (VisNav), Global Positioning System (GPS), infrared sensors, global navigation satellite system (GNSS), and BeiDou Navigation Satellite System (BDS) [3235]. According to the number of measurement equipment, the attitude measurement system can be divided into the single-equipment measurement system and the multi-equipment measurement system [36, 37]. The single-equipment measurement system is easily affected by external interference, resulting in inaccurate attitude measurement. The multi-equipment measurement system can restrain the effect of external interference and improve the accuracy of the attitude measurement. Therefore, a multi-equipment measurement system is adopted to measure the attitude in this paper, which includes a integrating gyroscope, an accelerometer, a magnetometer, and two GPS receivers.

The output of the integrating gyroscope is of the rotational angular velocity of the UAV. The measurement model iswhere represent the measurement errors.

The output of the accelerometer is of the gravity acceleration at the location of the drone. The measurement model iswhere represent the gravity acceleration vectors and represent the measurement errors.

The output of the three-axis magnetometer is of the geomagnetic field intensity at the location of the drone. The measurement model iswhere is the local geomagnetic vector and represent the measurement errors.

The two GPS receivers are mounted on the longitudinal axis of the body coordinate system. The measurement values of the two GPS receivers are (x1, y1, z1) and (x2, y2, z2), and the components of the baseline vector of two GPS receivers along the body coordinate system are

According to the relationship between attitude angle and position, the measurement model of the GPS receiver is established.where represent the measurement errors.

Choosing the measurement variance Z=(ax, ay, az, hx, hy, hz, Δx, Δy, Δz, ωgx, ωgy, ωgz)T, according to equations (7)–(11), the measurement system model can be given.where , , , , and measurement errors .

2.3. Attitude Estimation Based on EKF

Equation (6) can be discretized by the difference approximation method:where T is the sampling time.

If the T = 1, equation (13) is expressed as

Remembering that and , the discretization model of motion state equation is obtained aswhere is a nonlinear function and is the noise vector.

Similarly, the discretization model of the measurement equation iswhere is a nonlinear function and is the noise vector.

According to the EKF method [35], we can getwhere , , P(k) is the covariance matrix, Q(k) is the variance matrix of the process noise, K(k) is the gain matrix, and R(k) is the variance matrix of the measurement noise.

When the initial values of and are given and the measured values Z(k) at the corresponding time are known, the current estimation values are obtained by recursive solution.

2.4. Adaptive Fuzzy PID Attitude Control Algorithm

As we can see from equation (1), the attitude control of the UAV is mainly to control the attitude angle φ, θ and ψ and make them maintain stability and essentially adjusting the total moment M of the UAV to make the UAV maintain attitude stable. According to the nonlinear characteristics of UAVs and the requirements of the actual application environment, an adaptive fuzzy PID control method is adopted to improve the capability of the dynamic response and adaptive anti-jamming of the UAV.

The adjustment parameters and control rules of traditional fuzzy control methods are fixed. Due to the roughness and imperfection of fuzzy rules, the traditional fuzzy control method cannot effectively control the dynamic changes of the UAV. For this, Figure 1 shows an adaptive fuzzy PID control method. Based on the traditional fuzzy PID control method, a rule-adaptive learning controller and adjustment factors are added to achieve the revisions of control rules and parameters online.

Taking the error e and error change rate ec of attitude angles as input, the self-adjustment factor and control rule adaptive learning are used to make the fuzzy controller output the control parameter revisions ∆KP, ∆KI, and ∆KD and then make the revisions input into the PID controller, and finally the control variance u can be obtained.

2.4.1. Fuzzy PID Controller

e and ec of attitude angles can be given aswhere is the expected value.

When designing a fuzzy controller, a fuzzy subset of the input and output must be obtained first. In this paper, 7 language variances {NB, NM, NS, ZE, PS, PM, PB} are selected to represent fuzzy subsets of the PID control. Therefore, the fuzzy subsets of e, ec and the output s of the controller are defined as {NB, NM, NS, ZE, PS, PM, PB}. In order to correspond the specific values of the input and output quantities to the fuzzy subsets, a quantization function needs to be introduced. In the actual system of UAVs, considering the saturation characteristics of the actuator and the asymmetry of variables, the change ranges of e, ec, and s are [emin, emax], [ecmin, ecmax], and [smin, smax], respectively. Their fuzzy domain is [−1, 1] through normalization, and then the quantization function can be obtained.where E represent the fuzzy variances of e; EC represent the fuzzy variances of ec; S represent the fuzzy variances of s; ; ; and .

According to equation (23), the quantization factors Ke, Kec and the scale factor Ls are adaptively adjusted. According to the quantized value, a certain fuzzy subset can be obtained through the degree of membership function. The degree of membership is a value between 0 and 1, which is adopted to express the degree of an input fuzzy itself. In this paper, a triangular membership function with a symmetric, uniformly distributed, and fully overlapping function is chosen to calculate the degree of membership of the quantized input [38], and the corresponding fuzzy subsets can be obtained.

The fuzzy inference is the basis for designing the fuzzy controller. After the input is fuzzified, a fuzzy rule library needs to be established to output the inference result. When the values of Kp and KI are increased, the error e is reduced; when the value of KD is decreased, the error change rate ec is reduced. According to the change of e and ec, the three fuzzy rules are shown in Tables 13 [39].

According to the fuzzification results of E and EC, combined with three fuzzy rule tables and Mamdani’s min-max reasoning rule [40], the degree of membership of fuzzy subsets S1, S2, and S3 of the parameter revisions ∆KP, ∆KI and ∆KD can be obtained.where R is the fuzzy rule set; n is the number of rules; Ri is the ith rule; μ is the degree of membership; Ci, and Di are the inputs under the ith rule; and Oi is the output under the ith rule.

The precise value of each output is calculated by the typical center of gravity defuzzification method.

According to equations (23) and (25), the actual revisions of the fuzzy controller parameters can be obtained.

According to the results of equation (26), the parameters of PID controller can be given.

According to the above results and the structure characteristics of UAVs, the control output u is obtained.

2.4.2. Self-Adjustment of Fuzzy Rules

For completing the modulation of control rules online, a performance function is given.where ρ is the weighting coefficient.

The partial differential of J is

According to equations (30) and (31), the negative gradient function can be given.

Referring to the idea of neural network optimization [41], the control variance is obtained.where λ is the learning rate and 0 < λ < 1.

According to the results of equations (32) and (33), the control rules can be modified aswhere is the degree of membership and is the revision of the output.

3.1. Simulink-Based Design of Simulation Platform for ACS

Figure 2 shows a simulation platform of the ACS.

The simulation platform mainly includes 10 unit modules. The specific design and implementation are as follows.

3.1.1. Attitude Dynamics Module

According to the result of equation (1), the simulation module of the attitude dynamics model is built as shown in Figure 3.

3.1.2. Attitude Kinematics Module

According to the result of equation (3), the simulation module of the attitude kinematics model is built as shown in Figure 4.

3.1.3. Measurement System Module

The measurement system includes a gyroscope, an accelerometer, a magnetometer, and two GPS receivers. Therefore, the measurement system module includes four simulation modules. The specific design is as follows.

According to the result of equation (7), the simulation module of the three-axis gyroscope is built as shown in Figure 5.

According to equation (8), we can see that when the measured value of the accelerometer is known, the attitude angle can be calculated. In order to facilitate the construction of the simulation module, the calculated attitude angle is used as the measured value of the accelerometer. Therefore, the simulation module of the three-axis accelerometer is built as shown in Figure 6.

Similarly, the simulation modules of the magnetometer are built as shown in Figure 7. The simulation modules of the GPS are built as shown in Figure 8.

3.1.4. Attitude Angle Estimation Module

According to equations (5), (12), and (17)–(21), the simulation module of attitude angle estimation is built as shown in Figure 9.

3.1.5. Feedback Module

According to the result of equation (22), the simulation module of the state feedback is built as shown in Figure 10.

3.1.6. PID Controller Module

Figure 11 shows the simulation module of the PID controller.

3.1.7. Actuator Module

The motor is selected as the actuator, and we can get [42]where V is the voltage; M is the torque; L is the inductance; Km is the torque moment coefficient (Nm/A); and R is the resistance.

According to the result of equation (35), the simulation module of the actuator is built as shown in Figure 12.

According to the above results, the simulation platform of the ACS can be shown in Figure 13.

3.2. Simulation Result and Analysis

During the process of the autonomous refueling, the two UAVs need to remain relatively stationary. Assuming that the tanker is flying parallel to the ground, the attitude of the receiver is consistent with the tanker, that is, to stabilize at the desired attitude angle [0 0 0]. A certain type of fixed-wing UAV is taken as an example, and the initial simulation parameters are set to simulate and verify the control effect.

The estimation results of the attitude angles are shown in Figure 14. For the model of the UAV with nonlinearity and uncertainty, the proposed method can estimate the change of attitude angles accurately, and the estimation accuracy is high.

Figure 15 shows the tracking result comparison of the attitude angle in different control algorithms. From Figure 15, compared with the traditional PID, the control accuracy of the proposed method is better, the attitude change is relatively stable, the steady state can be reached quickly, and the error of steady state is small.

4. Conclusions

We proposed an EKF-AF PID-based attitude control algorithm for UAVs in this paper, and the algorithm can improve the control accuracy of the ACS. An attitude estimation method based on EKF is established and an adaptive fuzzy PID algorithm is designed, and finally a simulation platform of the ACS is established to simulate and verify the control effect.

EKF-AF PID-based attitude control algorithm for UAVs can estimate the attitude change accurately, and the control accuracy is high; meanwhile, it has fast control time and small control error. The research results can resolve the contradiction between high precision and rapid stability of complex systems to a certain extent.

Data Availability

The data used to support the findings of this study are included within the article.

Conflicts of Interest

The authors declare that they have no conflicts of interest.

Acknowledgments

This study was supported by the Natural Science Foundation of China (61973094), the Maoming Natural Science Foundation (2020S004), and the Guangdong Basic and Applied Basic Research Fund Project (2020B1515310003).