On the use of PID control to improve the stability of the quad-rotor UAV

. The recent development of drones has aroused great concern at home and abroad. For civil industry and agricultural plant protection industry, it can provide safer and more stable flight and improve production efficiency. For the exploration industry, the application of UAV (Unmanned Aerial Vehicle) will reduce unnecessary casualties. In places where damage is serious, UAV will bring accurate on-site information and data more quickly. It can make drones to replace people in high-risk operations, scientific and technological agricultural development and survey more stable and safe; For the military industry, it can be applied to different combat environments to increase its stability. In recent years, although UAV combat and reconnaissance are not the mainstream combat methods, UAV has become or an indispensable part. Improving the stability of UAV will also increase the military combat capability, so UAV has good development prospects and economic benefits. Nowadays, PID (Proportion Integration Differentiation) control plays an indispensable role in quad-rotor UAV. How to use different types of PID control combined with existing intelligent technology to improve the stability of quad-rotor UAV is a hot issue in recent years. This paper summarizes the previous research results in this field, briefly describes the motion mechanism of four-rotor UAV, wind disturbance resistance mechanism, the action principle and contract between traditional PID control and fuzzy PID control, as well as the effect of intelligent algorithm on PID control addition, and puts forward suggestions for PID control algorithm of the future UAV.


Introduction
On the basis of the quad-rotor UAV and the fuzzy PID control system simulation, the setting of the wind is analyzed in the the project of the environment noise to take advantage of a PID control.Through the model, Matlab and Simulate are used to simulate the simulation, and it is concluded that compared with the traditional PID, it has stronger autonomous adjustment ability.At the same time, adding intelligent algorithm to PID control will have the independent optimization and adjustment ability of PID model parameters, and the application of certain algorithms will have a certain good effect on the autonomous adjustment ability of four-rotor UAV.Based on the previous research on the stability control of UAV, this paper summarizes and compares the control mechanism of traditional PID and fuzzy PID, and briefly describes the motion mechanism and wind disturbance resistance mechanism of quad-rotor UAV, as well as the influence of intelligent algorithm on PID.

