Ziegler–Nichols Customization for Quadrotor Attitude Control under Empty
and Full Loading Conditions

An aircraft quadrotor is a complex control system that allows for great flexibility in flight. Controlling multirotor aerial systems such as quadrotors is complex because the variables involved are not always available, known, and accurate. The inclusion of payload changes the dynamic characteristics of the aircraft, making it necessary to adapt the control system for this situation. Among the various control methods that have been investigated, proportional-integralderivative (PID) control offers good results and simplicity of application; however, achieving stability and high performance is challenging, with the most critical task being tuning the controller gains. The Ziegler–Nichols (ZN) theory was used to tune the controller gains for pitch and roll attitude command; however, the performance results were not satisfactory. The response of this system was refined, resulting in an improvement in the reference tracking and the rejection of disturbances. This particular refinement was applied to the quadrotor, and via a reverse calculation, the parameters that allow the tuning of PID gains were obtained, based on ZN. The particularization of the ZN theory applied to a quadrotor with and without a load (termed ZNAQ and ZNAQL, respectively) is proposed and results in a significant improvement in the control system response performance (up to 75%), demonstrating that ZNAQ and ZNAQL are valid for tuning the controller PID gains and are more efficient than the original ZN theory approach.


Introduction
Multirotor aircraft are used for recreational and professional purposes. Among the possible structural variations, the quadrotor contains a set of four propellers arranged at the ends of each wing. This aircraft does not need a pilot to fly and is the most commonly used variant in practical pilotless implementations. The quadrotor represents a promising field of research owing to its applications, including agricultural and military use [1,2]. To implement a control system in remotely piloted aircraft (RPA) of the quadrotor type, it is necessary to know the variables and parameters involved in the system, their interaction and the aircraft dynamics, which can be represented by mathematical modeling.
A quadrotor has great complexity depending on the number of variables involved [3,4], but in return allows for great flexibility in flight. The identification and control of the variables is challenging because the quantities involved are not always available, known, and accurate. Proportional-integral-derivative (PID) control is sufficient for most performance requirements of these systems; however, it is challenging to design low-level flight controllers for quadrotors while ensuring stability and performance [5]. Studies of high-level control systems for quadrotors have resulted in systems with high costs and hardware complexity [6], but it is preferable to deploy low-level controllers that offer ease of implementation and reduced cost. The system control aspects have been frequently investigated [4], including multirotor robustness against disturbances, transient response analysis, measurement errors of magnitudes, and unmodulated dynamics [5,7,8]. The effectiveness of multirotor control in different situations can be investigated through control system research and experimental tests [5].
The use of PID control in multirotor systems is verified in a number of studies. In [9], a PID controller with manual adjustment was used, but further studies are proposed to determine the parameters of the controller. In [10], PID control was applied to the stabilization of the quadrotor, but improvement of the system stabilization was required. In [11], the self-adjustment of PID controllers was investigated, but a method for determining the coefficient should be explored. Chen et al. [10] presents a method of cascade PID control, composed of four stages to configure the system.
In [11], the use of genetic algorithms in conjunction with the theory of Ziegler-Nichols (ZN) is presented, but the parameters of the controller PID are not provided. In [12], a control system for a quadrotor is determined by ZN theory and compared with a controller based on a genetic algorithm. The studies of [11] and [12] consider only unloaded multirotor aircraft. The study carried out by [13] applies ZN theory to an empty quadrotor, using an adaptation of the original theory proposed in [14]. The parameters were originally proposed by [14] for the frequency control of loads and a microgrid to adjust the power generated to satisfy the load demand. These ZN parameters are different from the parameters originally developed in ZN theory [15].
Three-dimensional stability spaces for PID controller design are proposed in [16], enabling new results to be achieved through ZN theory. The so-called advanced adjustment for PID controller design with ZN theory is addressed in [17], relating the gain margin and phase margin specifications to the performance of curves projected through ZN theory to achieve a controller design with the desired margin specifications. The review of ZN theory for PID controllers performed by [18] explores the processes that are amenable to PID control and the information necessary for a satisfactory design process of this control system. The set point is also considered in the study of problems with load disturbances.
Various methods have been investigated for quadrotor control; however, it is challenging to achieve stability and performance, especially when the aircraft's load varies. Tuning the controller gains of the aircraft is critical, allowing for flight capability and maneuverability as well as avoiding errors or system failures that could result in unsafe operating conditions leading to accidents. PID control is satisfactory for most of the performance requirements; however, it is a challenge to design flight controllers for quadrotors, achieving stability and maneuvering performance [5], and the variation of the load should also be considered.
In this study, a PID controller for roll and yaw commands is selected for its simplicity and practical application in electronic systems. Its effectiveness in stabilizing a quadrotor aircraft is verified, and refinement methods are proposed. ZN theory [15] is implemented to determine the PID controller parameters in a quadrotor, and the refinement of ZN theory is applied to a quadrotor (ZNAQ) and a quadrotor with a load (ZNAQL). This study contributes to the area of quadrotors and control systems in addition to ZN theory refinement, suggesting the use of a configurable control system for empty and loaded operating conditions.

