Lyapunov-based Robust Adaptive Configuration of the UAS-S4 Flight Dynamics Fuzzy Controller

Abstract In tandem with the fast-growing demand for Unmanned Aerial Vehicles (UAVs) for surveillance and reconnaissance, advanced controllers for these critical systems are needed. This paper proposes a flight dynamics controller design that considers various uncertainties for the Hydra Technologies UAS-S4 Ehécatl. In order to be realistic, in addition to flight dynamics nonlinearities, three main sources of uncertainties are considered, as those caused by unknown controller’s parameters, modeling errors, and external disturbances. A Robust adaptive fuzzy logic controller is designed, in charge of nonlinear flight dynamics in presence of a variety of uncertainties. The nonlinear flight dynamics is modeled based on the Takagi-Sugeno method relying on the soft association of local linear models. Since this controller is model-based, an optimal reference model is defined, which is stabilised by the Linear Quadratic Regulator procedure. A fuzzy logic controller is then designed for the nonlinear model. Lastly, with the aim to handle the uncertainties, the gains of the fuzzy controller are reconfigured, and are continuously adjusted by Lyapunov-based robust adaptive laws. The performance of the UAS-S4 Robust adaptive fuzzy logic controller is evaluated in terms of lateral and longitudinal flight dynamics stabilisation, and the reference model state variables tracking under various uncertainties.


Introduction
Unmanned Aerial Vehicles (UAVs) are remotely controlled aircraft designed to perform specific tasks. Due to the fast-growing demand for UAVs aimed at a variety of applications, the design of UAVs has remained a dynamic research field [1]. In most cases, UAVs have been produced for military and disaster relief purposes, as well as for surveillance and reconnaissance [2]. The UAS-S4 Ehecatl is such an UAV, designed and manufactured by the Hydra Technologies company in Mexico to perform military and civilian surveillance [3]. Critical UAV systems are equipped with accurate flight dynamics controllers [4]. Designing an efficient controller requires an accurate flight dynamics model [5]. In fact, the access to the flight dynamics model enhances our ability to evaluate the controller performance in the early phases of the UAV development instead of relying mainly on flight test phases, which dramatically improves flight safety while reducing both costs and time [6]. The present work seeks to design a fully functional controller for the UAS-S4 based on its flight dynamics model. In this context, the model refers to the mathematical representation of the UAS-S4 flight dynamics system, which is basically used for its better understanding, prediction and control.
Since fixed-wing UAS-S4s have the minimum number of required control surfaces, only a few actuators should provide a safe and reliable flight. While utilising a fewer number of actuators results in a simpler UAV flight dynamics model, flight stability may become more affected in the presence of uncertainties [7]. These uncertainties may be external disturbances (dues to environmental conditions) [8], unknown controller parameters (affected by actuator and sensor imperfections) [9], and model imperfections (dues to model approximation and to experimental errors) [10]. Additionally, following changes in flight conditions, the flight dynamics behave nonlinearly [11]. In order to provide stable flight, it is essential to obtain an accurate mathematical flight dynamics model for the UAS-S4, and then to design an efficient controller that can consider flight dynamics nonlinearities and uncertainties.
Basically, any UAV flight dynamics model depends on its geometrical data, aerodynamic performance estimation, onboard actuators and sensors model, controller model, signal processing, and environmental functioning conditions [12]. By conducting flight tests, the model parameters can be determined. The interpretation of UAV propulsion and actuation systems in terms of its mass and inertia are the essential requirements for obtaining an accurate UAV model. To that end, both linear and nonlinear representations of aircraft models are shown in [13]. When obtaining an accurate flight dynamics model is possible, a model-based controller will be highly successful in performing the intended tasks [14]. Thanks to the equipment available at our LARCASE (The Active Control, Avionics and Aeroservoelasticity Research Laboratory), including the UAS-S4, the Price-Païdoussis subsonic blow down wind tunnel, and the tow Research Aircraft Flight Simulators (RAFS) level-D for the [R]-too and Cessna Citation X [15], the accurate modeling of UAS-S4 flight dynamics is possible. Thus, the model-based control approach can be used to design the desired UAS-S4 controller.
From the classical control theory aspect, the PID approach is known as the generic and standard industrial control law [16]. Basically, this controller operates via the feedback mechanism with the objective of reducing the stabilisation and tracking error by modifying its signal. Although the PID technique can stabilise UAS-S4 flight dynamics without needing complex calculations for tuning the corresponding controller gains [3], performing the stabilisation tasks requires major control signal efforts. The need of such a controller that gives the desired output while considering a cost function led us at our LARCASE to investigate the LQR approach. The LQR methodology controls the state variables by using an optimal state-feedback law computed while minimising a fine-tuned energy-like cost function [17]. This method showed high efficiency when it was utilised for our UAS-S4 flight dynamics control [18]. However, state variables estimation decreases the LQR's effectiveness, which worsens with increasing distance from the equilibrium point [19]. With respect to the designed PID and LQR controllers for our UAS-S4, we need to design an efficient flight dynamics controller that can solve challenges including, parametric and nonparametric uncertainties while flight dynamics behaves nonlinearly.
A control strategy is expected to be designed, such that it could work very well despite uncertainties [20]. These issues led us to choose the Fuzzy Logic Control (FLC) method, which has proven its ability to handle nonlinearities in a broad range of operation [21]. Fuzzy Logic can provide a nonlinear model constructed by the soft association of several local linear models, while reduces computational complexity for the controller in real time operations. Then, a Fuzzy Logic Controller can be designed based on the provided Fuzzy Logic Model (FLM). Where, the classical feedback control technique aimed at flight dynamics stabilisation and tracking can be employed to control each local model. The designed Fuzzy Logic Controller (FLC) can be developed into the Adaptive FLC that can solve uncertainties due to unknown controller parameters (affected by actuator and sensor imperfections) [22].
The objective of this article is the adaptive fuzzy methodology reconfiguration aimed at UAVs flight dynamics control for a wide range of uncertainties that may be caused by unknown controller's parameters. The novelty of this study is to modify the adaptive laws in order to make them robust against external disturbances (e.g., wind turbulence, wind shear, wind gust) or model imperfections (dues to fuzzification and defuzzification process errors), which were not considered in [44]. Moreover, a general Theorem, followed by its stability proof is given to be useful for flight dynamics control of a variety of UAVs.
This paper is arranged in five sections. Following Section 1 on Introduction, the UAS-S4 flight dynamics model and its fuzzy logic representation are stated in Section 2. The fuzzy controller developed for the desired reference model is described, and then its robustness and adaptive aspects are developed in Section 3. Section 4 presents the simulation results and their numerical analysis. The research contributions and achievements are summarised in Section 5, and they are followed by an outline of proposed future works.

