Quaternion Attitude Control System of Highly Maneuverable Aircraft

: In the era of rapid advancements in manned and unmanned aviation and robotics, there is a need for high-performance, robust attitude control of highly maneuverable ﬁxed-wing aircraft, both manned and unmanned (UAVs). This paper presents an extension to research on spacecraft attitude control. The article extends existing concepts and applies them to the control problem of aircraft operating in Earth’s atmosphere. First, a general concept of quaternions is presented. Next, the attitude controller’s architecture is discussed. The controller synthesis is described using quaternion algebra. The quaternion-based attitude controller is then compared with a classical Euler-based attitude controller. The methodology for comparison and performance evaluation of both controllers is described. Lastly, the results of the simulations and a comparison of the two controllers are presented and discussed. The presented control scheme outperforms classical methods based on Euler angles, particularly at the aircraft’s high pitch and roll angles.


Introduction
The objective of this paper is to present an attitude controller for fixed-wing aircraft operating over large ranges of pitch and roll angles.The presented controller provides desired control qualities over a wide range of flight conditions in terms of speed of response and performance robustness.The aircraft considered in this paper is the Extra 330SC, which is a single-seat aerobatic airplane, manufactured by Extra Flugzeugbau.The long-term goal justifying the need for such a controller is to design a complete autopilot system for unmanned, highly maneuverable fixed-wing strike and fighter aircraft.The attitude controller in this context can be thought of as one of the internal control loops of the autopilot.It means that input to the attitude controller comes from an external controller, such as a guidance system.
Often when speaking about an aircraft's attitude, Euler angles appear in mathematical description.The Euler angles approach is frequently chosen because of its intuitiveness.Although intuitive, Euler angles suffer from non-linearities and singularities, resulting in undesired effects such as gimbal lock.Moreover, an aircraft's control based on Euler angles results in unwanted effects of control coupling between a rudder and an elevator for high roll and pitch angles.This paper presents an effective way of dealing with shortcomings associated with Euler angles by replacing them with quaternions in attitude description and control.
A quaternion number system extends the complex number system and is applied to describe rotations in three-dimensional space.A more stable and often simpler attitude representation can be achieved with quaternions than with Euler angles.Quaternions' computational stability comes from the fact that only unit quaternions are required to describe rotations, reducing numeric errors when they are normalized.They lack the gimbal-lock effect inherent to Euler angles because of their relationship to the axis-angle representation.Their mathematical simpleness comes from the fact that no trigonometric functions are required, only arithmetic functions such as quaternion products (which are computationally efficient).Mathematical tools associated with quaternions also prove the advantage of quaternions over Euler angles.Linear interpolation between two rotations is straightforward in quaternion notation, while impossible in Euler angles notation.Moreover, integrating angular rates to quaternions is much easier than integrating angular rates to Euler angles.This article will present an efficient use of quaternions in an airplane attitude control problem.
Research in quaternion attitude control has been conducted in the area of spacecraft control, and its results can be found in [1][2][3].This article aims to extend this control concept and apply it to the aircraft operating in Earth's atmosphere.
The quaternion number system extends the complex number system.A quaternion is a four-dimensional hyper-complex number that can describe transformations in threedimensional space.Unit quaternions, being quaternions with a norm equal to one, are often used to describe rotations in three-dimensional space.Publications [4][5][6] explain the quaternion construct and associated quaternion algebra in more detail.
A quaternion consists of one real part and three imaginary parts.q w is called the real part and q x , q y , q z are called imaginary parts.Equations ( 1) and ( 2) present the two most popular quaternion notations.q = q w + q x i + q y j + q z k (1) q = q w q x q y q z T The complex conjugate of a quaternion is defined as: The norm of a quaternion q is defined as: The unit quaternion is a quaternion of the norm equal to one.
The quaternion inverse is defined as: For unit quaternion, its inverse is equal to its conjugate: The quaternion product of quaternions p and q, also called the Hamilton product and denoted by ⊗, is defined as: p w q w − p x q x − p y q y − p z q z p w q x + p x q w + p y q z − p z q y p w q y − p x q z + p y q w + p z q x p w q z + p x q y − p y q x + p z q w     (8) Quaternion multiplication is non-commutative in the same way as real-life rotations are non-commutative: All quaternions used in this paper to represent rotation or attitude are unit quaternions.Please note that this does not apply to quaternion derivatives.Care must be taken when calculating a product of a quaternion and a quaternion derivative since this product will also not be unitary.

