Adaptive and Resilient Flight Control System for a Small Unmanned Aerial System

The main purpose of this paper is to develop an onboard adaptive and robust flight control system that improves control, stability, and survivability of a small unmanned aerial system in off-nominal or out-of-envelope conditions. The aerodynamics of aircraft associatedwith hazardous and adverse onboard conditions is inherently nonlinear and unsteady.Thepresented flight control system improves functionalities required to adapt the flight control in the presence of aircraft model uncertainties. The fault tolerant inner loop is enhanced by an adaptive real-time artificial neural network parameter identification to monitor important changes in the aircraft’s dynamics due to nonlinear and unsteady aerodynamics. The real-time artificial neural network parameter identification is done using the sliding mode learning concept and a modified version of the self-adaptive Levenberg algorithm. Numerically estimated stability and control derivatives are obtained by delta-based methods. New nonlinear guidance logic, stable in Lyapunov sense, is developed to guide the aircraft. The designed flight control system has better performance compared to a commercial off-the-shelf autopilot system in guiding and controlling an unmanned air system during a trajectory following.


Introduction
The effectiveness of aircraft flight control systems in offnominal conditions is heavily dependent upon the quality and accuracy of physics-based models and numerical simulations.The accuracy of these models depends on the mathematical formulation that describes the true physics, how uncertainty affects the outputs, and whether the model mismatch can be identified and estimated.In classical flight dynamics, the measured aerodynamic forces and moments are represented by differentiable functions and expanded in Taylor series.Although it is effective in benign portions of the flight envelope, this mathematical structure is incapable of modeling nonlinear and unsteady aerodynamics associated with hazardous and adverse onboard conditions.Adverse onboard conditions include vehicle impairment; system faults, failures, and errors and vehicle damage.External hazards and disturbances include wind shear and poor visibility; wake vortices; thunderstorms; snow and icing conditions.Aircraft robust control systems are designed to deal with uncertainty in dynamic models due to modeling errors, noise, and disturbances.
The motivation of this work is to develop a robust flight control system to improve control, stability, and survivability of a small unmanned aerial system (UAS) in hazardous and abnormal flight conditions.The presented flight control system consists of guidance, navigation, and control modules with adaptive control technologies and incorporated realtime learning-based system identification using artificial neural networks (ANNs) to update the physics-based model of UAS.An extended Kalman filter (EKF) is used to improve the measurements and to estimate inaccessible variables including the inertial wind components.The research is aimed at advancing flight control systems by the integration of functionalities required to update the physics-based model and adapt the control-law in presence of model uncertainties due to unsteady and nonlinear aerodynamics.The overall configuration comprises a set of stabilizing robust H-infinity controllers in the inner loop for adjacent trim points, to be scheduled when required.New nonlinear guidance logic, stable in Lyapunov sense, is developed to guide the aircraft.The new guidance law can achieve a stable and steady-state error-free guidance through the use of integral effect and by International Journal of Aerospace Engineering lifting constraints related to maximum distances and relative position with respect to the trajectory, expanding them to the entire state space.
Significant research has been carried out in areas of nonlinear guidance, navigation, adaptive control, and estimation.A broad range of research can be found on trajectory tracking, path following, and robust nonlinear controllers [1][2][3][4][5][6][7][8][9].In [1], authors presented the design of guidance and control algorithms for autonomous vehicles through a simultaneous process that achieved a zero steady-state error about a trim point and, at the same time, guaranteed stability by avoiding possible cross-coupling between loops.In [2], a lateral track control-law for an autonomous aerial system that handles a larger range of wind disturbance was presented.A different approach is presented in [3] where the tracking control problem is formulated as a constrained nonlinear optimization problem.Unlike receding horizon methods, the minimization must be performed at the current instant.Reference [4] introduced nonlinear guidance logic for curved trajectory tracking reducing to a proportionalderivative control when applied to straight lines.In [5,6], waypoint guidance was improved by including the horizontal wind estimation, allowing the aircraft to smoothly converge to a new course after switching to the next trajectory segment.A different approach for path following is presented in [7] where vector fields are used to represent desired ground track and to direct the aircraft to the desired track.More recently, in [8], a Lyapunov-based adaptive back stepping approach is used to design a flight-path controller for a nonlinear F-16 model.A nonlinear lateral guidance law, introduced in [4], is extended and modified by the authors to the longitudinal plane in [9] and tested in simulation.
Estimation of unmeasured states from noisy observations has become an essential part of flight control systems.The Kalman filter, either with an adaptive matrix gain or a fixed one, appears to be the most widely used observer (see [10][11][12][13]).Different versions of the Kalman filter ranging from linear to nonlinear, with static or time-varying Kalman gains, have been used.More refined filters such as Particle Filtering [14] and Sigma-Point [15] are designed to achieve better estimations.Another interesting approach is detailed in [16], where a nonlinear filter is designed using the statedependent Riccati equation (SDRE) method.This technique is applicable whenever the UAS is describable in a timevarying linear format.Reference [17] estimates the external wind component in the horizontal plane to correct the velocity transformations between the respective coordinate systems.Reference [18] presents application of Kalman filters in estimation of wind components.
Different approaches using ANN for estimation of aerodynamic coefficients have been reported.In references [19][20][21][22][23][24][25], ANNs were propagated in a feedforward manner and their weights and biases were numerically searched by back propagating the estimation quadratic error.References [22,23] extract the stability and control derivatives of an unstable aircraft under closed loop using a technique called Delta method.In [26][27][28][29], the fuzzy logic method was used as an alternative to ANN.The fuzzy logic modeling is used to capture nonlinear unsteadiness aerodynamic.In [26][27][28], fuzzy logic was used as an alternative to ANN to capture nonlinearities and unsteadiness in aerodynamics.In [29], using postflight fuzzy logic analysis, instability, high nonlinearity, and time-dependency were found in aircraft dynamics in crosswind.
The paper is structured as follows.Section 2 presents the nonlinear modeling of the aircraft and its linear equivalent at equilibrium points.Section 3 describes the inner loop and the H-infinity controller design, techniques for gain scheduling, the outer loop and its attitude guidance logics, and assessment of guidance logic inherent stability.Section 4 describes the design of the extended Kalman filter and its main properties, and Section 5 describes the ANN and its role in aerodynamic coefficient estimation.The paper is finalized with results from comparison of the designed flight control system (FCS) with flight test data obtained from a commercial off-the-shelf (COTS) autopilot.