UAS-S4 flight dynamics modeling
The first essential step towards the design of an efficient controller for a flight dynamics system is the calculation of an appropriate model that accurately expresses the system dynamics behaviour. In this way, the UAS-S4 is considered as the case study which is equipped with elevators, ailerons and rudders that are controlling its loads through the pitch, roll and yaw axes. Figure 1 shows Hydra Technologies UAS-S4 Ehecatl, and Table 1 lists its specifications.
For an UAV that flies in a broad operating range, a vast number of internal and external factors could affect its flight dynamics behaviour. To obtain an accurate model for the design of an efficient controller, the flight dynamics data was mapped in a Mach-altitude flight envelope. A scheduled model was provided to represent the flight envelope containing nodes associated to the flight dynamics trim models. For each node, the flight dynamics model nonlinearities and parametric uncertainties were reduced.
The model in charge of each node was mathematically represented using differential equations with respect to the time-varying mass, and then linear models were designed around several equilibrium points. The controller was allocated to all nodes, in which a time-varying mass existed. Figure 2 depicts step-by-step procedure followed to reach the research objective.
Firstly, the flight envelope schedules the UAS-S4 flight dynamics model for nine altitudes and four speeds. Then, the nonlinear model considering time-varying mass is linearised around several equilibrium points. Linearised models apply to the defined membership functions in order to obtain the UAS-S4 Fuzzy Logic Model (FLM). Next, the Fuzzy Logic Controller (FLC) computes the control signal based on the provided UAS-S4 FLM. Finally, the desired and controlled flight dynamics values are compared, and the error is used by the adaptation block for adjusting FLC gains. The UAS-S4 flight dynamics model and its controller design are explained in details in the following sections.