Materials and Methods
The entire attitude control process is performed in the quaternion form.Yaw, pitch and roll angles are not used to control the aircraft's attitude.The classical three controllers (each for a separate: yaw, pitch and roll angle) have been replaced with one controller operating on a single quaternion representing the aircraft's attitude.The proposed controller is comprised of two major parts working in a cascade.The first (external) part consists of a single quaternion "Q_P Attitude Controller" working similarly to a classical "P" (proportional) controller but being evaluated in quaternion space (Q_P stands for quaternion proportional).The second (internal) part consists of three PID controllers [7] responsible for angular rate control of the aircraft in its three axes.The inputs to the Q_P Attitude Controller are: a desired (setpoint) attitude in the form of a quaternion, denoted as q sp , and a measured attitude in the form of a quaternion, denoted as q meas .Internally, the controller calculates the attitude error, denoted as q err , according to Equation (11).The output of the Q_P Attitude Controller are three angular rate setpoints of the aircraft around its three axes: x, y, z, denoted as: ω x sp , ω y sp , ω z sp .The output of the Q_P Attitude Controller (after saturation) constitutes an input to the three angular rate controllers, which are PID controllers [7].The PID controllers take two inputs.The first input is the setpoint angular rate, and the second is the measured angular rate from the feedback path.The PI part of the controller works on the angular rate error (setpoint minus measured value), and the D part works on the measured value from the feedback path.The outputs from the angular rate controllers are the desired angles of deflection of the aircraft's control surfaces denoted as: δ A sp , δ H sp , δ V sp , which correspond to the deflection angles of the ailerons, elevator and rudder, respectively.Feedback signals in the system consist of three measured angular rates around the x, y and z axes denoted as: ω x meas , ω y meas , ω z meas , and a quaternion representing an aircraft's measured attitude q meas .All signals in the feedback path come from the aircraft's Attitude and Heading Reference System (AHRS) (Figure 1).All quaternions used in this paper to represent rotation or attitude are unit quaternions.Please note that this does not apply to quaternion derivatives.Care must be taken when calculating a product of a quaternion and a quaternion derivative since this product will also not be unitary.