Aircraft Modeling
Following [30], a 33% scale Yak-54, shown in Figure 1(a), is modeled using Newton-Euler equations for 6-DOF rigid-body motion, as detailed in Appendix A. Its dynamics, defined in the coordinate systems shown in Figure 1(b), is a function of the states x  () = [  , , , , , , , , ,   ,   ,   ,   ,   ,   ,   ], that is, airflow angles , , airspeed   , attitude angles , , , body angular rates , , , and inertial position   ,   ,   .Throttle, elevator, aileron, and rudder servos are modeled as a first-order system with time constants   ,   ,   ,   and states   ,   ,   ,   , respectively.Wind components   ,   ,   are included as uncontrollable, but measurable, disturbances to the model and will be estimated by an extended Kalman filter.
Controllable inputs to the system are propulsive and aerodynamic forces and moments, and gravity is understood as an uncontrollable input.By assuming perfect alignment with -axis in body frame B, propulsion or thrust   (x, ) =    (  , ) is modeled parametrically as a polynomial function on   , as shown in Appendix B; consequently, no moments are induced.The aerodynamic forces [F  (x, )]  and moments [M  (x, )]  , defined in body frame B, are not directly measurable, and they need to be estimated from accessible data.It is customary to express them in a normalized way as a function of coefficients   ,   ,   and   ,   ,   , as follows: where  and  are the wing span and wing geometric mean chord,  is the wing reference area, and  = 0.5  is the dynamic pressure, with air density .
Although limited, a widely accepted parametric modeling is the component build-up approach, a time quasisteady and linear (in perturbed states Δx() = x() − x trim around the trim condition x trim ) model.Given its linearity and timeinvariant structure, the model is valid in close proximity to the selected trim point.The present work chooses this method, based on [31], to assemble and compute these aerodynamic coefficients, as detailed in Appendix C. All constant coefficients, called stability and control derivatives, are obtained offline for selected trim conditions x trim .A useful tool, used to obtain stability and control derivatives in this work, is the engineering level software Advanced Aircraft Analysis (AAA) [32], developed by Design, Analysis gives the linear representation of the system at equilibrium.After cancellation of constant terms and defining the partial derivatives evaluated at each equilibrium point, the following linear time-invariant model, denominated G  , is obtained for control design purposes: From AAA, for a straight and level flight at a constant speed of 70 (knots) with   = 1.0886 (slug ⋅ ft 2 ),   = 2.1068(slug ⋅ ft 2 ),   = 3.0382 (slug ⋅ ft 2 ),   = 0.05 (slug ⋅ ft 2 ),  = 28(lb) and  = 32.17(ft/sec 2 ), [33] calculates the stability and control derivatives of a 33% scale Yak54; shown in Table 1.
The work done in [33] employed the vortex lattice model (VLM) as a second method for estimation of some of the stability and control derivatives.For uncertainty analysis, results from the AAA and VLM estimations were compared with results from flight tests system identification.Table 2 shows stability and control derivatives, the level of uncertainty (maximum and minimum), and the resultant center values and half range of each uncertainty derived from comparison.In order to switch trim conditions using gain scheduling, the same set of information and analysis had to be generated at those different trim points.In this research, and for the sake of abstraction, only information for one trim point, at 70 (knots), is presented.
At the chosen trim condition, the linear model is stable in the roll, dutch roll, phugoid, and short period modes and is unstable in the spiral mode.Figure 2 shows the linearized system poles, zeros and modes.This is done in order to harmonize otherwise conflicting performance objectives, as low frequency reference tracking and disturbance rejection, and high frequency noise cancellation, by appropriately shaping particular closed loop sensitivity functions through these frequency-dependent weighting matrices.Plant P  is then expressed as

