Performance comparison and analysis of traditional PID and fuzzy PID control applied to UAV

Quadrotor UAVs are gradually being used in various fields because of their flexibility, ease of control and low cost. Along with advancement of electrical technology in contemporary times and increasing application scenarios of the aircraft, the demand for control systems has also increased. In different application scenarios, there are some differences in the functions and application requirements of UAV. Therefore, it is of great value to adjust the control algorithm by combining the scenario requirements. PID heuristic and fuzzy PID heuristic are the two most common control algorithms in UAV. In this paper, the heuristics are designed and compared for the above two algorithms in different scenarios and environments. First, the development process and status of UAVs are explained, and the importance of the control system is introduced. Subsequently, two control systems are studied and designed separately, and targeted comparison tests are conducted. Finally, the performance and applicability scenarios of the two control systems are analysed according to the experimental results, which in turn provide an important reference basis for the design of PID-based UAV control systems.


Introduction
Unmanned Aerial Vehicle (UAV) is a little flying robot of some type operated by remote control without direct pilot operation, which has the functions of flight, vertical take-off and landing [1], [2].UAVs can be traced back to the 1920s when they were used as target aircraft for military training, and then they were highly valued and developed rapidly due to the multiple influences of the international military field's great demand and the quick advancement of aeronautical technology, and they are widely used in the military for intelligence collection, terrain survey, and tracking and reconnaissance [3].
So far in the 21st century, influenced by the quickening growth of the world economy and the requirements of people from all walks of life, UAVs have also gradually transformed from military to commercial and scientific research fields, and have made a splash in other fields, such as filming, geological exploration, agriculture, rescue and disaster relief, performance and entertainment, providing services and convenience for people's life and work [4].The most widely used type of UAV in various fields is the quadrotor UAV, which is popular for its flexibility of movement, ease of control, and low cost [5].In addition, UAV technology is inclusive and convergent, and can be combined with other technologies such as artificial intelligence and computer vision to achieve a wide and more comprehensive range of applications, which has a lot of room for development and progress [6], [7].The quadrotor UAV can perform autonomous take off, hovering and landing actions, as well as side flight, inverted flight and other high manoeuvrability behaviours, which have attracted much attention since its introduction.PID control, LQR control, sliding mode control, and backstepping control are the primary control strategies used so far for quadrotor UAVs.
With the arrival of the era of equipment intelligence, achieving automation and intelligence has become the main theme in various fields, especially 5G technology is widely used, and the technical requirements for control systems are getting higher and higher.The clear majority of existing aircraft are using PID controllers as a means of control, and UAVs are no exception, the traditional PID control system is applied as mainstream control system because of its complete and mature technical development and wide range of applications [8].Yet given the traditional PID control system has emerged as a sluggish or even ineffective field of application due to the rapid technological and scientific advancements, and the fuzzy PID control system has gained popularity [9].In comparison to traditional PID control system, fuzzy PID is less perfect, but also has its own advantages [10].
In the field of aircraft nowadays, PID algorithms are commonly used in control systems.Considering the recent progressive advancement of electrical technology and the expanding use cases for flight vehicles, the demand for control systems has also increased.In different application scenarios, there are certain differences in the functions and application requirements of UAVs.Therefore, it is of great value to adjust the control algorithm by combining the scenario requirements.The two most popular control algorithms in UAVs are the traditional PID and the fuzzy PID.In this paper, the algorithms are analysed, comparing for both algorithms in different scenarios and environments.Through targeted comparison tests, the performance and applicable scenarios of the two control systems are studied.

System model construction
The quadrotor UAV's kinematics and dynamics analysis are used to create the mathematical formula, which serves as the foundation for flight simulation and control.Firstly, two basic coordinate systems are established as shown in figure 1, including the geographic coordinate system   and the airframe coordinate system   .The direction of the UAV's forward motion is specified to be along the X-axis, and the airframe coordinate system's coordinates match the geographic coordinate system's coordinates and the corresponding coordinate axes balance each other.The following figure 1 shows the schematic diagram of the two coordinate systems.To maintain the generality of the created mathematical formula, the following assumptions were made on the developed mathematical model [11][12][13].
1) Uniform and symmetrical body structure.
2) The origin of the body coordinates coincides with the centre of mass and the geometric centre of the body.
5) The air resistance and gravity are constant during the flight.When designing conventional parameters, a better set of parameters is found to achieve better control effects after a comprehensive design based on the role of proportional, integral and differential control on system stability and dynamic performance.

Control principle
To contrast the differences among traditional and fuzzy PID controllers, the transfer function of quadrotor UAV is calculated as the controlled quantity, and the advantages and disadvantages of the two are compared through the specific controlled objects in life.The transfer function of the quadrotor UAV flight control system is chosen as the regulated quantity after studying pertinent information and analysing the UAV's features, and its transfer function is:

Fuzzy PID control principle.
According to the principle of the fuzzy PID controller, it needs to first fuzz the precise amount, perform calculations accordance to the established rule basis, and then accurately the fuzzy value.Fuzzy PID controller is an added fuzzy parameter self-tuning controller based on PID controller, when establishing the simulation model, use the step module as a given, and then set the fuzzy control module, and is proportional, integral, differential three links of function, in the design of step signal and the fuzzy PID controller are connected to the oscilloscope module, which can facilitate the observation of the control effect of fuzzy PID controller.

Control system design and construction process
2.3.1.Traditional PID control system.During the study, the system was built on the MATLAB Simulink module, and the classical PID control module as seen in figure 3 below.The beginning value is 0 and the ultimate value is 1, the input signal is configured as a unit step signal, the step time is 1, and the step time is.The transfer function in the transfer function module is as an instance, then the system is constructed.Among them, the three gain modules represent   ,   ,   , whose determination method is Ziegler-Nichloas second law.In other words, the first P control, so that   ,   is 0, from 0 to debug the approximate value of   , until the image in the oscilloscope appears isometric oscillation, you can determine   ; figure 4 shows the isometric oscillation schematic and the method of taking   .Knowing the calculation method in Table 1 below, the gain values of the three gain modules can be calculated.After determining the value of   , PI control is carried out, and the value of   is calculated first to get the value of   under PID control, and then debugging is carried out to get the most suitable   and   ; finally, PID control is carried out, and   ,   and   are calculated and debugged according to the above way, and then simulation testing is carried out.
125  In the system design, the body and other modules cannot do parameter consideration, after the experiment for careful adjustment, in the design phase, these modules can be formulated as Black Box modules, PID control system is designed separately, as a feedback unit independent outside, input and output and PWM and other modules to connect, to complete the system build, as shown in figure 5.For the fuzzy rule base, 49 control logic rules can be summarized according to the above fuzzy rules for each output parameter.Figure 7 depicts the foundation of the Simulink-designed Fuzzy PID submodule.While In1 donated input variable , after differentiation  is obtained, and  and  serve as the Fuzzy Logic Controller's inputs.

Experimental results and analysis
To construct and simulate the system, MATLAB Simulink module was utilized.Two PID control systems are built in Simulink, data conditioning and simulation tests are performed to produce valid experimental results such as images and data.

Simulation in the same parameter environment
Both conventional PID and fuzzy PID control systems are built in Simulink and jointly connected to the scope module for simulation comparison.Set the controlled object transfer function as same from eq (2).The conventional PID controller parameters are:   =8;   =3;   =2.The comparative model diagram of the same parameters is shown in figure 8.In figure 9, the red curve depicts the output of fuzzy PID simulation, whereas the blue curve shows the output of classic PID simulation, through image observation and analysis, it can be obtained that the red curve rises faster than the blue curve at the beginning, which can be analysed that the dynamic response speed of traditional PID controller is due to fuzzy PID, but its overshoot is calculated as 20%, which is larger than the overshoot of fuzzy PID (13%).From the figure 9, the blue curve represents the traditional PID first reach stability at a given value, and its regulation time is 3s more than that of the fuzzy PID controller.It's possible to conduct analysis to determine the fuzzy PID is faster than the traditional PID dynamic response, the regulation time is shorter, but the overshoot is larger, and the error is zero after both are stabilized.

Simulation of changing the parameters of the controlled object
The controlled object is changed to the following equation for system simulation. = 25 (+1)(+2)(+3)(+4) (3) After the system simulation, the following image is generated as shown in figure 10 of the variable control variable simulation.The blue curve in the figure 10 represents the output of PID controller simulation, whereas the red curve represents the output of a fuzzy PID controller simulation.Fuzzy PID has more stable effect than PID controller, and the fluctuation amplitude is obviously smaller.Although the initial stage is slower than traditional PID, its adjustment time is smaller than traditional PID controller, the adjustment time of traditional PID and fuzzy PID controller are 9s and 7s, respectively.It can be seen that the overshoot is also smaller.When the controlled object changes, the fuzzy PID control effect is better than the traditional PID controller.

Conclusions
In this paper, through the design and simulation of two PID control systems, traditional and fuzzy, this paper compares the differences between the two control methods in terms of overshoot, dynamic response speed, regulation time and other factors.And then analyse the advantages and disadvantages of each, the analysis results are described below.
The advantages of traditional PID control: Low environmental requirements, simple concept, convenient to be using, flexible, PID algorithm technology is mature, and easy to promote make control quality less susceptible to changes in the controlled object.
Disadvantages of traditional PID control: Traditional classical control can obtain good control for clear systems, but not for systems that are difficult to describe with mathematical accuracy.The parameters cannot be automatically adjusted to provide better control for changes in the controlled object.
Advantages of fuzzy PID control: Effective suppression of system overshoot at the beginning of the control, can reduce the amount of calculation, system response speed, high accuracy, good controllability.
Disadvantages of fuzzy PID control: high requirements for control rules, imperfect system, and limited applicability.
This paper argues that traditional PID and fuzzy PID control systems have different control effects under different conditions, and the advantages and disadvantages of the two methods can be combined with the application scenarios and control requirements to analyse and select the appropriate corresponding algorithms, and then achieve better control of the target state variables.

