Cascaded Control System Design for Quadrotor UAV through Relay with Embedded Integrator-Based Automatic Tuning Approach

School of Engineering, RMIT University, Melbourne, VIC 3000, Australia Department of Electronic Engineering, Quaid-e-Awam University of Engineering, Science and Technology, Campus Larkana 77150, Pakistan Electrical and Electronic Engineering, Universiti Teknologi PETRONAS, Seri Iskandar, 32610 Perak, Malaysia Department of Computer Engineering, College of Computer and Information Sciences, King Saud University, P.O. Box 51178, Riyadh 11543, Saudi Arabia Department of Electronic and Electrical Engineering, Faculty of Science and Engineering, Swansea University Bay Campus Swansea, UK


Introduction
Multirotor UAVs are regarded as one of the most revolutionary inventions in the present era [1,2].They have enjoyed a great attention and applicability in a vast variety of applications lately [3,4], as they offer numerous characteristics such as controllability, maneuverability, simple design, economy, and vertical take-off and landing (VTOL) capability [5,6].Quadrotor UAVs have turned out to be the most popular out of all the available multirotor configurations [7].Consequently, quadrotor UAVs are extensively explored over the past three decades in order to advance them mainly in terms of configuration, modelling, and control [8][9][10][11].Quadrotor UAVs are considered as an underactuated system as they offer four control inputs to control the six degrees of freedom [12].The complex nonlinearities and interchannel couplings are also the issues that require attention when designing the control system for these rotorcrafts [5,13].Additionally, when operated outdoor, quadrotors are susceptible to atmospheric turbulences [14,15].As well, during the indoor operation, the airflow of the propellers reflected from the shelters and walls also causes the external disturbance [16].Furthermore, when multiple multircopters operate in the closer proximity to one another, the downwash from one another also causes an impact over the flight performance.Therefore, considering these attributes of the quadrotors, design of the stable and robust control system has been considered as the most challenging task.
The cascade control structure technique is proposed in this paper to realize the control system solutions for the quadrotor UAV, wherein PID controllers have been used in the cascaded control loop.Several control strategies have been designed for the multirotor UAVs over the years, such as [17][18][19][20][21]. PID controllers are supposed to be the most vastly utilized controllers in the quadrotor control system because of their simplified structure and ease of practical implementation [22,23].Due to these reasons, presently the majority of the mainstream commercial autopilot flight controllers are using PID controllers as their main control algorithm, i.e., micropilot [24], ardupilot [25], paparazzi autopilot [26], AfroFlight Naze32, and Multiwii SE V2.0.During the design of the control algorithm for the quadrotor, appropriate tuning of the parameters of respective controllers has been one of the most challenging tasks.The quadrotor dynamics are defined through a set of nonlinear equation [27].It would be a very complex to design the controller for quadrotor through conventional methods that utilize dynamic model of the plant.Furthermore, these physical parameters of the quadrotor are usually determined with the help of certain experimentation, which in turn is supposed to be difficult and time-consuming.Also, these parameters may vary as per operating conditions [28].Additionally, in the quadrotor's physical model, dynamics for the sensor and actuator are often neglected.Also, the quadrotor model is mostly linearized to simplify the designing process of the controller that is performed at the cost of loss of few dynamical details [29].Hence, taking into account, all the aforementioned hitches, the PID controllers designed through modelbased design approach do not necessarily ensure the desired quadrotor control performance.
An alternate method has been proposed in this paper in which the dynamics of UAVs are estimated using response data obtained experimentally from the multirotor through relay feedback system.Relay with hysteresis mechanism is used previously for this purpose in [30,31], wherein two parameters are required to execute the required mechanism such as hysteresis and relay amplitude.The hysteresis parameter is mainly required for the filtration of noisy signal.The relay with an embedded integrator method has been proposed in this paper.One of the major features of the relay with an integrator approach is the simplification of the identification of the dynamics that otherwise need the information of the complex and higher-order models [32].The major theme of opting for the relay with embedded integrator approach is to make sure that the determined information of the plant is encompassed within medium and lower range of frequencies.Moreover, the effect of high-frequency measurement noise is minimized due to the presence of the embedded integrator, and the need to use a hysteresis for the noise is reduced.
FSF is used to estimate the system dynamics through the system responses obtained through the relay feedback system.Then, on the basis of the estimated system model, PID controllers have been tuned automatically through the well-established set of tuning rules proposed in [32].The contributions of this paper are summarized as follows: (1) Robust and stable control solution has been featured for the quadrotor UAV through the automatically tuned cascade control algorithm (2) PID controllers have been designed through the automatic tuning approach that is based on the relay with the embedded integrator technique and system identification.Which incorporates all of the actual quadrotor dynamics that include actuators, sensor dynamics, and gyroscopics