Quadrotor Attitude Control under Empty and Full Loading Conditions
To carry out this study of the tuning gains for quadrotor attitude pitch and roll control under empty and full loading conditions, the characterization of the PID control system is presented first, and ZN theory is then applied to tune the controller parameters. Originally, ZN theory was implemented directly in the system, but because of the risks involved in aircraft experiments, a practical flight with a prototype of a quadrotor was performed under empty and full loading conditions, collecting response data regarding the replication of an impulsive maneuver on the rolling axis (which is equivalent to the pitch axis due to symmetry). The data collected were mathematically processed and used as the basis for the implementation of the ZN theory to configure the PID controller. Based on the ZN theory, ZNAQ and ZNAQL are proposed.

PID Controller
In the PID controller, the selection of gains to satisfy desirable performance rules can be defined through controller tuning [19]. The process variable of a control system is the quantity to be controlled, as in the case of the quadrotor, where the speed of the propellers is controlled to obtain the maneuvering and flight capacities. Further information on PID controllers can be found in [19,20].
Mathematically, the PID control function Gc(s) can be represented by Eq. (1), where K p is the proportional gain, T i is the integral time, and T d is the derivative time.
The useful load projection of an aircraft changes the characteristics of the plant, necessitating a new adaptation of the controller parameters. Determining the appropriate parameters to control the specific dynamics of a quadrotor system is challenging.

ZN Theory
ZN theory is a method used to determine the parameters of PID controllers [15] based on the stability analysis of the system [13], with application in gain determination projects in proportional-integralderivative controller systems. Proposed by [15], the Ziegler-Nichols (ZN) theory is applied to the tuning of PID controllers gains, being a methodology widely used in electronic and industrial systems, with efficient results for the control of dynamic systems. The Ziegler-Nichols rules were proposed from the realization of practical processes, correlating the parameters of controller gains with the response characteristics of the system [18], providing a simple implementation for the adjustment of PID controllers gains.
The ZN theory is originally conceived through practical experiments. In this work, the PID gains are determined through the stability analysis of mathematical models as identified through data collected from a practical prototype in a controlled and safe manner, ensuring a low risk of loss or accident.
ZN theory for PID controller tuning can be applied through two methodologies. The first is based on the open loop response of the system, while the second is based on the closed loop response. In this work, the closed loop response is used because data are collected in a prototype that operates with a closed loop control system. To configure the closed loop PID controller, ZN theory allows definition of the final critical system gain (K c ) and the oscillation period (P c ) of critical gain. The method is implemented by setting the derivative and integral controller gains to zero (K d = K i = 0). Then, the proportional gain (K p ) must be increased until the system initiates a shock, suffering oscillations equidistant in amplitude and sensitivity when critical values are encountered [15], thus determining K c e P c .
Applying the critical values K c e P c in Tab. 1, the determination of the parameters according to the theory in [15] for proportional (P), proportional-integral (PI), and PID controllers can be implemented.
The terms K p , K i , and K d represent the proportional gain, integral gain, and derivative gain, respectively. Taking the PID controller as an example, the gains will be represented as: K p = 0.6 × K c ; K i = 2/P c ; K d = P c /8.
By performing a practical experiment with the quadrotor, the system response is collected in an adverse flight situation in a transitional period, providing data for the mathematical identification of the system. With the identified system response, the ZN theory is applied with the system identified data. The ZN theory is used through a PID control system in MATLAB applied to the identified plant of the data, with values K d = K i = 0, while K p is increased until the system initiates a shock, determining K c and P c . Having obtained the critical points of the system, it is possible to define, according to the theory of ZN, the gain parameters for the P, PI and PID controllers, according to the project need.

