*Article* **Quaternion Attitude Control System of Highly Maneuverable Aircraft**

**Michał Goł ˛abek \*, Michał Welcer, Cezary Szczepa ´nski, Mariusz Krawczyk, Albert Zajdel and Krystian Borodacz**

Łukasiewicz Research Network—Institute of Aviation, Al. Krakowska 110/114, 02-256 Warszawa, Poland **\*** Correspondence: michal.golabek@ilot.lukasiewicz.gov.pl

**Abstract:** 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 fixed-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.

**Keywords:** attitude; control; aircraft; UAV; fixed-wing; quaternions; Euler angles; avionics

**Citation:** Goł ˛abek, M.; Welcer, M.; Szczepa ´nski, C.; Krawczyk, M.; Zajdel, A.; Borodacz, K. Quaternion Attitude Control System of Highly Maneuverable Aircraft. *Electronics* **2022**, *11*, 3775. https://doi.org/ 10.3390/electronics11223775

Academic Editors: Imre J. Rudas, Piotr Szymak, Stanisław Hozy ´ ˙ n and Paweł Piskur

Received: 7 October 2022 Accepted: 16 November 2022 Published: 17 November 2022

**Publisher's Note:** MDPI stays neutral with regard to jurisdictional claims in published maps and institutional affiliations.

**Copyright:** © 2022 by the authors. Licensee MDPI, Basel, Switzerland. This article is an open access article distributed under the terms and conditions of the Creative Commons Attribution (CC BY) license (https:// creativecommons.org/licenses/by/ 4.0/).

#### **1. 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–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–6] explain the quaternion construct and associated quaternion algebra in more detail.

A quaternion consists of one real part and three imaginary parts. *qw* is called the real part and *qx*, *qy*, *qz* are called imaginary parts. Equations (1) and (2) present the two most popular quaternion notations.

$$q = q\_w + q\_x \mathbf{i} + q\_y \mathbf{j} + q\_z \mathbf{k} \tag{1}$$

$$q = \begin{bmatrix} q\_w \ q\_x \ q\_y \ q\_z \end{bmatrix}^T \tag{2}$$

The complex conjugate of a quaternion is defined as:

$$\overline{q} = \begin{bmatrix} q\_w \ -q\_x \ -q\_y \ -q\_z \end{bmatrix}^T \tag{3}$$

The norm of a quaternion *q* is defined as:

$$|q| = \sqrt{q\_w^2 + q\_x^2 + q\_y^2 + q\_z^2} \tag{4}$$

The unit quaternion is a quaternion of the norm equal to one.

$$|q\_{unit}| = 1\tag{5}$$

The quaternion inverse is defined as:

$$q^{-1} = \frac{\overline{q}}{\|q\|^2} \tag{6}$$

For unit quaternion, its inverse is equal to its conjugate:

$$q\_{unit}^{-1} = \overline{q}\_{unit} \tag{7}$$

The quaternion product of quaternions *p* and *q*, also called the Hamilton product and denoted by ⊗, is defined as:

$$p \otimes q = \begin{bmatrix} 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 \end{bmatrix} \tag{8}$$

Quaternion multiplication is non-commutative in the same way as real-life rotations are non-commutative:

$$p \otimes q \neq q \otimes p \tag{9}$$

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.

#### **2. 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 *qsp*, and a measured attitude in the form of a quaternion, denoted as *qmeas*. Internally, the controller calculates the attitude error, denoted as *qerr*, 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: *ωxsp* , *ωysp* , *ωzsp* . 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: δ*Asp* , δ*Hsp* , δ*Vsp* , 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: *ωxmeas*, *ωymeas*, *ωz*meas , and a quaternion representing an aircraft's measured attitude *qmeas*. All signals in the feedback path come from the aircraft's Attitude and Heading Reference System (AHRS) (Figure 1).

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

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).

**Figure 2.** The assumed aircraft coordinate system [10].

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 *qerr* is calculated based on the following relationship (10) between the setpoint attitude quaternion *qsp* and the measured attitude quaternion *qmeas*, assuming intrinsic rotations:

$$q\_{sp} = q\_{meas} \odot \ q\_{err} \tag{10}$$

Thus, after left-multiplication by *qmeas* we obtain:

$$q\_{err} = \overline{q}\_{meas} \odot \ q\_{sp} \tag{11}$$