Materials and Methods
The entire attitude control process is performed in the quaternion form.Yaw, pitch and roll angles are not used to control the aircraft's attitude.The classical three controllers (each for a separate: yaw, pitch and roll angle) have been replaced with one controller operating on a single quaternion representing the aircraft's attitude.The proposed controller is comprised of two major parts working in a cascade.The first (external) part consists of a single quaternion "Q_P Attitude Controller" working similarly to a classical "P" (proportional) controller but being evaluated in quaternion space (Q_P stands for quaternion proportional).The second (internal) part consists of three PID controllers [7] responsible for angular rate control of the aircraft in its three axes.The inputs to the Q_P Attitude Controller are: a desired (setpoint) attitude in the form of a quaternion, denoted as , and a measured attitude in the form of a quaternion, denoted as .Internally, the controller calculates the attitude error, denoted as , according to Equation (11).The output of the Q_P Attitude Controller are three angular rate setpoints of the aircraft around its three axes: x, y, z, denoted as: , , .The output of the Q_P Attitude Controller (after saturation) constitutes an input to the three angular rate controllers, which are PID controllers [7].The PID controllers take two inputs.The first input is the setpoint angular rate, and the second is the measured angular rate from the feedback path.The PI part of the controller works on the angular rate error (setpoint minus measured value), and the D part works on the measured value from the feedback path.The outputs from the angular rate controllers are the desired angles of deflection of the aircraft's control surfaces denoted as: δ , δ , δ , which correspond to the deflection angles of the ailerons, elevator and rudder, respectively.Feedback signals in the system consist of three measured angular rates around the x, y and z axes denoted as: , , , and a quaternion representing an aircraft's measured attitude .All signals in the feedback path come from the aircraft's Attitude and Heading Reference System (AHRS) (Figure 1).It has to be noted that the presented quaternion attitude control system is not a complete autopilot system.The presented attitude controller constitutes an inner part of the autopilot.An outer part in a form of a guidance system (GS) is required for a complete autopilot.The guidance system is responsible for calculating the setpoint attitude of the aircraft based on assumed flight plan, in particular the assumed flight trajectory and flight parameters.The attitude control system then executes the setpoint attitude calculated by It has to be noted that the presented quaternion attitude control system is not a complete autopilot system.The presented attitude controller constitutes an inner part of the autopilot.An outer part in a form of a guidance system (GS) is required for a complete autopilot.The guidance system is responsible for calculating the setpoint attitude of the aircraft based on assumed flight plan, in particular the assumed flight trajectory and flight parameters.The attitude control system then executes the setpoint attitude calculated by the GS.In this paper, the GS was replaced by man-generated attitude setpoints contained in test scenarios.In the future, we plan to make GS work fully automatically, which can be achieved, for example, by implementing the inverse dynamics methods described in [8,9].The assumed coordinate system of the airplane is the standard aeronautical reference system [10], where the x-axis points to the nose of the aircraft, the y-axis points to the right wingtip of the aircraft and the z-axis points to the bottom of the airplane's fuselage (Figure 2).
Electronics 2022, 11, x FOR PEER REVIEW 4 of 13 the GS.In this paper, the GS was replaced by man-generated attitude setpoints contained in test scenarios.In the future, we plan to make GS work fully automatically, which can be achieved, for example, by implementing the inverse dynamics methods described in [8,9].The assumed coordinate system of the airplane is the standard aeronautical reference system [10], where the x-axis points to the nose of the aircraft, the y-axis points to the right wingtip of the aircraft and the z-axis points to the bottom of the airplane's fuselage (Figure 2).This section describes the process of the Q_P Attitude Controller synthesis.We begin with a definition of the aircraft's attitude error.The attitude error is a difference between a setpoint attitude and a measured attitude.Typically, in a regular PID controller operating on real numbers, an error value is defined as a difference between the desired setpoint (SP) and the measured process variable (PV), i.e., e(t) = SP(t) − PV(t) [7].In the proposed quaternion attitude controller, the attitude error quaternion is calculated based on the following relationship (10) between the setpoint attitude quaternion and the measured attitude quaternion , assuming intrinsic rotations: Thus, after left-multiplication by we obtain: Since two rotations can describe every attitude, we have to ensure that the attitude error is represented by the shorter of the two possible rotations.To do this, we convert a quaternion to axis-angle representation (12).In this representation, we check the angle of rotation around the axis .If the angle is greater than 180 degrees (13), we invert the axis of rotation and calculate a new angle of the shorter rotation (14).This section describes the process of the Q_P Attitude Controller synthesis.We begin with a definition of the aircraft's attitude error.The attitude error is a difference between a setpoint attitude and a measured attitude.Typically, in a regular PID controller operating on real numbers, an error value is defined as a difference between the desired setpoint (SP) and the measured process variable (PV), i.e., e(t) = SP(t) − PV(t) [7].In the proposed quaternion attitude controller, the attitude error quaternion q err is calculated based on the following relationship (10) between the setpoint attitude quaternion q sp and the measured attitude quaternion q meas , assuming intrinsic rotations: q sp = q meas ⊗ q err (10) Thus, after left-multiplication by q meas we obtain: Since two rotations can describe every attitude, we have to ensure that the attitude error q err is represented by the shorter of the two possible rotations.To do this, we convert a quaternion q err to axis-angle representation (12).In this representation, we check the angle of rotation θ err around the axis u.If the angle is greater than 180 degrees (13), we invert the axis of rotation and calculate a new angle of the shorter rotation θ err short (14). then: else: Next, we need to convert the new attitude error from the axis-angle representation back to the quaternion form (16). q w err short = cos θ err short 2 q x err short = u x short • sin θ err short 2 q y err short = u y short • sin A faster check for the shorter rotation can be performed according to [2].If: q w err < 0 (17) then: q w err short = −q w err q x err short = −q x err q y err short = −q y err q z err short = −q z err (18) else: q w err short = q w err q x err short = q x err q y err short = q y err q z err short = q z err (19) Next, we assume that a quaternion derivative .
q sp representing a desired (setpoint) rate of rotation required to achieve a desired (setpoint) attitude is proportional to the attitude error, i.e., .q sp ∝ q err .After the introduction of proportional gain K p the setpoint rate of rotation becomes (20): .
Next, we need to express the obtained setpoint rate of rotation as an angular rate vector ω sp .The relationship between the quaternion derivative and angular rate vector in the body reference frame is given by [6] (21): Thus: where q u is an unrotated unit quaternion (23): and its conjugate q u (24): In extended form, the setpoint angular rate vector becomes (25): Thus, after simplification (26): and finally (27): The ω sp vector is an output from the Q_P Attitude Controller and input to the three PID controllers responsible for the aircraft's angular rate control, as shown in Figure 1.The simplicity of the result makes the control computationally efficient and makes a direct physical interpretation of the result possible.A fact worth noting is that, unlike Eulerbased attitude controllers, the quaternion-based controller will tend to generate a rotation resulting in the shortest path, provided that the aircraft under consideration can achieve the same angular rates in all three (body) axes.
The controller was fully implemented in the "C" language.An extensive quaternion math library was created to support the required quaternion algebra.Preliminary tests were conducted on a simple dynamic model and ran on a simulation in the "C" language.Further tests were conducted using Simulink R2020b combined with Laminar Research X-Plane 11 simulation environment, using a much more complex dynamic model.The controller's compiled "C" files were used as Simulink blocks during simulations.X-Plane flight dynamics and dynamic airplane models were used during the simulations.
To evaluate the performance of the attitude control, the quaternion-based controller (Figure 1) was compared to the conventional Euler-based controller (Figure 3).The Eulerbased controller operates on three Euler angles to represent the aircraft's attitude.Therefore, the attitude control is performed on these three angles instead of the one quaternion as it is accomplished in the quaternion-based controller.
x FOR PEER REVIEW 7 of 13 The described Euler-based controller is designed in the same cascaded architecture as the proposed quaternion-based controller.The outer control loop is the airplane's attitude control loop, and the inner control loop is the airplane's angular rate control loop.The outer loop consists of three proportional ("P") controllers.The inner loop consists of three PID controllers, a variation of a classical PID controller, as described in [7].The outer The described Euler-based controller is designed in the same cascaded architecture as the proposed quaternion-based controller.The outer control loop is the airplane's attitude control loop, and the inner control loop is the airplane's angular rate control loop.The outer loop consists of three proportional ("P") controllers.The inner loop consists of three PID controllers, a variation of a classical PID controller, as described in [7].The outer control loop output (after saturation) constitutes an input to the inner control loop.ϕ sp , θ sp , ψ sp denote setpoint roll, pitch and yaw angles, respectively.ω x sp , ω y sp , ω z sp denote setpoint angular rates in the airplane's x, y and z axes, respectively.δ A sp , δ H sp , δ V sp denote commanded deflections of ailerons, elevator and rudder, respectively.ω x meas , ω y meas , ω z meas on the feedback path denote measured angular rates in the airplane's x, y and z axes, respectively.ϕ meas , θ meas , ψ meas on the feedback path denote the airplane's measured roll, pitch and yaw angles, Details of the classical, Euler-based, cascaded controller can be found in [11].Computations required to convert from quaternion to Euler angles are described in [5].
Both controllers were implemented in Simulink and coupled with X-Plane 11 simulation environment and then tested against each other during several test scenarios.The test scenarios were designed in such a way as to reflect real-life turn maneuvers of an airplane performed at various roll angles.For example, the turns were simulated at the following roll angles: 30, 60 (Figure 4), 80 and 90 degrees (knife-edge turn).The described Euler-based controller is designed in the same cascaded architecture as the proposed quaternion-based controller.The outer control loop is the airplane's attitude control loop, and the inner control loop is the airplane's angular rate control loop.The outer loop consists of three proportional ("P") controllers.The inner loop consists of three PID controllers, a variation of a classical PID controller, as described in [7].The outer control loop output (after saturation) constitutes an input to the inner control loop., , denote setpoint roll, pitch and yaw angles, respectively., , denote setpoint angular rates in the airplane's x, y and z axes, respectively.δ , δ , δ denote commanded deflections of ailerons, elevator and rudder, respectively., , on the feedback path denote measured angular rates in the airplane's x, y and z axes, respectively., , on the feedback path denote the airplane's measured roll, pitch and yaw angles, respectively.Details of the classical, Euler-based, cascaded controller can be found in [11].Computations required to convert from quaternion to Euler angles are described in [5].
Both controllers were implemented in Simulink and coupled with X-Plane 11 simulation environment and then tested against each other during several test scenarios.The test scenarios were designed in such a way as to reflect real-life turn maneuvers of an airplane performed at various roll angles.For example, the turns were simulated at the following roll angles: 30, 60 (Figure 4), 80 and 90 degrees (knife-edge turn).The test scenarios were designed in the following way: each aircraft's distinct (key) setpoint attitude during the maneuver was given a setpoint "pose" number.The Euler angles (psi, theta, phi) were determined for each distinct pose.Between the following poses, time differences (delta T) were determined.Test scenarios created this way (Figure 5) were inputs to the Simulink/X-Plane simulation.The test scenarios were designed in the following way: each aircraft's distinct (key) setpoint attitude during the maneuver was given a setpoint "pose" number.The Euler angles (psi, theta, phi) were determined for each distinct pose.Between the following poses, time differences (delta T) were determined.Test scenarios created this way (Figure 5) were inputs to the Simulink/X-Plane simulation.Each test scenario was processed in Simulink in the following fashion.First, each set point pose attitude was converted from Euler angles representation to quaternion repre sentation.Then, intermediate poses were calculated using Spherical Linear Interpolation (SLERP) between all distinct key poses from the scenarios.In this way, a smooth transition between key setpoint poses was obtained.A smooth attitude setpoint was therefore achieved.This smooth, interpolated attitude setpoint was finally fed to the inputs of the attitude controllers (quaternion-based and Euler-based).
An Extra 330 SC airplane (Figure 6) was chosen to be simulated.A dynamic mode of the airplane for the X-Plane 11 was purchased from the official X-Plane Store.Part num Each test scenario was processed in Simulink in the following fashion.First, each setpoint pose attitude was converted from Euler angles representation to quaternion representation.Then, intermediate poses were calculated using Spherical Linear Interpolation (SLERP) between all distinct key poses from the scenarios.In this way, a smooth transition between key setpoint poses was obtained.A smooth attitude setpoint was therefore achieved.This smooth, interpolated attitude setpoint was finally fed to the inputs of the attitude controllers (quaternion-based and Euler-based).
An Extra 330 SC airplane (Figure 6) was chosen to be simulated.A dynamic model of the airplane for the X-Plane 11 was purchased from the official X-Plane Store.Part number of the product: Vertigo-330SC.The fact of its use by one of the Red Bull Air Race professional pilots, during his virtual trainings, validates the accuracy of the purchased dynamic model.Each test scenario was processed in Simulink in the following fashion.First, each setpoint pose attitude was converted from Euler angles representation to quaternion representation.Then, intermediate poses were calculated using Spherical Linear Interpolation (SLERP) between all distinct key poses from the scenarios.In this way, a smooth transition between key setpoint poses was obtained.A smooth attitude setpoint was therefore achieved.This smooth, interpolated attitude setpoint was finally fed to the inputs of the attitude controllers (quaternion-based and Euler-based).
An Extra 330 SC airplane (Figure 6) was chosen to be simulated.A dynamic model of the airplane for the X-Plane 11 was purchased from the official X-Plane Store.Part number of the product: Vertigo-330SC.The fact of its use by one of the Red Bull Air Race professional pilots, during his virtual trainings, validates the accuracy of the purchased dynamic model.Both attitude controllers utilized equal proportional gains.In addition, both controllers used the same internal loop responsible for angular rate control, so the same PID gains were automatically assured between the two controllers.Therefore, it is important when comparing the performance of the two controllers.
To improve the robustness of the control, the outputs of the angular rate controllers were correlated with the square of the aircraft airspeed, which comes directly from the lift force equation [10].