Characterization of the Quadrotor Prototype and Parameter Identification
The prototype was built on a 500 mm frame, with four assemblies, each composed of a 10 × 4.5" propeller and an 810 kV motor, mounted at the ends of the arms in an X configuration, which is a configuration widely used in quadrotor prototypes. The prototype has a weight of 1800 g and moments of inertia J xx = 0.0224 kg·m 2 , J yy = 0.0224 kg·m 2 , and J zz = 0.0414 kg·m 2 . When the load is added, the assumed prototype moments of inertia are J xx = 0.0254 kg·m 2 , J yy = 0.0254 kg·m 2 , and J zz = 0.0427 kg·m 2 .
Originally, ZN theory was implemented directly in the practical system, but because of the risk of crashing involved in aircraft experiments, a prototype flight was performed empty and at full load (for the developed prototype, the full load is 1000 g). Response data was collected for an impulsive maneuver on the rolling axes in a controlled and safe experiment, allowing for ZN mathematical treatment. Owing to system symmetry, the rolling axis data can also represent the pitch axis.
System identification was performed in MATLAB using the system identification toolbox. The model that was identified as best suited to represent the dynamics of the plant has the structure of a transfer function with a pair of complex conjugated poles and a real pole, representing a third order closed loop model. Thus, the model of an empty aircraft, represented by Eq.

ZN Theory Applied to the Quadrotor (ZNAQ)
In conjunction with the identified model of the empty quadrotor, the ZN methodology was applied to the mathematical model (Eq. (2)) through simulation in MATLAB, resulting in a critical gain of K c = 7.7865 and a critical period of P c = 0.286 s. If the critical state of the system is found, it is possible to determine the gain Given the parameters for the controller, it is possible to simulate the response of the PID control in Simulink. The response to a step for the empty quadrotor model (Eq. (2)) is analyzed using the controller parameters obtained from ZN theory shown in Tab. 2, and the results are shown in Fig. 1.
An analysis of Fig. 1 indicates that in situations without a controller and with a proportional controller, the tracking of the unit reference is not achieved; the PI and PID controllers offer better performance. From these results for the unloaded model, a refinement was made in the response of the control system, determining a point of operation with good reference tracking and rejection of disturbances in MATLAB. The refinement carried out in the control system response, was performed through manual adjustment of the PID parameters in MATLAB, seeking to control the dynamic response of the quadrotor. It is reinforced that the ZN theory was conceived for the application mainly in industrial control systems, but at this moment it is being customized to present an efficient response for the dynamic control of a quadrotor.
Once this point of operation was obtained, the reverse calculation was carried out using the ZN theory, that is, from the PID gains of the operating point, we turned to the ZN structure to obtain new parameters for the determination of gains. We thus conceived a new particularization of the ZN theory, applied to quadrotors, obtaining the refined gains recorded in Tab. 2 and shown in Fig. 2. The performance indicators are listed in Tab. 3.
As shown in Fig. 2, it was observed that it was possible to achieve stability in all control systems, with reference tracking for the PI and PID and with an improvement in convergence time in the response of the  quadrotor (in relation to the ZN theory). The results obtained achieve control of the system and are satisfactory for flights.

ZN Theory Applied to the Quadrotor with a Load (ZNAQL)
Using the identified model for the quadrotor at full loading, the ZN methodology was applied in this mathematical model (Eq. (3)) to determine the critical state of the system, resulting in the values K c = 1899.5017 and P c = 0.23 s. Through the critical values of the system, it is possible to determine the gains for a PID controller according to ZN theory as expressed in [15]. The results are shown in Fig. 3 and Tab. 4.   From the results of the model with a load, a refinement was made in the performance of the controller to improve reference tracking and maintain disturbance rejection through simulations in MATLAB software, resulting in the refined gains recorded in Tab. 4 and shown in Fig. 4. The tuning to control the quadrotor's dynamic response, in a similar way to the case applied without load, was performed through manual adjustment of the PID parameters in MATLAB, customizing the controller for this specific dynamic. The performance indicators are listed in Tab. 5. Fig. 4 shows that in all control systems, it was possible to achieve stability, with reference tracking achieved by PI and PID controllers. Improvement was obtained in convergence time in the response of the quadrotor (in relation to the ZN theory), obtaining results that manage to control the system and are satisfactory for flights.