Since two rotations can describe every attitude, we have to ensure that the attitude error *qerr* is represented by the shorter of the two possible rotations. To do this, we convert a quaternion *qerr* 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 *θerrshort* (14).

$$\begin{aligned} \theta\_{err} &= 2 \cdot \arccos(q\_{w\_{err}})\\ u\_x &= \frac{q\_x}{\sqrt{1 - q\_{w\_{err}}^2}}\\ u\_y &= \frac{q\_y}{\sqrt{1 - q\_{w\_{err}}^2}}\\ u\_z &= \frac{q\_z}{\sqrt{1 - q\_{w\_{err}}^2}} \end{aligned} \tag{12}$$

*θerr* > *π* (13)

*θerrshort* = |*θerr* − 2*π*| *uxshort* = −*ux uyshort* = −*uy uzshort* = −*uz* (14)

If:

then:

else:

$$\begin{aligned} \theta\_{\text{eff}\_{\text{shvrt}}} &= \theta\_{\text{crr}}\\ \mu\_{x\_{\text{shvrt}}} &= \mu\_x\\ \mu\_{y\_{\text{shvrt}}} &= \mu\_y\\ \mu\_{z\_{\text{shvrt}}} &= \mu\_z \end{aligned} \tag{15}$$

Next, we need to convert the new attitude error from the axis–angle representation back to the quaternion form (16).

$$\begin{aligned} q\_{wr\_{shbrt}} &= \cos\left(\frac{\theta\_{crr\_{shbrt}}}{2}\right) \\ q\_{x\_{crr\_{shbrt}}} &= u\_{x\_{shbrt}} \cdot \sin\left(\frac{\theta\_{crr\_{shbrt}}}{2}\right) \\ q\_{y\_{crr\_{shbrt}}} &= u\_{y\_{shbrt}} \cdot \sin\left(\frac{\theta\_{crr\_{shbrt}}}{2}\right) \\ q\_{z\_{crr\_{shbrt}}} &= u\_{z\_{shbrt}} \cdot \sin\left(\frac{\theta\_{crr\_{shbrt}}}{2}\right) \end{aligned} \tag{16}$$

A faster check for the shorter rotation can be performed according to [2]. If:

$$q\_{w\_{err}} < 0 \tag{17}$$

then:

$$\begin{aligned} q\_{wr\_{shrt}} &= -q\_{w\_{err}} \\ q\_{Xorr\_{shrt}} &= -q\_{Xorr} \\ q\_{ycr\_{shrt}} &= -q\_{y\_{err}} \\ q\_{zcr\_{shrt}} &= -q\_{z\_{err}} \end{aligned} \tag{18}$$

else:

$$\begin{aligned} q\_{w\_{cr\_{shrt}}} &= q\_{w\_{crr}} \\ q\_{x\_{crr\_{shrt}}} &= q\_{x\_{crr}} \\ q\_{y\_{crr\_{shrt}}} &= q\_{y\_{crr}} \\ q\_{z\_{cr\_{shrt}}} &= q\_{z\_{cr}} \end{aligned} \tag{19}$$

Next, we assume that a quaternion derivative . *qsp* representing a desired (setpoint) rate of rotation required to achieve a desired (setpoint) attitude is proportional to the attitude error, i.e., . *qsp* ∝ *qerr*. After the introduction of proportional gain *Kp* the setpoint rate of rotation becomes (20): .

$$
\dot{q}\_{sp} = K\_p \cdot q\_{err\_{short}} \tag{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):

$$
\omega = 2\overline{q} \otimes \dot{q} \tag{21}
$$

Thus:

$$
\omega\_{sp} = 2\overline{q}\_u \otimes \dot{q}\_{sp} \tag{22}
$$

where *qu* is an unrotated unit quaternion (23):

$$q\_u = \begin{bmatrix} 1 & 0 & 0 & 0 \end{bmatrix}^T \tag{23}$$

and its conjugate *qu* (24):

$$
\overline{q}\_u = q\_u \tag{24}
$$

In extended form, the setpoint angular rate vector becomes (25):