Results
This section presents the results of the performed simulations.The simulations consisted of turns performed at 30-, 60-, 80-and 90-degree roll angles by the quaternion-based and the Euler-based controllers.For each simulated turn, two types of plots are presented-the setpoint tracking performance plot and the tracking error plot.The setpoint Both attitude controllers utilized equal proportional gains.In addition, both controllers used the same internal loop responsible for angular rate control, so the same PID gains were automatically assured between the two controllers.Therefore, it is important when comparing the performance of the two controllers.
To improve the robustness of the control, the outputs of the angular rate controllers were correlated with the square of the aircraft airspeed, which comes directly from the lift force equation [10].

Results
This section presents the results of the performed simulations.The simulations consisted of turns performed at 30-, 60-, 80-and 90-degree roll angles by the quaternion-based and the Euler-based controllers.For each simulated turn, two types of plots are presentedthe setpoint tracking performance plot and the tracking error plot.The setpoint tracking performance plots illustrate the setpoint attitude and the measured attitude achieved by the two controllers, presented in the form of Euler angles (ψ, θ, ϕ).The tracking error plots illustrate tracking errors in yaw, pitch and roll for both controllers.
First, the turns at a 30-degree roll angle were simulated, with the results as shown in (Figures 7 and 8).
Electronics 2022, 11, x FOR PEER REVIEW 9 of 13 tracking performance plots illustrate the setpoint attitude and the measured attitude achieved by the two controllers, presented in the form of Euler angles (ψ, θ, φ).The tracking error plots illustrate tracking errors in yaw, pitch and roll for both controllers.First, the turns at a 30-degree roll angle were simulated, with the results as shown in (Figures 7 and 8).(Figures 7 and 8).Next, the turns at a 60-degree roll angle were simulated, with the results as shown in (Figures 9 and 10).(Figures 7 and 8).At the 60-degree roll angle, both controllers also perform well.Once again, the quaternion-based controller has a slight edge in tracking yaw and pitch angles.
Next, the turns at an 80-degree roll angle were simulated, with the results as shown in (Figures 11 and 12).At the 60-degree roll angle, both controllers also perform well.Once again, the quaternion-based controller has a slight edge in tracking yaw and pitch angles.
Next, the turns at an 80-degree roll angle were simulated, with the results as shown in (Figures 11 and 12).At the 60-degree roll angle, both controllers also perform well.Once again, the quaternion-based controller has a slight edge in tracking yaw and pitch angles.
Next, the turns at an 80-degree roll angle were simulated, with the results as shown in (Figures 11 and 12).
At the 80-degree roll angle, the difference in the performance of the two controllers becomes apparent.The quaternion-based controller performs significantly better with a much tighter tracking of yaw and pitch angles.The Euler-based controller performs worse than the quaternion one due to the couplings: rudder-pitch, and elevator-yaw in the aircraft's control.The Euler-based controller does not "understand" that at high roll angles, the rudder controls the pitch angle, and the elevator controls the yaw angle.Due to its architecture and mathematical properties of quaternions, the quaternion-based controller "understands" this phenomenon and is able to perform proper and efficient control of the aircraft.At the 80-degree roll angle, the difference in the performance of the two controllers becomes apparent.The quaternion-based controller performs significantly better with a much tighter tracking of yaw and pitch angles.The Euler-based controller performs worse than the quaternion one due to the couplings: rudder-pitch, and elevator-yaw in the aircraft's control.The Euler-based controller does not "understand" that at high roll angles, the rudder controls the pitch angle, and the elevator controls the yaw angle.Due to its architecture and mathematical properties of quaternions, the quaternion-based controller "understands" this phenomenon and is able to perform proper and efficient control of the aircraft.At the 80-degree roll angle, the difference in the performance of the two controllers becomes apparent.The quaternion-based controller performs significantly better with a much tighter tracking of yaw and pitch angles.The Euler-based controller performs worse than the quaternion one due to the couplings: rudder-pitch, and elevator-yaw in the aircraft's control.The Euler-based controller does not "understand" that at high roll angles, the rudder controls the pitch angle, and the elevator controls the yaw angle.Due to its architecture and mathematical properties of quaternions, the quaternion-based controller "understands" this phenomenon and is able to perform proper and efficient control of the aircraft.Lastly, the turns at a 90-degree roll angle were simulated, with the results as shown in (Figures 13 and 14).
At the 90-degree roll angle, the difference in the performance of the two controllers becomes even more significant.The quaternion-based controller continues to perform better and better as the roll angle increases, compared to the Euler-based controller.It is due to stronger rudder-pitch and elevator-yaw couplings as the roll angle increases.
Because the dynamic model was purchased and there was no insight into it, the experimental stability analysis of the controller was performed.The quaternion-based controller response was evaluated at various attitudes and various setpoints resulting in attitude errors spanning from 0 to 180 degrees in all three Euler angles.The experimental stability analysis did not show any unstable areas in the system.
Lastly, the turns at a 90-degree roll angle were simulated, with the results as shown in (Figures 13 and 14).At the 90-degree roll angle, the difference in the performance of the two controllers becomes even more significant.The quaternion-based controller continues to perform better and better as the roll angle increases, compared to the Euler-based controller.It is due to stronger rudder-pitch and elevator-yaw couplings as the roll angle increases.
Because the dynamic model was purchased and there was no insight into it, the experimental stability analysis of the controller was performed.The quaternion-based con- Lastly, the turns at a 90-degree roll angle were simulated, with the results as shown in (Figures 13 and 14).At the 90-degree roll angle, the difference in the performance of the two controllers becomes even more significant.The quaternion-based controller continues to perform better and better as the roll angle increases, compared to the Euler-based controller.It is due to stronger rudder-pitch and elevator-yaw couplings as the roll angle increases.
Because the dynamic model was purchased and there was no insight into it, the experimental stability analysis of the controller was performed.The quaternion-based con- The proposed controller outperforms the Euler angle-based controller.The difference in performance between the two controllers becomes larger as the pitch and roll angles of the aircraft's maneuver increase.Where Euler-based attitude control is sufficient at low pitch and roll angles, it becomes lacking at high angles, mostly due to the elevator and rudder couplings.The major advantage of the quaternion approach reveals itself at high roll and pitch angles.The major difference in the setpoint tracking is observed in the yaw and pitch channels.There is no relevant difference in the setpoint tracking for the roll channel between the two controllers.This is because the roll is the last rotation in Euler angles and is equivalent to the aircraft's rotation around its x-axis.