UAS-S4 linear local models
By considering the aircraft differential equations of motion [23], UAS-S4 state variables can be linearly modeled about its several equilibrium points. The UAS control problem can be solved for both its lateral and longitudinal motions. In this paper, the state variables of the UAS-S4 both lateral and longitudinal motions are controlled.
The state variables of the longitudinal flight dynamics are represented by X lon = u w q θ T , with the axial velocity u, vertical velocity w, pitch rate q, and pitch angle θ while the control input is δ lon = δ e δ T T . Even though the control vector is formed by the elevator deflection δ e and thrust δ T , the former plays the key role for the pitch control. The lateral flight dynamics state variables represented by X lat = v p η ϕ T , with the side velocity v, roll rate p, yaw rate η, and roll angle ϕ. Based on the aileron and ruder deflections, δ lat = δ a δ r T is in charge of lateral controls input.
Knowing that the linearised state-space representation of the model around an equilibrium point is [24]:Ẋ where the longitudinal state-space matrices are: and the lateral state-space matrices are: where G u , G w , H u , H w , M u , M w , M q are the UAS-S4 longitudinal state matric dimensional stability derivatives, and G δ , H δ , M δ are its longitudinal control matric dimensional stability derivatives. In addition, Y v , Y p , Y r , L v , L p , L r , N v , N p , N r are the UAS-S4 lateral state matric dimensional stability derivatives, and Y δ , L δ , N δ are its lateral control matric dimensional stability derivatives. In order to obtain the UAS-S4 state-space matrices' elements, it is needed to compute the dimensional aerodynamic coefficients and their derivatives. While several research projects on aircraft modeling have been conducted at the LARCASE [25][26][27], the most comprehensive study on the UAS-S4 modeling was detailed in [3]. The UAS-S4 model was obtained at the LARCASE using four sub-models representatives of aerodynamics, actuator, propulsion, and mass and inertia.
The first sub-model (aerodynamics) was set up according to the Fderivatives in-house code; this code was based on new aerodynamics methodologies added to DATCOM [28]. The second sub-model (propulsion) was built using a two-stroke engine integration model relying on the operation of an internal combustion engine (Otto Cycle), and on the propeller analysis (Blade Element Theory) [29,30]. Raymer and DATCOM techniques were used to implement the third sub-model (mass and inertia) [31]. Finally, the fourth sub-model (a control surface actuation system) was designed using the servomotors' characteristics, and the final UAS-S4 model was obtained by the sub-models integration [3].
In this way, the UAS-S4 flight dynamics related to both longitudinal and lateral motions was represented using several linear state-space models. Each state-space model expresses the linearised state variables about a specific equilibrium point corresponding to a certain range of altitudes and speeds. However, by increasing the operational range about an equilibrium point, the modeling error due to the linearisation also increases. In order to enhance the models' accuracy, several equilibrium points can be considered, and consequently, several local linear models can be better fitted into the actual flight dynamics model. Therefore, a fuzzy logic approach is utilised for the UAS-S4 modeling.

UAS-S4 Fuzzy Logic Model
Basically, an aircraft nonlinear Flight Dynamics Model (FDM) can be represented through its affine system formulation [32] by the equationẊ = F(X) + G(X)δ, where the control input vector δ is adjusting the state vector variables X using F:R n → R n and G:R n → R n functions, that are unknown. A simple nonlinear FDM was found to be more efficient than a complex nonlinear system for the design of a modelbased controller, which was our main objective. The higher efficiency of the simple nonlinear FDM was due to its reduced computational complexity, while providing fast control signal calculations in realtime operations [33]. Therefore, the fuzzy logic approach was chosen, as it provided this procedure for approximating affine nonlinear systems [34].
Fuzzy logic offers the type of models that can be used to support the impression of partial truths, where the truth concept may range between completely true and entirely false [35]. Fuzzy logic provides a tool for assembling several local linear models, relying on membership functions, with the objective of approximating a nonlinear model. The Takagi-Sugeno Fuzzy Logic modeling method is known as a practical and user-friendly technique for modeling real physical systems [36] and was chosen in this study.
The Takagi-Sugeno Fuzzy Logic Model (T-S FLM) consists of a set of models that have been locally linearised about their equilibrium points. Based on the expert-defined fuzzy rules in Equation (4), the association of local models can approximate the actual nonlinear continuous-time flight dynamics model. According to the T-S procedure for generating rules, the i th rule of the fuzzy model is defined as the following [36].
where the state variables vector X(t) ∈ R n is controlled by the input δ(t) ∈ R for a j number of defined rules. The state-space matrices for the UAS-S4 model should then be converted into their controllable Canonical form, as shown in Equation. (5).
The fuzzy logic model representation based on the first-order models relying on j rules is [36]: activates the i th rule by considering the collected grades i h (X(t)) that are associated with the membership of X(t) in i h . An appropriate algorithm is further designed for flight dynamics control by utilising the fuzzy model presented in this section.

