Attitude Control of a Quadrotor with Fuzzy Logic Controller on SO(3)

A quadrotor is an unmanned aerial vehicle (UAV) with two pairs of rotors rotating in opposite directions. Some of its unique abilities are hovering and vertical take-off and landing (VTOL). Most recent works carried out the UAVs' rotation parametrization using Euler angles and a quaternion. Those UAVs suffer from singularities and ambiguities. A geometric control is generally used to deal with those problems. Exponential coordinate in the geometric control maps R into SO(3). This paper presented a fuzzy logic controller on SO(3) to control the attitude of the quadrotor. The input of the fuzzy logic controller is the angular velocity (ω) and exponential coordinate error of rotation (ζ), while the output is torque (τ). The error function in this controller is a rotation matrix on SO(3). This proposed controller can control the attitude of the quadrotor based on the expected attitude for maneuvers both on one axis and all axis with a steady-state error of about 0.02 rad. Keywords—Quadrotor; Fuzzy Logic; SO(3); Attitude; Rotation Matrix


I. INTRODUCTION
A quadrotor is one of the unmanned aerial vehicles (UAV) with two pairs of rotors rotating in opposite directions. Quadrotor has an ideal platform for various tasks such as intelligence, SAR, Photography, and observations. During a global covid pandemic, a quadrotor is also used to spray disinfectant indoors to prevent the spread of the virus [1] since it can execute hovering and vertical take-off and landing (VTOL).
A quadrotor's attitude is the orientation of the body-fixed frame in respect to the inertial frame. It is determined by the moment and thrust of the two motor pairs. One can modify the speed of the rotor, thus changing the lift force, to make a motion. The quadrotor's ability is determined by its capacity to control its attitude. Attitude control maintains the quadrotor in the expected location [2]. A new task can be added to the system if the attitude control is in a good performance. As such, the orientation of the quadrotor is critical in determining the sensor's accuracy while detecting an obstacle in a navigation task like path planning. Attitudes of quadrotor (rigid body) have a set of 3 × 3 orthogonal matrix, whose determinant is one, known as Special Orthogonal (3) [3]. Different control techniques have been developed to improve the ability of quadrotors, such as PID [4]- [7], sliding-mode [8]- [10], and fuzzy logic [11]- [13]. In addition, the combination of conventional control algorithms with artificial intelligence algorithms has been developed. In Basri [14] and Barghandan [15], the parameter values of the conventional control algorithm (backstepping and sliding mode) were changed by the fuzzy logic algorithm.
A fuzzy set (FS) [16] proposed by Zadeh in 1965 effectively solves problems with uncertainties. The Fuzzy Inference System (FIS) is one of the essential techniques in FS that has been widely applied in various decision-making and classification/prediction applications. Meanwhile, the Fuzzy Logic Control (FLC) applies the fuzzy set concept that deploys human experience and expert knowledge regarding the plant to design a suitable controller. FLC is considered one of the intelligent control schemes. Moreover, it is a model-free technique where a numerical model is unnecessary [17].
Most recent works carried out the UAVs' rotation parametrization using Euler angles. However, those UAVs usually suffer from singularities problems. Some researchers used unit quaternion to represent the rotation matrix, avoiding singularity problems [18]. Although the singularity problem can be resolved with this method, it has the disadvantage called ambiguities. The geometric control method is generally used to deal with singularities and ambiguities. There have been many types of research focused on geometric tracking control. Geometric control is a developed control technique for dynamic systems that evolve on nonlinear, curved spaces that cannot be globally identified with linear Euclidean space. Geometric control techniques provide unique insight to control theory that cannot be obtained from dynamic models represented using local coordinates [19]. Exponential coordinates are used in the geometric control to create a rotation matrix. The matrix exponential, which maps 3 into (3) by summing an endless series of exponential skew-symmetric matrices, is one of the most prominent exponential map methods in robotics. The rotation matrix, which has nine parameters, is essential in the geometric control approach application.
The class of underactuated systems involves a large class of systems, such as tail-sitting robots, quadrotors, underwater vehicles, satellites, and many others. The rotational dynamics of each system belonging to the underactuated systems are defined on a smooth manifold (3) × ℝ 3 [20]. Jen-Te Yu [21] proposed a two-phased transformation process to unify the attitude dynamics under the system. The tracking on (3) based on exponential coordinates has also been investigated in [22], proposed to design tracking controllers for mechanical systems defined on the group of rotations (3).
It takes too much time and effort to create an accurate mathematical model of an aerial vehicle. Parametric identification of an aerial vehicle needs a particular type and number of experiments; this means repetitions are required in each experiment to ensure the accuracy of identification results [23]. Without eliminating the generality, model-free controllers can be designed by two following methods classes. They can be obtained through input-output system analysis, such as artificial neural networks (ANNs), or based on expertise (such as in fuzzy logic controllers (FLCs) [24]. On the other hand, a quadrotor is a multi-input-multi-output (MIMO) system that shows non-linear dynamic behavior such as a high coupling degree and unknown nonlinearities [25]. By using a hierarchical fuzzy method, the complexity of the MIMO systems can be reduced [26]. Based on the description above, a fuzzy logic controller on (3) to control the attitude of the quadrotor UAV is presented. The target of this controller is a rotation matrix ∈ (3) represents an attitude.
The contribution of this research is to propose a new approach to the fuzzy algorithm-based attitude quadrotor controller. This research applies a geometric control approach to represent an attitude, where an exponential coordinate represents an attitude. With this approach, the singularity and ambiguities in the previous work can be avoided.
The structure of the paper will be organized as follows. Section II will review related works as a literature review. Section III will describe the mathematical tools that are usually used in the exponential map. The attitude dynamics of a rigid body and the proposed controller are provided in section IV, while the experiment results will be discussed in section V. Meanwhile, section VI will provide the conclusion.

II.
RELATED WORKS Some researches using exponential coordinates to control a quadrotor have already been conducted. Lee [27] proposed a geometric tracking control system on (3) to avoid singularities and ambiguities that other attitude representations have. A geometric tracking controller for a quadrotor UAV was developed in [28]. Both of these studies solely present the attitude tracking method without considering the control torque. Meanwhile, the attitude controller for a quadrotor using exponential coordinates had already been developed in [29]. The TLC (Trajectory Linearization Control) was used for the controller design. In [30], a robust PD controller on (3) was presented to compensate for the quadrotor center of gravity's unknown position.
In this paper, the attitude control of a quadrotor with a fuzzy logic controller on (3) was presented. The error function of this controller is an error of the exponential coordinate of the rotation matrix.

III. MATHEMATICS PRELIMINARIES
This section will provide some mathematical tools for parameterizing rotation and fundamental understanding of Lie Group and Lie Algebra.

A. Rotation Representation
The denotations of the body frame and inertial frame can be seen in Fig. 1, which are and , respectively. The axes of frame can represent the base of frame , with coordinates , , ∈ 3 . (1)

B. Rotation Decomposition
The rotation group of 3 , normally called as (3), contains all conceivable rotations. The composition rule for rotations is derived from the group structure of (3). The rotation matrix can be determined sequentially if there are three frames, , and . The rotation matrix can be mathematically written as = As a result, given frame and frame , choosing an intermediate frame to decompose into and is always conceivable.

C. Exponential Map & Logarithmic Map
Based on Euler's Rotation Theorem, any element of (3) is equivalent to an axis-angle rotation with axis ∈ 3 and angle ∈ [0, 2 ]. In other words, the exponential coordinate is the canonical representation of ∈ (3), which can be mathematically written as the following equation.

=̂= +̂+
The ˅ operator is a denotation of an inverse of the ^ operator, which recovers ω from ̂.
̂ is a skew-symmetric matrix that fulfills ̂= −̂. All of these matrices construct a vector space, (3), that can be stated as: Therefore, the exponential map of : (3) → (3) from ̂ to =̂. The following equation can prove the statement, Meanwhile, The inverse from Based on the properties of the exponential map, it can be constructively proved that

IV. ATTITUDE CONTROL ON (3)
The modeling of the quadrotor and its control law on (3) are provided in this section.

A. Modeling of Quadrotor
Based on Fig. 1, the rotational attitude dynamics of a fully-actuated rigid body can be observed. The inertial reference frame is defined as { 1, ⃗⃗⃗⃗ 2 ⃗⃗⃗ , 3 ⃗⃗⃗ } and a body-fixed frame is defined as { 1, ⃗⃗⃗⃗ 2 ⃗⃗⃗ , 3 ⃗⃗⃗ }. The origin is defined at the rigid body's center of mass. The configuration of the rigid body is the orientation of the body-fixed frame in respect to the inertial frame, represented by a rotation matrix ∈ (3). The special orthogonal group (3) is a group of 3 × 3 orthogonal matrices.
The equation of quadrotor's motion is given by where ∈ 3×3 is the inertia matrix in the body-fixed frame and ∈ 3 is the angular velocity in the body frame. Meanwhile, ∈ (3) is the rotation matrix transforming the body frame to the inertial frame. The ∈ 3 is the control torque generated by the robot's actuator.

B. Control of Quadrotor
The control torque in equation (11) is a vector, and therefore control can be done separately. In this paper, the controller is based on a fuzzy logic algorithm. The block of the controller is shown in Fig. 2 As shown in Fig. 2, the input of the fuzzy logic controller is an angular velocity (ω) and the exponential coordinate error of rotation (ζ), and the output is the torque (τ). Mamdani method is applied as the basic rule in the algorithm. Five membership functions (N, NS, Z, PS, P) are applied to its inputs and output. The universal sets have different ranges and types for each controller's inputs and output. These membership functions of input and output can be seen in Fig. 3 and Fig. 4. The fuzzy rules are designed in a lookup table and contribute to the decision-making. Since each input has five membership functions, and the fuzzy logic controller has one output with five membership functions, the lookup table will contain 5×5 rules. The rules base of this fuzzy logic controller is shown in Fig. 5. All rules are connected with the AND operator. The rules in Fig. 5 can be read as follow:

If (ζ is NS) AND (ω is Z) then (τ is PS),
If (ζ is Z) AND (ω is Z) then (τ is Z), and so on.

V. EXPERIMENT RESULT
In this section, the controller will be simulated in the 6 DOF (Euler angles) model in Matlab. The model used in this experiment is = 4.34 , = 0.082 . 2 , = 0.0845 . 2 , and = 0.1377 . 2 .
In this paper, a rotation matrix ∈ (3) is used as target rotation, so the target is unique. The simulation considers the following two cases of target rotation: Case 1: The rotation target is a maneuver that only rotates on the -axis. The rotation target matrix is For case (1), from this rotation target, the exponential coordinate (ζ), which is represented by this rotation matrix, can be calculated with equation (8), that is [0.5236; 0; 0]. The error between the desired attitude ζT and current attitude ζc indicates an error of the system. This controller will drive the system so that the error of the system is close to zero. The desired exponential coordinate ζT is reached, as shown in Fig. 6.  Fig. 6, the value of the current exponential coordinate ζc of the -axis and -axis does not change. This is due to the maneuvers that are only on the -axis. From  Fig. 6, the desired exponential coordinate ζT is reached, that is [0.4972; -0.0188; -0.0326]. It can be seen that the controller can control the system toward the desired target orientation, with a small error of orientation, that is [-0.02; -0.02; -0.02] rad. The system is experiencing an overshoot of 0.4 rad, and the convergence can be reached in 20 seconds. Fig. 7 shows the attitude error value that will be zero when convergence has been reached. The steady-state error in this simulation is about 0.02 rad.
For case (2), from this rotation target, the exponential coordinate (ζ) of this rotation matrix can be computed using equation (8), that is [0.429; -0.858; -0.858]. The error between ζT and ζc indicates an error of the system. This controller will drive the system so that the error of the system is close to zero. The desired exponential coordinate ζT is reached, that is [0.407; -0.866; -0.900] as shown in Fig.  8. Compared to the rotation target. The system orientation can be controlled to achieve the desired orientation with a small error, that is [-0.02; -0.02; -0.02] rad.   Fig. 8, the value of exponential coordinate ζc of all axis is changed. This is due to the target rotation that makes a maneuver on all axis. In this case, the system is experiencing an overshoot of about 0.1 rad, and the convergence can be reached in 30 seconds. Fig. 9 shows the attitude error value that will be zero when convergence has been reached. The steady-state error in this simulation is about 0.02 points.  From this simulation, it can be seen that the controller can stabilize the attitude of the quadrotor in hovering conditions, as shown in Fig. 10.
From Fig. 10, it can be seen that the controller can stabilize the attitude of the quadrotor in a hovering condition. The hovering stability can be achieved in 40 seconds. To prove the robustness of the controller, further simulation is carried out by adding a disturbance to the attitude of the quadrotor. This disturbance can be assumed as an external disturbance, such as wind. The scenario is to give a disturbance when the attitude stability in the hovering condition has been achieved. The response of the controller to compensate for this disturbance is shown in Fig. 11. Fig. 11. The response of the controller to compensate for this disturbance From Fig. 11, it can be seen that when hovering stability is reached, a disturbance of 0.1 radians is added to the y-axis orientation (pitch orientation). It can be seen that when the disturbance is given at the 89 th second, the orientation on the y-axis becomes disturbed. The controller responds to a disturbance and recovery the system to its previous stable state. The stability recovery can be achieved within 9 seconds.

VI. CONCLUSIONS
According to the experiment results, the attitude of a quadrotor can be controlled using the proposed Fuzzy Logic controller with a geometric control approach. Using the error of exponential coordinate and angular velocity as the input of the controller and the torque as an output, the proposed controller can control the attitude of the quadrotor toward the expected attitude. The successful results can be achieved with maneuvers on one and all axis. The  (3) convergence is reached with the steady-state error of about 0.02 rad. Moreover, zero angular velocity will be achieved when the system reaches the desired equilibrium.