Figure 1 .
Figure 1.Schematic diagram of the airframe and geographic coordinate system.To maintain the generality of the created mathematical formula, the following assumptions were made on the developed mathematical model[11][12][13].1)Uniform and symmetrical body structure.2)The origin of the body coordinates coincides with the centre of mass and the geometric centre of the body.3)Rigid body system, propeller inelastic.4) Ground coordinate system is inertial coordinate system.

2. 2 . 1 .
Traditional PID control principle.PID control is divided into three parts, namely proportional, integral and differential control, which due to its robustness, simplicity of the algorithm, and excellent dependability, is one of the first control systems devised, so most aircraft are currently using PID control methods.Its input   () is related to the output as   () =   �() + is the integral time constant,   is the proportional gain,   is the differential time constant,   () is the control quantity, () is the deviation of the controlled variable () and the set value () .The PID control module's block diagram is shown in figure 2.

Figure 2 .
Figure 2. Block diagram of PID control module principle.When designing conventional parameters, a better set of parameters is found to achieve better control effects after a comprehensive design based on the role of proportional, integral and differential control on system stability and dynamic performance.To contrast the differences among traditional and fuzzy PID controllers, the transfer function of quadrotor UAV is calculated as the controlled quantity, and the advantages and disadvantages of the two are compared through the specific controlled objects in life.The transfer function of the quadrotor UAV flight control system is chosen as the regulated quantity after studying pertinent information and analysing the UAV's features, and its transfer function is:  =

Figure 3 .
Figure 3. Traditional PID control module diagram.The beginning value is 0 and the ultimate value is 1, the input signal is configured as a unit step signal, the step time is 1, and the step time is.The transfer function in the transfer function module is

Figure 4 .
Figure 4. Isometric oscillation schematic.Knowing the calculation method in Table1below, the gain values of the three gain modules can be calculated.After determining the value of   , PI control is carried out, and the value of   is calculated first to get the value of   under PID control, and then debugging is carried out to get the most suitable   and   ; finally, PID control is carried out, and   ,   and   are calculated and debugged according to the above way, and then simulation testing is carried out.Table1.Gain value calculation formula table.

Figure 5 .
Figure 5. Traditional PID and body system building diagram.2.3.2.Fuzzy PID control principle.Based on the information reviewed, the exact quantities of the system are empirically set to include: the change quantity , the change rate of the change quantity , and the three output quantities   ,   ,   , so it is set to two inputs and three outputs to fuzzily exact variables as shown in figure 6 below for the fuzzy controller design interface.System error is set to be  = [-1,1], while error rate of change is set to be  = [-1, 1].It is decided to use a two-dimensional fuzzy controller.The departure  and the change in the magnitude of the discrepancy  are the inputs.Seven linguistic variables are set: NB, NM, NS, ZO, PS, PM, PB.Based on the control requirements and the design parameters of previous controllers, the input and output variables are delineated as follows: ,  domain: {-1, 0, 1},   ,   ,   are the output adaptive fuzzy PID controllers.Their theoretical domains are set to: {-1.333, -1, -0.666}.

Figure 6 .
Figure 6.Fuzzy controller design screen.For the fuzzy rule base, 49 control logic rules can be summarized according to the above fuzzy rules for each output parameter.Figure7depicts the foundation of the Simulink-designed Fuzzy PID submodule.While In1 donated input variable , after differentiation  is obtained, and  and  serve as the Fuzzy Logic Controller's inputs.

Figure 8 .
Figure 8.Comparison model diagram of the same parameters.By simulation, the simulation diagram of the same parameters in figure 9 is obtained.

Figure 9 .
Figure 9. Simulation diagram of the same parameters.In figure9, the red curve depicts the output of fuzzy PID simulation, whereas the blue curve shows the output of classic PID simulation, through image observation and analysis, it can be obtained that the red curve rises faster than the blue curve at the beginning, which can be analysed that the dynamic response speed of traditional PID controller is due to fuzzy PID, but its overshoot is calculated as 20%, which is larger than the overshoot of fuzzy PID (13%).From the figure9, the blue curve represents the traditional PID first reach stability at a given value, and its regulation time is 3s more than that of the fuzzy PID controller.It's possible to conduct analysis to determine the fuzzy PID is faster than the traditional PID dynamic response, the regulation time is shorter, but the overshoot is larger, and the error is zero after both are stabilized.

Figure 10 .
Figure 10.Simulation diagram of variable control volume.

Table 1 .
Gain value calculation formula table.