Inner and Outer Loops Design
where superscript  continues to be an index among the set of augmented plants corresponding to each linearized plant G  .One of the main requirements of the chosen gain scheduling procedure is to have a homogeneous augmented plant set in terms of same structure, states, inputs, and outputs.This is achieved by having a homogeneous linearized plant set, in terms of the similar nature of zeros and poles, same weighting matrices, and same controller calculation method.The state vector x  is constructed by adding the states of the linearized plant and the states of the weighting matrices.In particular, the inertial positions   ,   ,   are left out of the augmented state vector as they will be used in the guidance, and also yawing angle  is not included for being superfluous.
If the conditions detailed in Appendix D are met, then the suboptimal  ∞ control problem [34,35] provides a controller K  that internally stabilizes the closed-loop system such that for a given  > 0, where T y 1 u 1 is the closed-loop transfer function from exogenous inputs u 1 (including references, disturbances, and noises) to error responses y 1 (including weighted error, control, and output signals).In the present work, T y 1 u 1 is constructed as follows: as a combination of desired weighted closed loop objectives, S(s), R(s), and T(s), that is, sensitivity, output sensitivity, and complementary sensitivity, respectively.Weighting allows their joint minimization.For an effective low frequency reference tracking and disturbance rejection, the weighting matrix W 1 is built to have high singular values at the required range.For high frequency noise cancelation, W 3 is designed to have high singular values in those higher frequencies.The weighting matrix W 2 is designed as a constant matrix to uniformly penalize the control effort from getting unfeasible values and saturate actuators.In order to characterize parameter uncertainty (see Table 2), a linear fractional transformation (LFT) is employed.Uncertainties are extracted and packed into Δ  , as shown in Figure 4(a), leaving a deterministic plant P , as opposed to the previous uncertain plant P  .This LFT interconnection can be defined as or as where F  corresponds to the lower LFT and F  to the upper LFT.
Assuming that ‖Δ‖ ∞ ≤ 1, then by the Small Gain Theorem, the interconnected system shown in Figure 4(a) is internally stable if and only if For each derivative given in Table 2, an uncertainty range is built considering the highest and lowest values.These extreme values are used to calculate the central value and half range value.With this information, a normalized uncertainty range is constructed and pulled out of the plant.The 70 knots trim condition is labeled as  = 1, where, utilizing a set of weighting matrices as described before, a robust controller K 1 , with ‖T y 1 u 1 ()‖ ∞ =  1 = 0.543, is achieved.For this closed-loop configuration, after extracting the uncertainties blocks, the infinity norms ‖F  ( P1 , K 1 )‖ ∞ , for each uncertain derivative, are shown in Table 3.The last row shows the worst case, the infinity norm for all uncertainties together; that is, , the Small Gain Theorem ensures that the controller robustness keeps stability facing the parameter uncertainty.
The flight control system's inner loop is equipped with a moderate fault tolerant capability.It is based on the ability to detect and identify dynamic changes due to faults that are characterized by changes in the aerodynamic forces and moment's causal functions.The implicitly assumed that static relation from aircraft states and state derivatives and controls to forces and moments is monitored through an online ANN.Changes in the network's parameters indicate unsteadiness in the aircraft dynamics, or an important trim condition transition.This information is utilized to adapt the current controller (and potentially the extended Kalman filter's model) for the new known dynamic condition, implementing a gain scheduling technique.The management of the ANN is addressed in Section 5.
Following the approach used in [36], the idea is to update the current controller K  based on an updated linear representation of the system G  , as described in (3).Its matrices (A   , B   , C   , D   ) are then used to compute a new robust controller through a new parameterization of P  , utilizing initially the same design parameters used in the computation of K  (i.e., same weighting matrices and same   ).Some simulation results are presented in Section 6.Before applying the new controller, assumptions in Appendix D should be assessed.