Dynamic Model of Quadrotor and Control Architecture
Body-fixed and earth-fixed frames are the couple of frames referred to as references that are employed to study the quadrotor dynamics.In the earth-fixed frame, Euler angles described as roll, pitch, and yaw are denoted as η = ϕ θ ψ T .Here, roll angle ϕ is the rotation around the x-axis, and similarly, pitch angle θ and yaw angle ψ are the rotations around the y-axis and z-axis.Then, in the body-fixed frame, the quadrotor's angular velocity can be described as Ω = p q r T .Here, p, q, and r are the angular velocities of the quadrotor in the body-fixed frame for three attitude axes (roll, pitch, and yaw).Figure 1 illustrates the configuration of the quadrotor.Subsequently, the acceleration of rotation for the quadrotor's attitude axes in the body-fixed frame can be defined by equations of motion as follows [33]: I xx , I yy , and I zz denote the moments of inertia for each x-, y-and z-axes.J r and ω account for the inertia and velocity of the rotor, respectively, while J r qω and J r pω express the propellers' gyro effect.Moreover, the equations above express the angular velocities of the quadrotor in the bodyfixed frame, which are subsequently converted into the earth-fixed frame through In this equation, N expresses the transformation matrix and is defined as Moreover, thrust and drag torques of each rotor can be expressed as where Q i and T i are the drag and thrust of each rotor.k d and Q i account for the coefficient for thrust and drag, respectively.ω i represents the speed of rotation for each rotor.The moments for the attitude axes (roll, pitch, and yaw) are produced through the control of the thrust difference produced individually by each of the four rotors.Which are represented as τ x , τ y , and τ z for roll, pitch, and yaw, whereas the total thrust as T.These are expressed as The dynamics of the motor would also have an impact over the quadrotor's, especially under turbulences.Therefore, they have also been employed in the quadrotor model and are subsequently estimated using a transfer function of first order as [32] G s = r wv ε m s + 1 6 In this equation, ε m and r wv denote the motor's constant for time and steady-state gain, respectively.
2.1.Control System Structure.Quadrotor is termed as an underactuated system that additionally offers coupled dynamics and nonlinearities.Also, the strong coupling among multiple input-output channels is supposed to be challenging when designing the control system for the quadrotors.The controlled variables in the quadrotor system are three torques to provide angular position control, whereas the altitude control is performed through force (f ).The stable and robust tracing of the desired signals such as ϕ * , θ * , and ψ * is used to be the main objective of the quadrotor control system as well as to tackle any unwanted disturbances.
Cascaded control system using PID controllers has been proposed in this paper to feature the control solution to the aforementioned problems associated with the quadrotor.In the cascaded control structure, the multirotor system dynamics are decomposed in the several simpler and smaller subsystems.For which, a separate PID controller is tuned for each of the decomposed subsystem totally based upon the concerned subsystem dynamics.Which in turn provides the effective resolution towards the control issues of the systems, which exhibit complexity in the dynamics [34].The attitude control system is supposed to be the heart of the quadrotor control structure as it is responsible to maintain the desired 3D orientation of the unmanned vehicle [35].For the quadrotor cascaded control design, dynamics of the attitude system are broken down as inner loop that deals with angular rate and outer loop that deals with angular position.The proposed structure of the quadrotor cascaded attitude control system is depicted in Figure 2. In the inner loop control system, PID controllers attain the angular rate control.While in the outer loop, PD controllers are utilized to provide the control algorithm for the angular position of the quadrotor.Due to the existence of an integrator already in the system dynamics of the outer loop, as presented in Equation ( 2), the integral term from the PID has not been employed in the outer loop control system.Consequently, the addition of an integral controller in the control system of outer loop would lead to the oscillatory response.