Mathematical modeling of quad-rotor UAV
Using the "X" quad-rotor as the research object, and the rotation of the UAV is divided into pitch, flip and yaw.Its own coordinate system ObXbYbZb is selected for analysis, and the linear motion of the UAV is selected for analysis in the geographical coordinate system OeXeYeZe.Changing an object coordinate system to a geographical coordinate system produces the following relationships: Where R e b is the coordinate transformation matrix [1]: ( Where s represents the sin function, c represents the cos function, θ represents the pitch Angle of the UAV, ψ represents the yaw Angle of the UAV, and φ represents the rolling Angle of the UAV.For the sake of guaranteeing the effectiveness of the mathematical model of the UAV in the simulation experiment, the following assumptions are made: The character of the quad-rotor possess equably rigidity, its barycenter is located in geometrical center, the elevating force of the object is positive along the body axis Zb, and the gravity of the body is negative along the geographical coordinate system Ze.

Establishment of motion equation of quad-rotor UAV
The Newton-Euler formula is used to conduct a mechanical analysis of the four-rotor UAV in the geographical coordinate system.The main force of the four-rotor UAV in the hovering attitude is three forces, In other words, the lift T generated by the rotation of the quad-rotor, the gravity ma of the body itself, and the body's velocity in the rotation state are zero.because the air resistance is proportional to the speed, which is obtained according to the equilibrium condition: (3) Where m is the mass of the quad-rotor UAV.

Determination of Angle information of quad-rotor UAV
The phoronomic equation of the model has nothing to do with the mass and force of the body itself, and the attitude Angle of the drone changes with torque.p, q, r are rolling speed, pitch speed, yaw speed.From this, the Angle information of the four-rotor UAV can be obtained as:

The establishment of angular motion equation
In the process of maintaining hover, the quad-rotor UAV mainly has two functions: the lifting moment provided by the rotor and the air moment.In the body coordinate system, the differential equation of the angular motion of the UAV can be obtained according to Euler equation: ( When the UAV is hovering, is presenting the deflection Angle of the UAV along the three axes, I is named as the moment of inertia matrix of the UAV, τ is the resultant moment received by the UAV, and ωb is the presentation of the rotational angular velocity matrix of the UAV.Decompose the above formula into the angular motion equation on the three axes as [2]: (6) Where IxIyIz presents the moment of inertia along the three axes of the body coordinate system.

Design of fuzzy PID controller
The composition of the PID controller as show in Figure 1, compared with traditional PID, a fuzzy logic controller is added as the main component.The controller takes system error e and error rate ė as input, and PID controller parameter KpKiKd as output [3].The precise quantities of input and output are transformed into fuzzy sets of corresponding languages, the language values of control variables corresponding to input and output variables are set as NB, NM, NS, Z, PS, PM, PB, and the discourse domain of system error e, error rate ė, and control quantity u is set as {-3, -2, -1, 0, 1, 2, 3} [4].Then the fuzzy language is selected as the corresponding membership function.

Wind disturbance model analysis and modeling
The four-rotor UAV is often disturbed by external factors when performing flight tasks, and wind is one of the most disturbing factors that affect the attitude of the four-rotor UAV.In order to test whether the four-rotor UAV can ensure attitude stability during flight under wind disturbance, the wind variation characteristics are analyzed, and the corresponding mathematical model is established, which is introduced into the simulation system of the four-rotor UAV as environmental noise, and the accuracy and the anti-interference property of the controller are emreged through the output of the system.
According to the characteristics of continuity, gradualism, suddenness and randomness of wind, wind can be divided into Vb, Vg, Vr and Vn, there are called basic wind, gust wind, gradual wind and random wind [5].
The basic wind is not converted with time after its generation, that is, the constant value K. Wind gusts are generated and enhanced at a certain point, and then attenuated to disappear at a certain point, so it can be seen that during this period of time, wind speed has cosine characteristics, namely: Where, Vgmax, t1 and tg are gust peak, start time and gust period respectively.Gradual wind does not suddenly occur and disappear, and the enhancement or attenuation changes with time, that is: Where, Vrmax, tr1, tr2 and tr3 are the peak value of the gradient wind, the time when the gradient wind speed begins, the time when the gradient wind speed ends, and the duration of the gradient wind speed respectively.The generation and disappearance of wind is random, and it also has the characteristics of continuity in the process of change, namely: Where, Vnmax is the top of the random wind, Ram(-1,1) is the random number evenly distributed -1 and 1, wn is the average distance of wind speed fluctuation, and φn is the random quantity of random distribution between 0 and 1.
According to the above-mentioned analysis, the four different winds applying in the modern technological life are built in a mathematical simulation model.And the basic models of four kinds of wind are weighted and summed according to distinct rates of the weight.By analyzing the figure of the weight ratios, the speed of the four wind converting under various wind conditions can be simulated, and a integrated wind speed shift model can be built.

Review
PID control is the most popular research field in recent years.Better PID control will greatly improve the UAV control system.However, with the continuous improvement of PID control, effective methods such as fuzzy PID and PID control with intelligent algorithm are explored on the basis of traditional PID, so reasonable choices are made according to the conditions and expectations of researchers.

Comparison between traditional PID control and fuzzy PID control
Fuzzy PID control has small over-modulation and short algorithm time, and the initial vibration amplitude controlled by the PID is relatively short as a percentage of the control signal or interference signal.When dealing with external interference, fuzzy PID controller shows better dynamic performance and better anti-interference, and the control output distortion is small, and it has strong anti-interference and robustness.Compared with traditional PID, it has more stable control performance.
The anti-interference test shows that the pitch Angle and rolling Angle of the four-rotor UAV controlled by fuzzy PID can quickly stabilize, and the deviation Angle is < 0.65°, while the response speed is faster, the stabilization time is < 1s, while the response time of the traditional PID is > 5s, and the overshoot is < 1%.

Add the algorithm to the PID control system
So as to make the fuzzy PID possess a better adaptation to the conversion of environment, summarize the law, complete certain operation, reasoning, recognition and control tasks, and have a strong fault tolerance ability, an algorithm is added to the PID control system.One of the algorithms is neural network modulation.The neural network has strong fault tolerance, so that the neural network can identify the object according to the main characteristics of the object, and has self-learning, self-organizing function and induction ability.BP neural network was built into the fuzzy PID control system, as shown in Figure 2. Let the BP neural network adopt a 3-layer BP structure, which contains 3 input nodes, i implicit nodes and 3 output nodes.The number of input variables depends on the complexity of the controlled system.The output nodes correspond to the three parameters KpKiKd of the PID controller respectively.The activation function of neurons in the hidden layer is Sigmoid function, and the activation function of neurons in the output layer is non-negative Sigmoid function [6].
Hidden layer neuron activation function: (10) Derivation: (11) Output layer neuron activation function: (12) Derivation: (13) The loss function of the performance index of evaluating neural network learning is: Using the method of the gradient descent which is the negative gradient of the weight factor E search for the weight coefficient and adjust it, and add a learning algorithm to look for the inertia rapidly convergence to obtain the weight of the hidden layer and the output layer.
(15) (16) Where n is the learning rate and a is the inertia coefficient.The error of the algorithm tends to be stable after a certain time of automatic tuning, and the PID parameter changes with the change of error, and cycles until the condition is satisfied.
Comparing neural network PID with classical PID, neural network PID has smaller static error, which shows that neural network has better control performance and better control effect for nonlinear systems.

Conclusion
When studying the anti-interference of four-rotor UAV, it is necessary to strictly grasp the conditions of giving wind disturbance variables, and compare and test different PID control systems under the same conditions.The PID control has much better anti-interference and robustness than the traditional PID control, and the adjustment of intelligent algorithm will also have better control effect.Based on previous studies, the combination of efficient algorithm and PID control to make use of intelligent PID and effectively adjust the parameters of PID control system will improve the autonomous control ability of UAV in a certain way and obtain more extensive utilization.At the same time, this paper compares the mechanism of traditional PID and fuzzy PID, introduces the auxiliary role of intelligent algorithm and the motion mechanism and anti-wind disturbance mechanism of UAV, deeply summarizes the previous research, and explains the development direction of UAV in the future.

Figure 2 .
Figure 2. Fuzzy PID control system based on BP neural network.