Outer Loop.
The overall task of the inner loop, through the robust controller, is to drive the aircraft to follow external commands generated by the outer loop, by minimizing the error between the commanded and the actual state.This minimization is performed over the error in airspeed, pitch angle, bank angle, and side slip angle; that is, The outer loop's task is to follow a trajectory path integrated by a set of waypoints { ⃗ a, ⃗ b, ⃗ c, . ..}, the straight segments subtended between them {ab, bc, cd, . ..}, and their assigned inertial speed { ab ,  bc ,  cd , . ..}.To this end, it has two main subsystems; one is to generate the attitude commands  cmd ,  cmd based on the current inertial position   ,   ,   and speed V  = ṗ  , V  = ṗ  , V  = ṗ  , and the relative location of the aircraft with respect to the path to follow; a second subsystem is to generate the airspeed command   cmd based on the path inertial speed corrected with the estimated wind.The sideslip command  cmd does not require any specific logic, and it is set to zero for the entire flight.
The logic in the generation of attitude commands  cmd ,  cmd , to keep the aircraft on path, is based on a nonlinear guidance logic developed in [4] for lateral guidance, which for small errors and straight lines approximates a proportional-derivative controller acting on the cross-track error.It generates the  cmd .To calculate the  cmd , a novel extension to the longitudinal plane from [9] is developed and employed.This extension also adds new features to the original guidance idea, ensuring its stability for any location and any attitude of the aircraft.Stability in the sense of Lyapunov is proven hereinafter for the extended logic.Figure 5 shows the quantities involved for each plane separately.
The guidance logic calculates the angles  Lat and  Lon between the lateral and longitudinal components of the inertial velocity vector ⃗ V Lat and ⃗ V Lon and the corresponding components vectors ⃗ L Lat and ⃗ L Lon from the position vector subtended from the current UAS position ⃗ p and an imaginary point ⃗ r.Point ⃗ r is located in the current segment between ⃗ a to ⃗ b; see Figure 5.

L o n g i t u d i n a l p l a n e
Late ral plan e Height North East From the geometry seen in Figure 5, it is evident that a small or zero angle  Lat or  Lon is equivalent to a small or zero lateral or longitudinal cross-track error (distance between points ⃗ p and ⃗ d) and the UAS flying in the segment direction, or that the UAS is off-track, but flying toward the trajectory.Once point ⃗ r reaches a predetermined distance to the end of the segment, the segment switches to the next waypoint, now between ⃗ b to ⃗ c, and the error angles are recalculated, based on the new position vectors.
These error angles  Lat and  Lon (being both negative as shown in Figure 5) are translated into attitude commands through the following nonlinear relations (see [9]): where gains   and   are convenient gains resembling PI controllers.The integral action has been added to force the steady state angle error to zero.The arctangent function acts as a smooth limiter, avoiding unrealistic growth of the commands.The adaptive gains are used to adequately neutralize changes in the aircraft's speed due to external disturbances, such as a wind gusts; see [4].For the particular geometry of the nonlinear logic, errors will be zero only when both vectors are aligned and the UAS is flying with zero cross-distance or when it is pointing toward the trajectory.
As the inner loop controller also works with the airspeed state error    , the predefined segment inertial speed is converted from inertial I to wind W coordinate systems and adapted for the current wind estimation.So, when the aircraft, driven by the controller, is reaching the commanded airspeed and is on the track, it will also be flying closer to the desired inertial speed.

Stability in the Sense of Lyapunov.
In order to test the stability of the guidance law (similar to [37]), a state space representation is developed in terms of the variables  Lat () and   (), the shortest distance from the UAS to the trajectory.Then, its stability in the sense of Lyapunov is assessed.From Figure 6(a), relations are defined among guidance variables, where the time dependence has been included for clarity.Rate of change of distance   () is described as follows: where positive distance is as shown and   Lat () is defined as   Lat () = tan −1 (  ()/  ).As a sign convention, angles measured counterclockwise are taken positive.
For the dynamics of  Lat () the centripetal acceleration  cent (), shown in Figure 6(a), is defined as By assuming the inner controller accomplishes a close tracking of  cmd , and assuming  cent =  tan , which is valid for coordinated turns, the following dynamics holds: where the speed is assumed to be constant; that is, | ⃗ V Lat ()| = 120 [ft/sec] ≈ 70 knots,   Lat = 0,   Lat = 1/2, and   = 300 [ft].The dynamics from (10) and ( 12) are used to form an autonomous nonlinear state space system and to evaluate its stability.Using a numerical and graphical solution, these equations are propagated in time for different initial conditions.Figure 6(b) shows phase portrait of the autonomous system, where all trajectories converge to the origin.It is clear that the lateral guidance logic is asymptotically stable in the sense of Lyapunov for any initial distance   and − >  Lat > .