Estimation of the System Dynamics and Controller Design
3.1.Relay with Embedded Integrator.The setup of the relay feedback experiment with the embedded integrator is presented in Figure 3.
The incorporation of the integrator into the relay process is actually from the perspective of the identification of the system fundamental frequency (ω 1 ).This type of relay feedback system provides fundamental frequency that intersects the imaginary axis when observing the frequency response at the Nyquist plot.The relay embedded with an integrator leads to the fundamental frequency that exhibits larger time period.This helps the user to negate the hectic process of Figure 1: Quadrotor UAV model.
3 International Journal of Aerospace Engineering selecting the appropriate hysteresis parameter in the relay with hysteresis experiments.Also, the system's frequency response is held into the lower and medium range of frequencies that subsequently prevent the signal from highfrequency noises.
From Figure 3, let us assume that y ss and u ss are the output and steady-state signals of the unknown system.The integral error is then determined as The first-order approximation of this equation, at the t i time interval, would be Subsequently, the integral error e t i can now be determined as e I t i = e I t i − 1 + e t i Δt 9 Consider the steady-state gain to be positive.The relay with embedded integrator mechanism can be defined as follows: where a and ε are the amplitude of the relay and hysteresis, respectively.The relay feedback experiments are performed over the quadrotor model through the mechanism presented in Figure 3.The obtained response for the roll attitude axis has been presented in Figure 4, where the amplitude of the relay is set as 20 °/sec, whereas the hysteresis is kept at the lowest possible value of 0.01.The proposed quadrotor configuration is symmetric across the roll and pitch axes.Consequently, the dynamics for both axes would be identical.Therefore, the relay feedback experiments are not repeated for the pitch axis.The estimated model obtained from the roll axis experiments would be used for the pitch attitude axis as well.The yaw axis response for the relay system is depicted in Figure 5.The relay parameters for the yaw axis are set as similar to the roll axis experiments.4 International Journal of Aerospace Engineering in this expression represents the period indicated as number of samples.Accordingly, output is expressed utilizing frequency sampling filter model, relating to the input signal as Here, l = 1, 2, 3, ⋯ N, while G 0 and G e jlω d account for the frequency response points of the system.v k is measurement noise at output, which is considered the Gaussian distributed possessing variance (σ 2 ) and zero mean.Furthermore, f l k is output vector of the frequency sampling filter, while f 0 k is the frequency sampling filter output at a frequency of zero.These are formulated as in this expressions represents back shift operator that is formulated as When dealing with perfect periodic signals such as u k that have period N, Fourier analysis [38] indicates that it will only be possessing the odd frequencies in number and magnitude would be decaying as the number increases.Because of the noise effects and nonlinearities, it has not been practically often for the u k signal to be realized as perfectly periodic.Accordingly, by neglecting the higher frequency terms, the output signal is defined as Moreover, the vector possessing complex parameters and the correlating regressor vector are also defined as The * in this expression indicates the transpose of complex conjugate.The recursive least square (RLS) algorithm has been employed for the calculation of the vector having estimated frequency parameters that are represented as Θ k and formulated as Subsequently, the frequency response of the plant G e jω d is obtained via the relation of the closed-loop system's frequency response and the information of K T .