Flight dynamics control
Having effective control over a UAV's flight dynamics would allow efficient flights in terms of their costs and safety. This section first defines the desired reference model for the chosen model-based control strategy by utilising the LQR controller that performed very well under ideal conditions for the UAS-S4 [18]. The controlled model specifications (using the LQR methodology) about the equilibrium point are considered as the reference specifications for the controlled model using the Robust Adaptive Fuzzy Logic Control (RAFLC) methodology.

Reference model
Basically, a reference model should define the desirable response of the controlled system to the input command. The design of the reference model is one of the basic aspects of an adaptive control strategy. In addition to offering performance index values (whether for frequency-domain or time-domain characteristics), the reference model should also satisfy its constraints, such as its relative degree and order.
According to the above-mentioned concerns regarding the reference model definition, the desired reference model specifications are determined using the Linear Quadratic Regulator (LQR) procedure applied around the equilibrium point. An LQR controls the state variables using an optimal statefeedback law, that is computed while minimiSing a fine-tuned cost function [37]. The design of an LQR is based on the linear state-space model representation, as given in Equation (1). The LQR algorithm calculates the control signal while minimising the following energy-based cost function: where Q and R are the weight matrices (positive-semi-definite or positive-definite), that clarify the importance of cost function related to the state vector and the control vector, respectively. Consequently, the LQR control law is: Following the state feedback gain K and state variables vector X values, the LQR procedure stabilises the flight dynamics of the closed-loop model with respect to the state-space variables using Equation (9):Ẋ The feedback gain K is computed by: where matrix P is obtained by solving the following algebraic Riccati equation: Next, the control block of the UAS-S4 model needs to be designed by taking into account the controlled reference model. The Fuzzy Logic Control (FLC) approach is employed in order to solve the challenge of model nonlinearities, as well as to outperform linear controllers.

Fuzzy Logic Controller (FLC)
Over the past two decades, the use of fuzzy logic for systems control has been developed for a variety of industrial applications. In most comparison studies, the FLC outperforms classical controllers in solving the challenges of nonlinearities, mathematical complexities, and in uncertainties removal [38][39][40]. In fact, FLC allowed obtaining accurate inputs from approximate inputs through an intuitive converting process [39]. Basically, the FLC implementation is done in three fundamental steps: fuzzification, fuzzy interface, and defuzzification [41]. The fuzzification block converts crisp data into fuzzy data using proper membership functions. The prepared data is then fed to the Fuzzy Inference System (FIS), which processes the fuzzy data and performs the control tasks according to the IF-THEN rules. Finally, the computed fuzzy control signal is converted into its real signal values through the defuzzification block. The FLC signal is applied to the UAS-S4 flight dynamics, which is modeled using FLM. This control signal is computed as function of the error (the difference between the measured and the desired flight dynamics values). Figure 3 shows the concept of FLC utilised in the closed-loop architecture in charge of the UAS-S4 flight dynamics.
Regarding the Takagi-Sugeno Fuzzy Logic Model (T-S FLM) described in subsection 2.2, the UAS-S4 FLM should be controlled by use of a compatible FLC. Hence, the T-S Fuzzy Logic Controller (T-S FLC) is needed to be designed.

T-S Fuzzy Logic Controller
Takagi-Sugeno Fuzzy Logic Control (T-S FLC) method can manage nonlinearities and time-varying parameters while avoiding control algorithm complexity [42]. T-S FLC proved its efficiency on nonlinear systems in terms of state variables regulation and reference model tracking [43]. The T-S FLC is structured based on the classical feedback compensator theory [44], that is established for each local model. The rule-based control law can be mathematically represented by Equation (12) [36].
where the state variables are controlled by δ(t), and rely on the reference signal r(t) and adjustable gains denoted by K i1×n and Z i1×1 .
The T-S FLC output is given by Equation (13): , which activates the i th rule of the fuzzy controller based on the collected grades´ i h (X(t)) associated with the membership of X(t) in´ i h . With the aim of obtaining a zerovalue tracking errorφ i (t) = φ i (t)|Z −1 i |, should be determined in order to formulate Lyapunov function for the system to become asymptotically stable; when the gain of the reference signal value was 1, the controller could fires the proper rule with the same collected grade in the fuzzy model.
The T-S control law can be reproduced, as shown in Equation (14): Even though the FLC handles nonlinearities, it is affected by the adverse effects of parameters uncertainties. Since the concept of adjustable gains is supposed to overcome these problems, the modified Adaptive Fuzzy Logic Controller (AFLC) is employed, as it relies on adjustable gains. Additionally, we consider the other two main sources of uncertainties, namely external disturbance, and model imperfection. The robust adaptive configuration of the T-S FLC is our solution.