Extended Kalman Filter
To improve the quality of measurements and to provide estimations of unmeasured quantities, an EKF is designed based on [38] (method briefly reviewed in Appendix E) for the following dynamic model ẋ () = f(x(), u()) composed of the aircraft modeling defined in Section 2. Biases and wind components are defined as new states International Journal of Aerospace Engineering ṗ  = Û cos φ cos ψ + V (− cos φ sin ψ + sin φ sin θ cos ψ) + Ŵ (sin φ sin ψ + cos φ sin θ cos ψ) − ŵ , ṗ  = Û cos θ sin ψ + V (cos φ cos ψ + sin φ sin θ sin ψ) + Ŵ (− sin φ cos ψ + cos φ sin θ sin ψ) − ŵ , where body velocities { Û, V, Ŵ} and their time rate of changes are defined as in Section 2 and Appendix A. The EKF model also utilizes the following output equation ŷ = ĥ(x(), û()), designed based on available sensors including inertial position (GPS), Euler angles (IMU), body angular rates (IMU), airflow angles vane and airspeed probe, 3D magnetic flux, body angular rate (3D gyros), translational accelerations (3D accelerometers), and elevator, aileron, and rudder deflection sensors   , where the subscript  refers to bias,  refers to acceleration, and Ĥ indicates magnetic flux.Subscripts {, , } are defined in body frame B and the subscript zero denotes the inertial reference magnetic flux for the flying area, assumed fixed.Variable  is defined as a function of estimated states, as follows: where q is the estimated dynamic pressure and { Ĉ , Ĉ , Ĉ } are the estimated body aerodynamic force coefficients.The calculated accelerations {  ,   ,   } plus the estimated biases {â  , â , â }, as shown in (15), are used as the estimated accelerations.They do not include gravity effects to keep consistency to accelerometer measurements.As in Section 2 and Appendix A, the same relations apply to the estimated stability and body aerodynamic coefficients and to the estimated thrust T. The body magnetic flux {  ,   ,   } is related to the inertial magnetic flux { 0 ,  0 ,  0 } as follows: where    corresponds to the direction cosine matrix for rotation from inertial reference I to body reference B. The inertial magnetic flux { 0 ,  0 ,  0 } is a known fixed data obtained for the area to be flown.

Artificial Neural Network
A feedforward ANN with a single hidden layer, containing a finite number of neuron cells with sigmoid-type activation 10 International Journal of Aerospace Engineering functions and a linear activation functions at the output cells, intrinsically materializes the universal approximation theorem.It approximates any multivariate continuous function on a compact domain subset of   to any degree of accuracy.Based on this theorem, proven originally in [39], for any given continuous function   (X) ∈  1 , with X = [ 1 ,  2 , . . .,   ]  ∈   , both normalized within the range [−1, 1] and for  > 0, there exist an integer  and a set of parameters (weights and biases)   ,   ∈ , and w  ∈   and   ∈  with  = 1 ⋅ ⋅ ⋅  and  a fixed value from the set {1 ⋅ ⋅ ⋅ } indicating a particular function within a set of related functions, as is the case of aircraft accelerations, such that is as an approximation of the function   (X); that is, |  (X) −   (X)| < , where (⋅) is a bounded monotonically increasing activation function.Figure 7 shows the general structure of the ANN and its interconnections.
To develop an iterative adaptive online algorithm, one learning epoch at each sample time is performed.This is done using a sliding window of data.This moving window has a constant length in time, but as new data is measured, the oldest data is discarded and the new is added as the most recent (concept similar to shift registering).Using the concept of sliding mode learning, the ANN is kept permanently in the training stage adapting its parameters to reflect changes in the dynamics of the aircraft.
For vertical acceleration estimation â =   + â (reducing the ANN to one single output), the sliding windows of input and target data, X[] ∈    × and Ŷ[] ∈    , are defined as follows, where   sets the window's length: The training is done by minimizing the accumulated quadratic error between â =   + â and the estimated ANN vertical accelerations   , that is, minimizing the cost function () =   () ⋅ () ∈ R, where where the line subscript is used to identify the ANN estimations, and where  ∈   is the parameter vector with  =  ×  +  ×  +  + .Using a Newton-type search method, the following iterative update is defined as where ∇([]) and ∇ 2 ([]) are the gradient and the Hessian of the cost function  with respect to the parameter vector, defined as follows: These quantities are approximated numerically at each iteration where the error vector () can be approximated by a first-order Taylor series  where the rows of J(), the Jacobian of (), include the gradients of each element of () with respect to the parameter vector  as follows:

∇𝜀 [𝑘, 𝜂]
] ] Then, the cost function (), evaluated at  + Δ, is expressed as From ( 26), the cost function's gradient ∇([]) and Hessian ∇ 2 ([]) are then obtained as functions of the error vector () and its Jacobian J().Then, ( 22) is rewritten as As a way to improve the numerical search, the Levenberg approach is chosen (see [40]), where a factor called Levenberg adaptive parameter  is introduced.This method permits a transition from a steepest descent to a quadratic method Under Levenberg's logic, this adaptive parameter is adjusted during each iteration based on the cost function evolution.In this paper, the logic is modified to reset the Levenberg's adaptive parameter, that is, [], when reaching predefined extreme values to avoid unbounded growing specially when the cost function has reached a minimum and consecutive iterations remain closer to it (a common occurrence in one-shot offline minimizations).This modification is required to keep the ANN under permanent training.The modification is as follows: where 0 <  min <  max are the minimum and maximum allowed values, and  dec > 0 and  inc > 0 are the decrement and increment correction factors.All these factors are empirically obtained after extensive simulations.