T e jω d = G e jω d K T 1 + G e jω d K T 16
Hence, the open loop system's frequency response is then determined as follows: Supposedly, the system is being operated under the faster sampling environment; the discrete time frequency response G e jω d would then be closely approximating to the continuous time frequency response G p jω 1 .Where ω 1 is the fundamental frequency and is defined as ω 1 = ω d /ΔT.Hence, it can be expressed as A single frequency from the frequency response would be enough for the calculation of the gain (K p ) and time delay required to estimate the integrating time delay model for the plant.That is supposed to be as The time delay element in this model is utilized for the estimation of the time constants related to system mainly from the actuator and sensor.Let us assume that the integrating time delay model's frequency response has been equivalent to the approximated G p jω 1 that leads to Through the (20), K p is determined as Here, e −jdω 1 = 1.Time delay approximation is obtained through the comparison of the phase angle over both sides of (20).Which is expressed as, Initially, the FSF is used for the extraction of useful information from the relay experiment response obtained from the roll axis system.The frequency response of the inner closed-loop system can now be estimated as follows: Accordingly, the inner loop plant frequency response is then approximated as follows: The frequency sampling filter also provides the fundamental frequency that is determined as ω 1 = 3 67 radians.K p and d are then obtained through (21) and (22).Accordingly, with the help of inner loop frequency response and fundamental frequency information, these are calculated as K p = 0 669 and d = 0 134.Which results into the formation of the estimated integrator plus delay model of the inner plant as Subsequently, the similar procedure is repeated for the yaw axis identification, where the frequency responses have been estimated as For the yaw inner loop, the fundamental frequency is calculated as ω 1 = 2 98 radians.Moreover, integrator plus time delay model for the yaw attitude axis plant is identified as Hence, the overall estimated model for the attitude system of the quadrotor is presented as where G p s , G q s , and G r s are the estimated transfer functions for the roll, pitch, and yaw axes of the quadrotor, respectively.It can be noted that the estimated transfer function of the roll axis has also been assigned to pitch axis.The proposed quadrotor configuration is symmetric across the roll and pitch axes.Consequently, the dynamics for both axes would be identical.Hence, the identified roll axis transfer function would be used to design the control system for the pitch axis as well.
3.3.PID Controller Design.After obtaining the integrating time delay models, the PID controllers have been tuned on the basis of the estimated attitude models.The controller parameters were acquired through the set of well-established, simple, and robust tuning rules presented in [39,40].For these tuning rules, the values of the PID controllers are determined utilizing normalized parameters as presented below.
Assuming that the damping coefficient (ξ) is 1, the normalized parameters are then formulated as [32] Kc = 1 0 05080β + 0 6208 , 30 where β represents the scale factor, which has been chosen according to the requirement of the closed-loop time constant that is described as τ cl = βd.
The inner loop plant of the quadrotor exhibits the dynamics that are faster.Hence, to achieve the quicker closed-loop response, a comparatively low-performance factor would be required.Hence, it is chosen to be β = 2. Accordingly, the PID parameters for the inner loop (roll rate) control system have been determined through (30)- (32) as K c = 1 566, τ I = 2 0281, and τ D = 0 1018, whereas, for the yaw rate control, the PID controller values are determined as K c = 8 170, τ I = 1 031, and τ D = 0 051.
After designing the inner loop PIDs, the controller parameters for the outer loop PIDs are tuned utilizing an approach that is illustrated in Figure 6.Since the dynamics of the plant in the outer loop are already known that are consisting of the integrator, such that, they achieve the angle    7 International Journal of Aerospace Engineering position with the help of angular rate as illustrated in the given figure.Additionally, the inner loop systems have already been estimated.The approximated model depicting the plant in the outer plant can be obtained using the integrator plus delay system as [32] G s ≈ K p e − τ cl +d s s , 33 where τ cl denotes the closed-loop time constant and the d accounts for the inner loop time delay.While the integrating term in the above equation has been through the plant of outer loop, the delay time is practically through the approximation of the closed-loop inner subsystem.Therefore, for the controlled closed-loop inner, K p is opted as 1.
For the cascade control algorithm, to achieve closed-loop stability and robustness, it is required for the outer loops to possess the response time much slower than the subsequent inner loops for the robust and stable cascade control system [32].Therefore, the outer loop time constant is chosen to be twice of the delay time, and β is opted as 4. In this way, the PID controller's outer loop parameters are calculated as K c = 1 566, τ I = 2 028, and τ D = 0 101 for the roll attitude axis.Similarly, values for the PID controllers to be used for the yaw attitude axis are obtained as K c = 1 028, τ I = 3 089, and τ D = 0 155.