Figure 1 .
Figure 1.The schematic of the quaternion-based controller architecture.

Figure 1 .
Figure 1.The schematic of the quaternion-based controller architecture.

Figure 3 .
Figure 3.The schematic of the Euler-based controller architecture.

Figure 3 .
Figure 3.The schematic of the Euler-based controller architecture.

Figure 3 .
Figure 3.The schematic of the Euler-based controller architecture.

Figure 4 .
Figure 4. Example of a simulated maneuver-a turn at a 60-degree roll angle.

Figure 4 .
Figure 4. Example of a simulated maneuver-a turn at a 60-degree roll angle.

Electronics 2022 , 1 Figure 5 .
Figure 5. Example of the test scenario-a turn at a 60-degree roll angle.

Figure 5 .
Figure 5. Example of the test scenario-a turn at a 60-degree roll angle.

Figure 5 .
Figure 5. Example of the test scenario-a turn at a 60-degree roll angle.

Figure 6 .
Figure 6.Extra 330 SC during the simulated turn.

Figure 6 .
Figure 6.Extra 330 SC during the simulated turn.

Figure 8 .
Figure 8. Tracking error-turn at a 30-degree roll angle.At the 30-degree roll angle, both controllers perform the turn very well.The quaternion-based controller has a slight edge in tracking yaw and pitch angles, though.Next, the turns at a 60-degree roll angle were simulated, with the results as shown in (Figures9 and 10).

Figure 8 .
Figure 8. Tracking error-turn at a 30-degree roll angle.At the 30-degree roll angle, both controllers perform the turn very well.The quaternion-based controller has a slight edge in tracking yaw and pitch angles, though.Next, the turns at a 60-degree roll angle were simulated, with the results as shown in (Figures9 and 10). ).

Figure 8 .
Figure 8. Tracking error-turn at a 30-degree roll angle.At the 30-degree roll angle, both controllers perform the turn very well.The quaternionbased controller has a slight edge in tracking yaw and pitch angles, though.Next, the turns at a 60-degree roll angle were simulated, with the results as shown in (Figures9 and 10). ).

Figure 9 .
Figure 9. Setpoint tracking performance-turn at a 60-degree roll angle.Figure 9. Setpoint tracking performance-turn at a 60-degree roll angle.

Figure 9 .
Figure 9. Setpoint tracking performance-turn at a 60-degree roll angle.Figure 9. Setpoint tracking performance-turn at a 60-degree roll angle.