Results
Considering the parameters of the present study, with the controller tuned for the quadrotor without a load, it is observed that the parameters obtained by ZN theory are proposed for general application to dynamic systems but may produce better results through customization for the specific quadrotor application. The simulation of the quadrotor plant without a load was performed with controller parameters obtained through ZN theory and with parameters obtained through ZNAQ, with the results of the PID controller shown in Fig. 5.
The refined parameters listed in Tab. 2, which were obtained by considering the specific characteristics collected in the identification of the empty quadrotor, can be applied in the structure originally treated with ZN theory. The reverse calculation was carried out using the ZN theory, that is, from the PID gains of the operating point, we turned to the ZN structure to obtain new parameters for the determination of gains. By doing this, we obtain a PID gain determination based on ZN theory [15] and the specific characteristics of the quadrotor, proposing the particularization of ZNAQ to determine the PID controller parameters, as shown in Tab. 6.
Through the simulations of the controllers obtained through ZN theory and implemented for the system at full loading, it was verified that stability was obtained. It was also verified that none of the simulations reached the tracking of the unit reference.
The performance of the controllers tested for the loaded quadrotor was provided by the PID configuration, as shown in Fig. 6. The step response of the PID controller obtained from ZN theory and the refined response of the proposed PID controller based on ZNAQL verify the effectiveness of the parameter refined based on the characteristics of the quadrotor.  Refined parameters were obtained for balancing the reference tracking and rejection of disturbances, as shown in Tab. 4, considering the specific characteristics collected in the identification of the quadrotor with a load. In a similar way for the unloaded case, the reverse calculation was carried out using the ZN theory, from the PID gains of the operating point, we turned to the ZN structure to obtain new parameters for the determination of gains. Based on these, we present a new proposal for the determination of PID gains based on ZN theory [15] considering the specific characteristics of the quadrotor and the refined parameters. ZNAQL for the determination of the PID controller parameters with load is presented in Tab. 7.
As a reference for the control of the quadrotor at full load, it is observed that the parameters obtained by ZN theory make it possible to achieve stability in the system but present low efficacy for the tracking reference of the input. For applications involving multirotors with loads, it was necessary to refine the parameters to achieve satisfactory performance results.
In the case of the controllers determined for the systems with and without load, it was verified that the PID controller obtained through ZNAQ and ZNAQL performs better than the controller obtained through ZN theory, demonstrating that the ZNAQ and ZNAQL are valid and efficient, with an improvement of up to 30% for ZNAQ and 75% for ZNAQL, compared to the previously presented overshoot values.
In order to carry out an additional verification of the ZNAQ and ZNAQL proposals, a validation study was carried out by comparing the proposals with the mathematical model of [21], through the computational implementation of the MATLAB toolbox of [22]. In the mathematical model structured by [22], control systems with gains tuned through ZNAQ and ZNAQC were implemented, and the results are presented in Fig. 7. Fig. 7 shows the controller's ability to maintain system stability following the reference input trace. It appears that the implementation of the PID controller with gains obtained through the proposals of ZNAQ and ZNAQC, was successfully achieved, allowing control of the flight of the aircraft and tracking of the  The particularizations of ZNAQ and ZNAQL, besides being efficient, are methodologies for quickly tuning the gains of PID controllers, developed based on data from the dynamics of a real quadrotor. For an empty quadrotor, the ZNAQ methodology can be comparable to the results of the study by [12], with the difference being particular to the dynamics of a quadrotor. However, when the payload is added, the dynamics of the system undergo inertia changes, requiring the use of parameters that consider this new condition. In this circumstance, the ZNAQL proposal provides tuning of the PID controller with load, with a refinement for this specific case.

Conclusion
The ZN theory was implemented for quadrotor attitude pitch and roll control to determine PID controller gains, and the system response was verified. Refined ZNAQ and refined ZNAQL were proposed and found to obtain a significant improvement in the system response for overshoot, by 30% and 75%, respectively. This demonstrates that the proposals are valid and efficient, contributing to the knowledge in this field.
The proposals of ZNAQ and ZNAQL provide the tuning of controllers in two regions of operation, characteristic of the application of drones in the realization of deliveries. In this situation it is suggested that the control system can alternate between two points of operation as needed, and further supports projects involving adaptive controllers.