Validation
To validate the proposed idea, the PID controllers tuned and designed based on the relay with integrator mechanism are implemented over the quadrotor model under simulation environment.The model specifications of the quadrotor are presented in Table 1.The control system is implemented in the cascaded structure as presented in Figure 2. Atmospheric turbulences that are modeled based on the Dryden turbulence model [41] are injected into the model of the system as well that are demonstrated in [34,42].The attitude control performance to track desired roll axis is presented in Figure 7.It is observed from the measured roll angular response that the reference command for the roll axis has been traced efficiently without exhibiting any steady-state error.While the stable response of the quadrotor for the roll angular rate to achieve the required roll angle has been pre-sented in Figure 8, it can further be observed that the control signals produced by outer control loops serve as reference signal for the related inner loop, as also depicted in Figure 8.Therefore, the set point command for roll angular rate in Figure 8 depicts the response of control system from the outer loop.In the similar approach, the efficacy of the designed and implemented control system for the remaining attitude axes such as pitch and yaw has also been analyzed in Figures 9-12.
Moreover, comparison is performed in order to examine the superiority of the presented relay with embedded integrator-based automatic tuning approach over the conventional model-based PID controller design approach that is presented in [34].The model-based PID controller is designed for the roll attitude system and is implemented over the quadrotor system.The comparison analysis is presented in Figure 13.It has been analyzed in the demonstrated results that the control performance of the relaybased autotuned control system provides superior attitude response compared to the model-based control system.An improved overall time response including both transient as well steady-state performance is experienced by the autotuned PID control system.Especially when implemented experimentally, the autotuned control system would prove to be even superior over its conventional counterpart control system.Due to the fact that it incorporates almost all of the actual dynamics of the quadrotor including sensors, actuators, and gyroscopics.
It is evident from the analysis of the demonstrated results that the proposed control system, based on cascaded PID control mechanism that has been tuned via the automatic tuning method based on the relay with integrator technique, is providing the required attitude performance with efficacy through keeping a better overall time response of the system including both transient and steady-state responses, since it exhibits minimal overshoots and is providing control operations at an improved rise and settling time.

Conclusions
A robust and stable control design approach for the quadrotor UAV has been presented.Cascaded control structure has been proposed to offer the control solutions to the dynamically complex underactuated quadrotor system.PID controllers for the each cascaded control structure stage are 8 International Journal of Aerospace Engineering designed through the automatic tuning approach.Wherein the automatic tuning approach is based on the actual data acquired through the relay with an embedded integrator approach.The major theme of opting for the relay with embedded integrator approach is to make sure that the determined information of the plant is encompassed within the low and medium range of frequencies.Moreover, the effect of the measurement noise associated with the high frequencies is minimized due to the presence of the embedded integrator, and the need to use a hysteresis for the noise is reduced.The proposed cascaded PID control system designed through relay with an integrator-based automatic tuning approach is implemented over the actual quadrotor model.The results and observations demonstrated in this paper suggest that the designed control strategy is able to achieve the robust and stable attitude performance with an improved transient and steady state response.

Figure 5 :
Figure 5: Yaw axis response for the relay feedback experiment for inner loop.Key: dashed lines: relay output; solid lines: yaw rate.

Figure 12 :
Figure 12: Angular rate response for yaw axis.Key: dashed lines: reference signal; solid lines: actual response.

Figure 8 :
Figure 8: Angular rate response for roll axis.Key: dashed lines: reference signal; solid lines: actual response.

Figure 13 :
Figure 13: Comparison of the control performance.