$$
\begin{bmatrix}
\omega\_{x\_{sp}} \\
\omega\_{y\_{sp}} \\
\omega\_{z\_{sp}}
\end{bmatrix} = 2 \cdot \begin{bmatrix}
\overline{q}\_{\overline{w}\_{\overline{u}}} \cdot \dot{q}\_{x\_{sp}} + \overline{q}\_{x\_{u}} \cdot \dot{q}\_{w\_{sp}} + \overline{q}\_{y\_{u}} \cdot \dot{q}\_{z\_{sp}} - \overline{q}\_{z\_{u}} \cdot \dot{q}\_{y\_{sp}} \\
\overline{q}\_{\overline{w}\_{\overline{u}}} \cdot \dot{q}\_{y\_{sp}} - \overline{q}\_{x\_{u}} \cdot \dot{q}\_{z\_{sp}} + \overline{q}\_{y\_{u}} \cdot \dot{q}\_{\overline{w}\_{sp}} + \overline{q}\_{z\_{u}} \cdot \dot{q}\_{X\_{sp}} \\
\overline{q}\_{\overline{w}\_{\overline{u}}} \cdot \dot{q}\_{z\_{sp}} + \overline{q}\_{x\_{u}} \cdot \dot{q}\_{y\_{sp}} - \overline{q}\_{y\_{u}} \cdot \dot{q}\_{x\_{sp}} + \overline{q}\_{z\_{u}} \cdot \dot{q}\_{w\_{sp}}
\end{bmatrix} \tag{25}
$$

Thus, after simplification (26):

$$
\begin{bmatrix}
\omega\_{x\_{sp}} \\
\omega\_{y\_{sp}} \\
\omega\_{z\_{sp}}
\end{bmatrix} = 2 \cdot \begin{bmatrix}
\dot{q}\_{x\_{sp}} \\
\dot{q}\_{y\_{sp}} \\
\dot{q}\_{z\_{sp}}
\end{bmatrix} \tag{26}
$$

and finally (27):

$$
\begin{bmatrix}
\omega\_{x\_{sp}} \\
\omega\_{y\_{sp}} \\
\omega\_{z\_{sp}}
\end{bmatrix} = \mathbf{2} \cdot \mathbf{K}\_p \cdot \begin{bmatrix}
q\_{x\_{err\_{shwrt}}} \\
q\_{Yer\_{shwrt}} \\
q\_{zer\_{shwrt}}
\end{bmatrix} \tag{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.

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

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. *ωxsp* , *ωysp* , *ωzsp* denote setpoint angular rates in the airplane's *x*, *y* and *z* axes, respectively. δ*Asp* , δ*Hsp* , δ*Vsp* denote commanded deflections of ailerons, elevator and rudder, respectively. *ωxmeas*, *ωymeas*, *ωzmeas* 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, 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).

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

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.


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

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.

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

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].

#### **3. 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 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).

**Figure 7.** *Cont*.

**Figure 7.** Setpoint tracking performance—turn at a 30-degree roll angle.

**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 (Figures 9 and 10).

**Figure 9.** *Cont*.

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

**Figure 10.** Tracking error—turn at a 60-degree roll angle.

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.

**Figure 11.** Setpoint tracking performance—turn at an 80-degree roll angle.

**Figure 12.** Tracking error—turn at an 80-degree roll angle.

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.

**Figure 13.** Setpoint tracking performance—turn at a 90-degree roll angle.

**Figure 14.** Tracking error—turn at a 90-degree roll angle.

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.

#### **4. Conclusions**

The controller can be successfully employed to control manned and unmanned aerial vehicles operating at high pitch and roll angles. In addition, a slightly modified version of the controller can be used to control cruising missiles and space rockets. Some preliminary tests were conducted in this direction, employing a Matlab simulation of an ILR-33 Amber sounding rocket, with great results.

Quaternion attitude control, counterintuitively, can be less complex than Euler angle control since a single quaternion represents a single rotation. In contrast, a single set of Euler angles represent three consecutive rotations, adding to the complexity of the control.

**Author Contributions:** Conceptualization, M.G.; methodology, M.G., M.K. and C.S.; software, M.G.; validation, M.G. and M.W.; formal analysis, M.K., C.S. and K.B.; investigation, M.G.; resources, M.G.; data curation, M.W.; writing—original draft preparation, M.G.; writing—review and editing, M.K., C.S. and A.Z.; visualization, M.G. and M.W.; supervision, M.K., C.S. and A.Z.; project administration, M.K., C.S. and A.Z.; funding acquisition, M.K., C.S. and A.Z. All authors have read and agreed to the published version of the manuscript.

**Funding:** This research received no external funding.

**Data Availability Statement:** Not applicable.

**Conflicts of Interest:** The authors declare no conflict of interest.

#### **References**