Simulation and Testing
This section is devoted to test previous designs in simulation, by employing stored flight test data, and also by comparing the designed FCS performance in contrast with a COTS autopilot under similar conditions, for the same aircraft.The manufacture of COTS system cannot be revealed due to contractual obligations.interval  = 1/40 seconds.For the logic defined in (29),  0 = 0.001,  max = 1,  min = 0.00001,  dec = 3, and  inc = 2.
Two simulations are run for a 33% Yak-54 UAS, with and without measurement noise.Figures 8 and 9 show the convergence of the parameters, the cost function minimization, the Levenberg adaptive parameter, and the measured and estimated vertical acceleration, considering noise.Figures 10  and 11 show the same information for the case without noise.
By using the Delta method, which is a numerical technique to approximate partial derivatives, stability and control derivatives can be extracted.
The standard application of this technique, in previous cited articles, is generally offline postprocessing analysis.The idea presented here is to allocate a specific logic and to compute these approximate partial derivatives online.Two identical structures of the ANN are kept in parallel.They are fed incoming measurements, similar to the ANN under training.Also, these two structures are updated with the current weight and biases from the ANN.One of these structure is fed with a perturbed input (i.e., measured angle of attack plus a small added perturbation), while the second structure is kept fed by unperturbed inputs.By taking the quotient between the differences of the two structures outputs, with respect to the magnitude of the added perturbation, an approximation of the partial derivative is obtained in real time.
For this case, the partial derivative of the vertical acceleration with respect to some input of the ANN is obtained.These quantities can then be used to calculate more specific stability and control derivatives by converting from body to stability coordinates.This allows the capability of detecting dynamic changes due to internal or external changing conditions, or due to failures, by monitoring the time tendency of these values.
By comparing Figures 8 and 9, with Figures 10 and 11, the effect of measurement noise is clear.Cost function values are considerably higher.Also, the parameter vector does not settle permanently and it adjusts continuously due to the inherent variability condition of the Levenberg parameter.
As shown in Figure 11(b), a fairly good prediction is achieved.Further precaution needs to be observed to avoid deep changes, as seen between seconds 54 and 55 when a steep readjustment occurred.Using a desktop, each iteration took less than 1.2 seconds; this means that a dedicated microprocessor must be used for real-time estimations.

Adaptive Artificial Neural Network Testing.
To verify the performance of ANN's adaptive capability in the modeling of unsteady aerodynamic forces, actual 33% scale Yak-54 UAS flight test data from the 2009 flight test at Pegasus Airfield in Antarctica is used.The data was collected with a sampling frequency of 10 (Hz).For comparison and validation purposes, the same ANN for -axis acceleration is trained and tested with and without adaptiveness.This ANN is constructed from twenty cells ( = 20) in the hidden layer and fed with same inputs as defined earlier for online ANN. Figure 12 shows the flight test data and the estimations with and without adaptiveness.
The flight had a well-defined pattern.From a prolonged circular autonomous period of flight, the aircraft is switched to remote control for landing around second 1145.During autonomous flight, the nonadaptive ANN is trained.It is then tested in both the remaining autonomous flight segment and during the remote controlled period.The adaptive ANN is tested in the same interval as the nonadaptive ANN.
Figure 12 shows a close estimation of both types of ANN before mode switching.After changing control sources, a significant dynamic behavior experienced by the aircraft left nonadaptive ANN outdated.control derivatives.The gain scheduling adapts controllers to guarantee the aircraft stability and performance in the event of an adverse condition (e.g., servo failure or damage).Extreme changes could be a result of system failure or a result of damage to the aircraft.An adaptive flight control system must have the potential to adjust for failure or damage to maintain control in flight and meet the required handling qualities that allow for safe recovery of the airplane.As a condition for successful gain scheduling, the FCS is expected to achieve a similar level of performance and required uncertainty management before and after detection of dynamic changes.