Adaptive T-S Fuzzy Logic Controller
In Control Systems Engineering, uncertainty is an issue that may appear due to a variety of reasons, and it can adversely affect controller performance. Uncertainty presence may reduce controller robustness, and may lead to systems dynamics instabilities. Therefore, an algorithm should control the nonlinear flight dynamics model while remaining efficient in the presence of uncertainties. To fulfill this objective, a reference model is defined by applying the T-S FLC. Then, the errors are measured by subtracting the UAS-S4 state variables values from the reference model's state variables values [22]. Finally, using a Lyapunov function (which relies on the measured error) for guaranteeing the flight dynamics asymptotic stability, the adaptation laws for gain tuning are calculated. Equation (15) defines the reference model containing the desired state variables, as follows: If k i1×n and z i1×1 are assumed to be the gains of the desired compensator corresponding to each fuzzy rule, which can regulate the closed-loop response, such that the UAS-S4 state variables exactly follow the reference model state variables, then A r = A i − B i k i and B r = B i z i need to be satisfied. By rearranging these last formulations as A i = A r + B i k i and B r = B i z, and then, by substituting them into Equation (6), the aircraft's T-S fuzzy logic representation using the reference model is given in Equation (16).
The error is defined as E(t) = X(t) − X r (t). This error is further obtained by subtracting Equation (16) from Equation (15). Therefore, the next Equation (17) represents this error. (17) By replying Equation (14) into Equation (17), the error can be obtained using next Equation (18): In order to converge the error to zero, the following Lyapunov function for the stabilisation analysis and reference signal tracking was employed: where P = P T > 0 is positive-definite matrices and A r stability assumption is guaranteed by use of In addition, γ 1 and γ 2 are positive constant parameters that are used to finely tune the gains. The gains of the fuzzy controller in Equation (13) can be adjusted via the following adaptation laws (based on FLC gains and their derivatives), obtained by solving Equation (19) [22].
The stability theorem of adaptive gains is given in [22]. Uncertainties dues to the unknown controller's parameters could affect the adaptive gain Z i , and may approach it to zero value. Since adaptive gain Z i appears in the denominator of Equation (20), in order to guarantee the model stability, the adaptation laws should be modified in cases when the denominator approaches to zero. Therefore, the modified tuning law for an adaptive fuzzy controller is represented in Equation (21) [45]: With respect to the stability proof given in [22], by assuming a uniformly bounded reference input while analysing the stable reference model, the control law (K i , Z i ,φ i ) and tracking error E were guaranteed bounded for all j fuzzy logic rules. The convergence of the reference model was ensured, such that lim t→∞ E j (t) = 0, as the tracking error E converges to zero. This assumption is clarified in the mathematical proof of the general theorem formulated for the designed robust adaptive fuzzy logic laws after Equation (26). Although the presented Adaptive Fuzzy Logic Controller (AFLC) can control nonlinear flight dynamics in the presence of uncertainties, that are dues to unknown controller's parameters, it remains sensitive against other sources of uncertainties. Model imperfection and external disturbances are the two main causes of uncertainties that adversely affect controller performance, and both of them can be solved using robust control theory.

Robust Adaptive T-S Fuzzy Logic Controller
Robust control is a static approach that deals explicitly with uncertain parameters and disturbances. In other words, it is utilised to guarantee stability and to obtain robust performance while taking into account disturbances and modeling errors (both of which are assumed to be bounded) [46].
The uncertainties dues to external disturbances, such as wind shear, gust, and turbulence can be considered mathematically as bounded functions d (X, t), in which D n×1 = [0 0 . . . 0 1] T .
Additionally, even if an aircraft is modeled by a skilled expert, relying on perfect aircraft data, uncertainties in modeling may be dues to other causes: -Time-varying parameters, where a fixed controller can not always stabilise its state variables -Ignoring high-order dynamics for the nominal model simplification -Nonlinearities, where systems contain nonlinear dynamics, and models are represented approximately (such as our aircraft nonlinear dynamics, which is approximated using Fuzzy Logic modeling) Eventually, uncertainties associated with modeling errors of system dynamics can be added mathematically into the state-space matrices of a T-S fuzzy model, as shown in Equation (23): where the errors are bounded, such as Ai ∞ < ε and Bi ∞ < ε for i = 1, . . . , j.
Equation (23) can be written under the following form: and then by considering the uncertainties defined as f ( , d) = (X, δ) + Dd(X, t) the model would be: Following a procedure for computing adaptive gains similar to the ones used in the previous subsection, and based on a robust control strategy [47], the modified adaptation laws are: (13), which is tuned by the robust adaptive laws, shown in Equation (26). By assuming uniformly bounded reference input and stable reference model, signals corresponding to the control law (K i , Z i ,φ i ) and E j are guaranteed to be bounded for all fuzzy rules. The reference-model tracking convergence is ensured, so that lim t→∞ E j (t) = 0, as the tracking error E converges to zero.