Gain Scheduling Simulation
To replicate a major change in the lateral-directional dynamics of UAS due to a failure or unsteady aerodynamics, at 120 seconds of a horizontal level flight, the numerical value of    (Table 1) is reduced by a factor of 4. This reflects a sudden change in the UAS dynamics, affecting the stability of UAS directionally.After inducing this change, the current controller loses its stabilizing capability and oscillation can be traced in the aircraft's lateral-directional states.As it was demonstrated in Section 6.2, the adaptive ANN allows identification of sudden changes in the aircraft dynamics in real time.
At 138 seconds and after detection of an unexpected change in the aircraft's stability and control derivative (i.e., change in    ), the adaptive controller replaced the old controller with a new one and successfully mitigated sudden  change in the aircraft's dynamics.The growing amplitude of oscillation is damped out and the roll and yaw rates and sideslip angle are effectively controlled.
The resultant period of time taken to implement the gain scheduling (18 seconds) is affected by the fact that the failure does not show up immediately and the vehicle remains mostly unaffected.The induced failure is an alteration of the rate of change in yaw rate with respect to changes in sideslip angle, that is,    , so for an original constant and close to zero sideslip (horizontal level flight), no immediate effect is observed.After sideslip angle starts to change, the failure has a multiplicative effect and grows faster.This is evident after second 130.
It is important to point out that although the closed loop remains (linearly) stable, the uncertainty robustness is lost, as the infinity norm grows over the unity ‖F  ( P1 , K 1 )‖ ∞ = 4.6355.In other words, a well-designed flight control system is robust to a fairly large range of uncertainty or changes in aircraft dynamics, however, if the changes become more extreme the performance degrades and the aircraft may go unstable.An adaptive system has the ability to readjust the controller to achieve desired performance or regain robustness about the new point.
In transition between controllers and to avoid significant sensitivity, the gain scheduling must be coupled with the ANN output.Figures 13 and 14 show the failure and consequent gain scheduling effects, on primarily involved states.All simulations were performed with the full FCS.
To broaden the applicability of FCS technologies and to extend assessment process, a failure which degrades aircraft's longitudinal stability is modeled.It is assumed that at 200 seconds of a horizontal level flight, a failure in the aircraft caused a major change in the magnitude of    (Table 1).The numerical value of    is reduced by a factor of 10.As it is shown in Figures 15, 16, and 17 and after the failure took place, the longitudinal robust stability is severely affected; that is, Detection of the failure, calculation of a new controller, and gain scheduling are assumed to happen after 5 seconds (200-205 (sec)).At 205 seconds, the new controller is online modifying control surface commands.Severe impact is seen in all major longitudinal variables, as shown in Figures 15, 16,  and 17.
The abrupt change in the angle of attack stability coefficient (   ) increases the pitch angle and subsequently reduces the airspeed.To mitigate these effects, the elevator is commanded to quickly recover the equilibrium about pitch axes and restoring the pitch angle.To restore the airspeed, the throttle is also commanded.As demonstrated with the simulated failure, the system without adaptation cannot achieve the desired tracking or performance.functionalities of the designed FCS and to compare its performance in closed loop with autonomous flight test data obtained using a COTS autopilot system.It is known that the COTS system uses an H-infinity controller.For comparison purposes, similar flight conditions are induced in the simulation, and same waypoints/trajectory are used for path following.Superficially, performances of the designed FCS and the COTS autopilot are compared in the following categories:

Functionality Tests and Comparison with
(i) extended Kalman filter performance (flight measurements versus EKF estimation); (ii) inner loop: H-infinity robust controller performance (e.g., the maximum commanded bank angle); (iii) outer loop: accuracy of guidance logic and path following in tight turns in presence of crosswind (e.g., deviation from the desired trajectory); (iv) airspeed and altitude control; (v) saturation of controls.

Extended Kalman Filter Testing.
A slow update rate GPS position sampled at 2 (Hz) is employed to test the smooth interpolation capability of the EKF. Figure 18 shows the measured and estimated geographical position and altitude.

Flight Control System
Testing.As part of the comparison, inner and outer loops and extended Kalman filter, as defined before, are included in testing.In this subsection, no gain scheduling and no ANN estimations are performed.These two features are tested independently and presented in previous two subsections.
International Journal of Aerospace Engineering The FCS controls the aircraft to follow a trajectory autonomously flown by a 33% Yak-54 UAS equipped with a COTS autopilot.This system contains an H-infinity robust controller in the inner loop, an outer loop logic for waypoint following, and an extended Kalman filter, running at 10 (Hz).Its sensors include a GPS, an IMU, a 3D accelerometer, a 3D gyro, a 3D magnetometer, a barometer, and a pitot tube.
For the similarity of the flight test and simulation comparisons, same initial conditions are extracted and used from the flight test data.To replicate external disturbance, COTS estimated wind information was also injected.
Figure 19 shows 3D views, and Figures 20 and 21 show the control signals for both the designed FCS and COTS autopilot.The top view of 3D simulation in Figure 19 demonstrates superior performance of new nonlinear guidance logic in guiding UAS on curved and tight trajectories in presence of a crosswind.The wind was blowing from the west, and the maximum deviation from the desired trajectory happened when the UAS equipped with a COTS autopilot was in a crosswind (magenta line Figure 19).
By design, the COTS autopilot does not command rudder.This imposed extra demand on the aileron causing higher banking angles when initiating turns.Despite dissimilarity of COTS system and the designed FCS, some basic but important comparisons can be made.As it is shown in Figures 20 and 21, the COTS autopilot and the designed FCS are not subject of control saturation issues.
Figure 22(a) shows the comparison between the COTS autopilot and the designed FCS in airspeed command following.For the sake of unbiased comparison, the COTS autopilot wind estimation is used in the simulation 14.1 (ft/sec) from 291 ∘ .The airspeed command has a step increment around 380 seconds.
The ground speed is shown in Figure 22(b) in a wider portion of the flight.The error in airspeed control of the COTS autopilot is seen as the result of bias.This presumption is confirmed by adding a bias of about 10-12 (ft/sec) to the measured airspeed and disabling the FCS's Kalman filter for an even comparison.After inducing the bias, ground speeds achieve higher similarity.
Figure 23 shows the attitude angles.It is important to notice that the extended Kalman filter takes a few seconds to converge from the given initial conditions affecting the first part of the estimation, but showing a good command following after possible transients.

Conclusions
An adaptive control comprising a robust inner controller, stable outer nonlinear guidance logic, and neural network fault detection is designed to provide increased resiliency to mitigate effects of on-board adverse conditions and unsteady aerodynamics.The aerodynamic models of UAS associated with hazardous weather or on-board adverse conditions are inherently nonlinear and unsteady.Under these conditions, although the closed-loop H-infinity is still linearly stable, the controller does not have uncertainty robustness and the infinity norm can grow over unity.A modified artificial neural network is successfully implemented for real-time nonlinear estimations of the aerodynamic forces.The Levenberg's adaptive parameter resets when reaching predefined extreme values.This modification allows avoiding unbounded growing when the cost function has reached a minimum.The sliding mode learning concept is used to keep the artificial neural network in learning phase continuously.A dynamic learning process of artificial neural networks increases the robustness against on-board adverse conditions and external disturbances.New nonlinear guidance logic which is extended from the lateral plane to the longitudinal plane has demonstrated superior performance in guiding unmanned air systems on curved trajectories in presence of external disturbances such as crosswind.The new logic adds new features ensuring its stability for any location and any attitude of the aircraft.The flight control system shows a satisfactory level of adaptability and resilience which is achieved by the adaptive nonlinear modeling, noise rejection, and biases attenuation.The robustness is assured by the proper gain scheduling between predefined trim points and for identified dynamic changes.It was found that in transition between gains and to avoid significant sensitivity, the gain scheduling must be coupled with the ANN output.

A. Aircraft Dynamic Modeling
Based on a Newton-Euler modeling approach, the aircraft dynamic model comprises a 6-DOF rigid-body set of equations for a fixed-wing aircraft in flat earth.Referred to the aircraft's center of gravity CG, as shown in Figure 1(b), it is defined in four interrelated coordinate systems, that is, the inertial coordinate system I aligned with the inertial local flat earth coordinate system I, the body coordinate system B fixed to the aircraft, the wind coordinate system W oriented   toward the relative wind, and the stability coordinate system S oriented as shown.Consider where aerodynamic forces   ,   ,   and moments   ,   ,   , together with the engine thrust   , act in the system as controllable inputs.

B. Polynomial Time-Invariant Engine Thrust Modeling
Highly dependent on the type and configuration of the engine, thrust   is modeled parametrically as a polynomial function on   as where  2  ,  1  ,  0  are constant parameters to be estimated from flight test data for the trim point x trim .

C. Linear and Time-Invariant Aerodynamic Coefficient Modeling
The following relations, defined in the stability axis where , ,  are the deviations of the body angular velocities from their constant trim values  trim ,  trim ,  trim , and  is the deviation from the constant trim speed  trim .Aerodynamic coefficients in the stability coordinate system S are transformed into body axes B coefficients by a rotation in the amount of angle of attack trim value  trim .

D. H-Infinity Robust Controller Design Conditions
Conditions to obtain a stabilizing H-infinity controller are
, and Research Corporation (DARcorporation) that has a built-in aerodynamic database for different types of aircraft models.The AAA modeling is based on the chosen trim condition and the aircraft geometric parameters.Designing a set of linear time-invariant controllers requires linear and time-invariant representations of the UAS in each equilibrium or trim point.For this purpose, a UAS nonlinear state space model derived from previous development and denoted ẋ () = f(x(), u()) ∈   and y() = h(x(), u()) ∈   with u() ∈   , with u  () = [ cmd  ,

3. 1 .
Inner Loop.The inner loop is constituted by a set of robust H-infinity controllers and a mechanism to perform gain scheduling among them based on current dynamic conditions.The linear time-invariant plant, given in (3), is
Flight Test Data.The purpose of this subsection is to assess different International Journal of Aerospace Engineering
whose components are given byA  = A  + H  C  + B   ) 2  − D

Table 3 :
Closed-loop infinity norm associated to each uncertainty.