Theorem: Considering a UAV flight dynamics model represented by Equation (25); its desired reference flight dynamics model is given in Equation (15) (which respects A T r i P + PA r i < −Q i Inequality), in which the control function is represented by Equation
Proof. The stability analysis is done based on the designed adaptive laws, as seen in Equations (20) and (21), by use of the Lyapunov function, described in Equation (19). The conditions |Z i | > Z i0 or Z i = Z i0 and w i sign(Z i ) < 0 were considered, andV = −E T j QE j was obtained. In the condition expressed by Z i = Z i0 , when the Lyapunov function is represented with Equation (19), its time derivative is given by: As which means thatV < 0. Hence, for both conditions shown in Equation (21): Therefore: while relying on the Barbalat's lemma, lim t→∞ E j (t) = 0. Then, by considering that the adaptive laws contain a robust term represented by Equation (26) in the conditions expressed by |Z i | > Z i0 or Z i = Z i0 and w i sign(Z i ) < 0, the Lyapunov function is expressed by Equation (19), therefore, its time derivative becomes: We can determine, so that 6λ max (P)ε < λ min (Q). Therefore: If we consider that:V where: and Therefore, V ≤ β α causes exponentially convergence of the Lyapunov function, and feasible stable region in order to guarantee the flight dynamics stability is: In other words, adaptive gains guarantee the flight dynamics stability, as long as the amount of bounded uncertainties respect the threshold (the border of Equation (36) as the feasible stable region). Additionally, the leakage factor ϑ in the robust term should be carefully tuned based on a trade-off; a larger value for ϑ improves the controller robustness, while a smaller value provides more accurate reference model state variables tracking [48]. The mechanism of our designed T-S-based Robust Adaptive Fuzzy Logic Controller (RAFLC) block diagram is depicted in Fig. 4.

Results
The effectiveness of the designed RAFL controller is evaluated in terms of UAS-S4 state variables stabilisation and reference model state variables tracking. The efficiency of adaptation laws can be assessed by the convergence of the reference model's state variables tracking error. The designed RAFL controller was utilised for all trim conditions and showed very good servo-accuracy performance. The numerical results corresponding to several trim conditions were utilised to demonstrate the controller's functioning in details. By assuming that the aircraft is in the trim condition at the speed = 45 m/s, altitude = 6, 100 m, and its mass is varying in time between 53 kg and 55 kg, the trim for the local models of the UAS-S4 are obtained through the following two Fuzzy Logic rules: Knowing that, the UAS-S4 Fuzzy model was designed using 216 local FDMs. If a reference model was not employed, we had to calculate the membership functions using state variables. But, since we first designed the desired reference model, and the UAS-S4 FDM was supposed to track the reference model, we utilised the tracking error for calculating membership functions (which were used for all trim conditions). Hence, we defined the membership functions such that: The corresponding longitudinal and lateral state-space matrices are: For the longitudinal flight dynamics study, Fig. 5(a) and 5(c) show that the RAFL controller can stabilise the UAS-S4 pitch angle and the pitch rate, respectively. Figure 5(b) shows the elevator deflection during the pitch angle stabilisation. For the lateral flight dynamics study, Fig. 5(d) and 5(f) illustrate the UAS-S4 roll angle and yaw rate regulation, respectively. Figure 5(e) shows the aileron deflection during the roll angle stabilisation.
State variables stabilisation using the RAFL control mechanism was performed very well, while the UAS-S4 state variables track the reference model's state variables as well. Tracking the reference model state variables including pitch angle, pitch rate, roll angle and yaw rate are shown in Fig. 6 during stablisation. Figure 6(a) indicates the pitch angle and pitch rate convergence during stabilisation. Figure 6(b) depicts the convergence error, that is expressed as the difference between the controlled UAS-S4 pitch angle and its reference pitch angle. Figure 6(c) shows the roll angle and yaw rate convergence towards stabilisation. The convergence error obtained between the reference model and the controlled UAS-S4 model for the roll angle is shown in Fig. 6(d).
It should be noted that this work is a part of an ongoing research project to design a novel aerial collision avoidance system. This project will predict the future trajectory of an aircraft, and if a conflict will detected, then the system will provide a new safe trajectory for the aircraft to follow [49]. According to the Traffic Collision Avoidance System (TCAS) criteria [50], our UAS-S4 has to change its altitude using its elevator in order to avoid collisions. Hence, we analysed our RAFL controller performance in terms of reference pitch angle tracking. With this aim, soft time-varying bounded signals are considered as the controller reference inputs in order to to evaluate the controller's performance. For evaluating this model-based RAFL controller, the tracking error (the error obtained when the controlled UAS-S4 state variables track the reference model state variables) is considered as the performance index. In this approach, a valid bounded reference input excites both the UAS-S4 and its reference model state variables, and the tracking error should converge to zero. Assuming the reference state as θ r = 1.7 cos 0.5t , and initial condition given as X 0 = [0 0 0 0.2] T and X r 0 = [0 0 0 0.18] T , the RAFL controller performance is shown in Fig. 7, where its task is to control the UAS-S4 state variables, such that they track the reference model state variables accurately.
As seen in Fig. 7(a) and 7(b), the designed controller for UAS-S4 is able to perform its task in terms of reference model state variables tracking.
The adaptive gains effectiveness is well identified when uncertainties are considered. We therefore incorporated the uncertainties dues to the unknown controller's parameters (f = 0.02 cos t), and the controller performance was quantified in terms of pitch angle as state variable. Figure 8 shows the controller effectiveness in terms of the reference model state variables tracking by the controlled UAS-S4 state variables ( Fig. 8(a)), and tracking errors ( Fig. 8(b)). Figure 8(a) shows that, even though the RAFL controller efficiency was slightly degraded in terms of integrated tracking error (especially at the extremums), the RAFL controller could still handle the unknown controller's parameters uncertainties. Its performance is very good accordingly the reference model's tracking error, as shown in Fig. 8(b). In addition to the uncertainties related to the controller, model external disturbances and modeling errors are other sources of uncertainties that the controller is designed to remove their adverse effects. By assuming Fig. 9 shows the efficiency of the controller when all above-mentioned uncertainties are considered. As shown in Fig. 9, the controlled UAS-S4 state variables (pitch angle and pitch rate) followed the reference model state variables quite accurately. Although the controller performance slightly decreased compared to the case of controller's uncertainty (Fig. 8), especially at the extremums, the robust terms ϑK i E j and ϑZ i E j in the adaptation laws could handle all uncertainties dues to the controller parameters, such as model external disturbances and modeling errors.   The next challenge is the controller robustness threshold required to respect a feasible region for guarantying UAS-S4 stability. Figure 10 displays a visual representation of the uncertainties surpassing the feasible region. This figure shows three separate time varying regions. The first region(0 − 20 sec) shows the quality of the reference model state variables tracking (by controlled UAS-S4 state variables) when it is not affected by uncertainties. The second region (20 − 42 sec) depicts the controller performance when uncertainties (unknown controller's parameters, external disturbances and modeling errors) are considered in which f ( , d) = 0.05 cos 0.9t + 0.01 cos 7t, and indicates that the controller does manage the bounded uncertainties after a short initial adjustment period. The third region (42 − 50 sec) illustrates the state variables trajectories when the uncertainties surpass their boundaries, and therefore, the controller can not guarantee the stability and convergence of the UAS-S4 state variables, as the uncertainties moved the state variables outside the feasible region.
For comparison purposes, the RAFLC and AFLC approaches were chosen in the flight dynamics control algorithm. As seen on Fig. 10, when uncertainties were dues to the external disturbances and model imperfection, the RAFLC approach could track the reference state variable with less fluctuations than the AFLC approach. The average time delays for the RAFLC and AFLC approaches were 0.3 sec and 0.01 sec, respectively. In real-time operations, these average time delays are acceptable. Therefore, it can be concluded that the RAFLC outperformed the AFLC, and has provided a stabler flight in presence of uncertainties. In addition to the above approaches for controller performance evaluation, the controller effectiveness can be assessed based on the tracking error value. In this approach, the differences between the controlled UAS-S4 and its reference model state variables are measured; they are further considered for evaluation the RAFL controller performance. In details, by considering the sampling time (0.01 seconds), the Sum of Absolute Tracking Errors (SATE) while the controlled UAS-S4 state variables are tracking the reference model state variables (during 40 seconds) characterizes the performance index.
The SATEs for two types of reference models in three trim conditions are represented on Tables 2-4. Concretely, each individual reference model was stabilised using the LQR procedures by determining both proper weighting matrices (Q and R). The stabilised reference model by assuming Q = 1 and R = 1 is named moderate, and the stabilised reference model by assuming Q = 50 and R = 1 is named rigorous.
According to the recorded tracking error for both pitch angle and pitch rate, it can be inferred that there is a proportional relationship between the SATE value and the reference model rigorousness. When the reference model is tuned such that it strictly concerns fast time-domain response, tracking the reference model state variables becomes more difficult for RALF controlled UAS-S4, and consequently, the tracking accuracy decreases.
Another observation is that although the robust adaptive fuzzy controller can guide the UAS-S4 state variables to track very well the reference model state variables, its accuracy degrades when large uncertainties occur. This inference is obtained from Table 3 that lists the SATEs for different uncertainties f ( , d) in three flight conditions, and for two types of reference models.
For instance, in the second flight condition (Altitude = 3000 m, Speed = 39 m/s, Mass = 65 − 67 kg), by considering rigorous reference model (Q = 50 and R = 1), the pitch rate SATE is 27.63 rad/s for smaller uncertainties (0.05 sin 0.9t) and the pitch rate SATE is 28.52 rad/s for larger uncertainties (0.07 sin 0.9t).
Finally, according to the RAFLC architecture, adaptation weights are assigned to the adaptive laws in order to regulate the RAFL controller gain. The SATE for different adaptation weights values are listed in Table 4.  Table 4 shows that small values for the weights of adaptation laws result in lower SATE. For instance, in the first flight condition (Altitude = 6, 100 m, Speed = 45 m/s, Mass = 53 − 55 kg), by considering Moderate reference model (Q = 1 and R = 1), the pitch angle SATE is 26.67 rad if the adaptation weights are small (γ 1 = γ 2 = 0.0001 if the adaptation weights are large (γ 1 = γ 2 = 0.001), and pitch angle SATE is 25.96 rad if the adaptation weights are small (γ 1 = γ 2 = 0.0001). However, these weights must be carefully tuned, as if they would be too-small, they could cause the UAS-S4 state variables to drift outside the feasible region.

Conclusion
A Robust Adaptive Fuzzy Logic (RAFL) flight dynamics controller was designed for Hydra Technologies UAS-S4 Ehecatl. The UAS-S4 was mathematically modeled using the Takagi-Sugeno fuzzy logic method to design its corresponding controller. Adaptive gains were assigned to the fuzzy controller to ensure that it could perform very well despite uncertainties. For the adaptive control mechanism, a reference model was defined, which was stabilised through the LQR method. The numerical results show that there is an inverse relationship between the reference model rigorousness and the RALF controller performance. When the controlled UAS-S4 state variables track the reference model state variables, the tracking errors increase if the reference model strictly determines ideal time-domain response properties, such as rise-time or settling-time. The tuneable controller gains were adjusted utilising Lyapunov-based adaptation laws, that became robust against uncertainties. The controller's performance was evaluated in terms of reference model state variables tracking for a variety of uncertainties. In-line with the requirements for cruise conditions, the RAFL controller was able to stabilise the UAS-S4 lateral and longitudinal flight dynamics, as well as the reference model state variables; the tracking error converged to zero. In addition, Sum of Absolute Tracking Errors (SATE) results proved that the RAFL controller could handle uncertainties that were dues to the controller's unknown parameters, modeling errors, and external disturbances. Small values for the weights of adaptation laws resulted in lower SATE. Based on numerical studies, for higher values of uncertainties, the controller performance degraded slightly; however, the controller could maintain the UAS-S4 state variables in the asymptotically stable region. The robust control algorithms showed that if the uncertainties surpass their boundaries, the controller cannot guarantee the reference model state variables' tracking. For further studies, we recommend the RALF controller development by utilising a fuzzy logic reference model to improve the RAFLC efficiency in order to reduce reference state variables tracking error.