Automatic Tuning and Turbulence Mitigation for Fixed-Wing UAV with Segmented Control Surfaces

: Unlike bigger aircraft, the small ﬁxed-wing unmanned aerial vehicles face signiﬁcant stability challenges in a turbulent environment. To improve the ﬂight performance, a ﬁxed-wing UAV with segmented aileron control surfaces has been designed and deployed. A total of four ailerons are attached to the main wing and grouped into inner and outer aileron pairs. The controllers are automatically tuned by utilizing the frequency response data obtained via the frequency sampling ﬁlter and the relay with embedded integrator experiments. The hardware validation experiments are performed in the normal and turbulent ﬂight environments under three conﬁgurations: inner aileron pair only, outer aileron pair only and collective actuation of all the aileron pairs. The error-threshold-based control is introduced to handle collective actuation of aileron pairs. The experiments have manifested that the collective usage of all aileron segments improves the roll attitude stability by a margin of 38.69% to 43.51% when compared to the independent actuation of aileron pairs in a turbulent atmosphere.


Introduction
Small unmanned aerial vehicles (UAVs) are very well known for their long-flight endurance. This capability of the fixed-wing aircraft is further extended through various techniques which use the structure of the aircraft to extract energy from the surrounding wind, and achieve even longer flights [1,2]. Unlike the multirotor UAV, the fixed-wing aircraft enjoy the luxury of a bigger surface area. The latest work reports the deployment of light weight solar panels on to the most of the available surface area of the fixed-wing UAV to generate power and enhance its flight time [3]. Fixed-wing UAVs are also used to quickly and securely deliver life-saving medicines and products to the distant and hilly areas [4,5]. Some other mature applications include the terrain mapping [6,7], collection of data using obstacle avoidance techniques [8,9], forestry and coastal surveys [10,11] and telecommunication [12][13][14].
The small fixed-wing UAVs are usually more susceptible to wind gusts. The sensitivity to wind gusts or the random pressure changes in the environment is mainly associated with the size of the main wing, specifically when its size is smaller than the wind disturbance envelope [15]. Consequently, a harsh flight environment has an adverse impact on all of the axes governing the stability of the airplane, especially the roll axis [16]. The poor roll control leads to significant flight deviations along with altitude fluctuations. In the case of small and high-frequency disturbances, the actuators' working bandwidth limitation is also the main cause of the degraded performance of aircraft even if it is using the novel turbulence sensing techniques [17,18]. As far as the structure of a fixed-wing UAV is concerned, the literature reports many attempts to enhance the performance of the fixed-wing UAV. Examples include the airplane with segmented control surfaces [19][20][21], flexible-wing design [22][23][24][25][26] blended wing body design [27] and split-aileron wing [28]. By the design itself, the segmented aileron control surfaces are explored in [19,20], demonstrating their practicality and advantages. The segmented surfaces have couple of aerodynamic advantages as well such as improvement in active wing lift distribution profile and reduction in drag force by working in favor of rudder and pitch control surfaces [19]. The segmented ailerons have also been used in in-flight load distribution by incorporating optical fibers as wing strain sensors [29]. Various segments are selectively actuated to recover from wing fluttering which is linked with poor flight performance. Modern commercial aircraft also utilize the segmented ailerons to mitigate the wing fluttering, which leads to more comfortable and safe air travel [30]. For instance, multiple ailerons are integrated in the Airbus 380 and are engaged in different ways depending on the speed of the aircraft [31]. Although the physical designs for the small fixed-wing aircraft with many aileron segments may exist in the literature, a thorough system identification study and a control architecture has not yet been developed and analyzed for such an aircraft. However, for ordinary small fixed-wing UAV with single aileron pair, i.e., one aileron control surface on each side of the main wing, several advances and optimization are reported in the literature. Notable work includes the use of PID controller [32][33][34], sliding mode controller [35,36], model predictive controller (MPC) [37,38], fuzzy controller [39] and back-stepping based control in [40,41].
PID controllers continue to be the most widely used because of their straightforward structure and practical ease of implementation [42]. Additionally, they do not require a lot of computational resources. The ability to modify controller parameters without comprehension of a plant's model is one of the benefits of PID controllers. Online experimental testing is another way to fine-tune the PID controller parameters for unmanned aerial vehicles [43]. These attributes have led to the adoption of PID controllers in the multitude of commercially available autopilot flight controllers today, such the Acro Naze32, Mikrokopter, Ardupilot, Paparazzi auto-pilot and Micropilot, etc. Furthermore, PID controllers' instant parameter adjustment and seamless implementation make them ideally suited for cascade control architecture. For the dynamically complicated systems, an optimum control strategy is attained using a cascaded PID control architecture [44]. In other words, larger and complicated system can be divided into smaller, independent subsystems, and then PID controllers are asynchronously tuned exclusively based on the dynamics of each deconstructed subsystem [45,46]. One of the most significant challenges when developing the controller for a UAV is tuning the controller parameters. The UAV control system's cascade control structure makes the tuning process even more arduous, especially when the UAV's nonlinear mathematical model is incorporated.
This study presents the detailed process of the system identification and the roll attitude control design of the fixed-wing UAV with multiple aileron control surfaces. For the experimental purposes, the main and severely disturbed axis in the turbulence, i.e., the roll axis, is taken into consideration. For a cascade control system of a fixed-wing UAV with multiple segmented ailerons, an automatic tuning method is suggested. In a supervised experimental environment, closed-loop experiments are conducted in order to automatically acquire a time-invariant model of the aircraft's roll dynamics. Following that, PID controllers are designed for the cascade control system using the frequency points. The aircraft undergoes the relay feedback experiment to proceed with the autotuning methodology. To recursively approximate the closed-loop fundamental frequency, responses from relay feedback tests are used [47]. Additionally, the PID controllers are tuned using the tuning guidelines suggested in [48] when the appropriate frequency points on the Nyquist plot are determined for the given aircraft. Finally, a cascade PID control system is enacted and validated using experimental results. Following is a summary of this paper's novel contributions:

1.
A robust roll attitude control system of the fixed-wing UAV with multiple aileron segments is designed utilizing autotuning methodology. At first, this UAV is subjected to the process of system identification via relay instrument to acquire frequency response points. The process of system identification from scratch is thorough as it captures not only the complex system's actual dynamics, but also those which might impact the closed-loop operation of control system such as computation delays, sensors, and actuators. Afterward, the acquired frequency points are directly used to design and autotune the PID controllers based on simplistic sensitivity functions and beta values as discussed later on. The suggested autotuning methodology is straightforward and does not require any prior information on the plant; 2.
In order to efficiently deal with the complexity of the system, the proposed control system is designed to have cascade. As discussed later on, unique controllers are handling the actuation of the inner and outer aileron segments through a cascade control system by considering each aileron pair as an independently manipulated variable. Moreover, a novel error-threshold control technique is proposed and incorporated to firmly reject the severe turbulence and other external disturbances. The experimental results have shown that such method of the controller tuning and multiple aileron control leads to highly stable and pleasant flight.

3.
A complete hardware of the fixed-wing UAV with multiple aileron segments along with a custom flight control board is designed to test and validate the efficacy of the autotuing methodology and multi-segment design against turbulence mitigation.
All the experiments documented in this work we performed in a professional wind tunnel environment situated in RMIT University. The acquired results demonstrate that the fixed-wing UAV with multiple aileron segments can easily perform in-flight switching between a conventional and multi-segmented UAV, whereas asserting that the multi-segment configuration exhibits stronger disturbance rejection characteristics during a hostile flight environment.
The paper is structured as follows. Section 2 details the hardware specifications of the multi-segment fixed-wing UAV along with the environment in which the experiments have been conducted. The conventional non-linear mathematical model of a common fixed-wing UAV is also explained. Section 3 describes the relay experiment which is utilized to discover unknown dynamics of the system. This section also explains the step by step process of frequency response extraction and controller design. Section 4 provides the numerical explanation of inner and outer loop controllers design for cascade system by utilizing two frequency points. Section 5 presents the cascade control structure implementation for the roll axis and the related hardware validation experiments. Section 6 provides the novel technique to control all the segments based on the roll angle deviation to enhance the stability of the aircraft. Section 7 summarizes the research findings and future directions.

Aircraft Structure and Mathematical Model
The hardware specifications and the experimental environment of the fixed-wing UAV with multiple aileron control surfaces are described in this section.

Specifications of the Aircraft with Multiple Control Surfaces
Unlike the conventional fixed-wing UAV, each aileron control surface is segmented into two to achieve the multi-segment configuration. In this way, each side of the main wing gets two ailerons, resulting into a total of four aileron control surfaces for the aircraft under consideration. Figure 1 presents the detailed illustration of the experimental UAV with four aileron control surfaces. It depicts the measurements of the main wing size, dimensions of the ailerons, and arrangement of the multiple aileron segments. It should be noted that orientation of the ailerons as shown in Figure 1 is only for understanding the concept of multiple ailerons' arrangement. Such an orientation will result in aerial braking and is not deployed in any of experiments presented later in this work. Figure 2 illustrates the aircraft's segmented control surfaces, i.e., the inner and outer aileron pairs. The description of the important parameters of the UAV are presented by Table 1.

Control Hardware
The aircraft's flight control board utilizes Cortex M4 processor (32-bit) to process attitude data and control algorithms. It runs at the clock speed of 180 Mhz which ensures high speed control code execution with minimum latency. The roll rate and angle of the UAV is precisely estimated through the well-known MPU6050 chip. This attitude sensing device has the capability to process the data from all axes, i.e., from gyro and accelerometer via onboard DMP (digital motion processor) [49] to accurately provide the orientation of a body in 3D space. Another benefit of onboard DMP is that the main processor is relieved of any additional load of filtering the noisy aircraft attitude data. Thus, the main processor is completely dedicated to execute control algorithms with minimum delay which is essential for real-time control applications.
The description of hardware components used to develop flight control system is presented in Table 2. A set of highly agile servos namely KST10 is deployed to minimize the effects of the actuator delay into the control loop. Moreover, the servos are top of their class and incorporate metallic gears to ensure consistent behavior and sustain the additional stress induced due to their high speed performance. The properties of these servos are given by Table 3. Furthermore, instead of relying on off-the-shelf commercial flight controllers, a customized flight control board (FCB) is designed for the aircraft under consideration. The FCB is designed to fit around a Teensy 3.5 microcontroller board in the software environment of Altium 17. The final version of the assembled FCB is presented in Figure 3. Step-down DC-DC converter

Experimental Setup
The wind tunnel facility used in the experiments is known as RMIT Industrial Wind Tunnel (IWT). This wind tunnel has a hexagonal test section measuring 3 × 2 × 9 meters (W × H × L). A 225 kilowatt DC motor, capable of producing a maximum of 50 m/s airspeed, precisely controls the airspeed inside the tunnel. The test section is fitted with a pilot static tube to measure airspeed. This type of tube works by measuring differential air pressure using two holes. The front hole directly interacts with the moving airstream to measure stagnation pressure relative to static pressure, which is read by the side hole.
The differential air pressure is then converted to the appropriate airspeed using standard mathematical relations. Additional details pertinent to the characteristics of the IWT are discussed in [50]. The IWT is also equipped with anechoic turning vanes, which reduce the acoustic noise to a significantly low amplitude in the test section [51,52]. It is common practice to test the aerodynamic properties and flight in an indoor wind tunnel environment due to the controllability and repeatability of particular wind speed and customizable turbulence spectrum. As the model selected for this work is novel, i.e., with multiple control surfaces, a repeatable flight environment is essential in order to allow for various performances and establish the effectiveness of multi-segment control design in normal and hostile flight conditions.

Mathematical Model for Conventional Fixed-Wing Aircraft
In order to understand the novelty and supremacy of the proposed control system design in upcoming sections, it is important to become familiar with the basic dynamical model of a conventional fixed-wing airplane. The differential equations defining roll (p), pitch (q) and yaw (r) in the body frame of a conventional fixed-wing UAV are described by (1) [53,54]. The control variables are the ailerons, elevator and rudder deflections, defined as variables δ a , δ e and δ r , respectively. Among the remaining parameters, C x y is the aerodynamics derivative coefficients corresponding to their respective variables, Γ x defines coupling dynamics, ρ is the air density, V a is the airspeed, S is the wing platform area, b is the wingspan of the airframe, c is the mean chord of the wing, and β C is the course angle.
In the complete attitude control system of a UAV, there are three major parameters which are precisely monitored, namely, roll, pitch Euler angles, and yaw angular velocity, denoted by φ, θ and r, respectively. A standard set of matrices that connects body frame angular rates with the Euler angular rates is represented through equations given by (2).
Let suppose the reference commands from a pilot operating a UAV are denoted by (φ * , θ * and r * ). The ideal control objective is to make the UAV's roll, pitch angles and yaw rate track the designated reference-points with zero error, thereby rejecting any externally inflicted disturbance such as wind gusts or payload fluctuations. It is necessary to discuss the mathematical model presented by (1) and (2) for a conventional fixed-wing aircraft. Although the given model is precise, building a model-based control system will require a knowledge of many unknown parameters. Clearly, finding these unknown parameters is a highly time-consuming and cumbersome job. The control system design problem is tackled more effectively by the direct identification of linear model and automatic tuning of controllers while residing within the actual flight environment (i.e., the wind tunnel) as described in following sections.

System Dynamics and Controller Design Using Two Frequency Points
This section describes the benefits of conducting a relay with integrator experiments, as well as use of the frequency sampling filter (FSF) methodology to acquire the frequency response points along with the controller design technique.

Relay with Integrator-Based System Identification
A relay with an embedded integrator mainly assists in identifying the location of fundamental frequency ω 1 of an unknown plant. Such an experiment produces ω 1 that passes through the imaginary axis of the Nyquist plot [48]. The relay with integrator experiment generates ω 1 with lower frequency when compared with the one using relay with hysteresis. Figure 4 depicts the setup of the relay incorporating an integrator [48,55]. Additionally, the problem of choosing a precise hysteresis value, required for relay with hysteresis experiments, does not exist when deploying a relay with integrator apparatus. Another advantage of this process is that the frequency response can be packed into lower and median frequency ranges, as presented in Figure 5, along with preventing the signal from becoming corrupted with the high-frequency noise.

Real Axis
Imag Axis Fundamental Frequency Figure 5. Location of fundamental frequency (ω 1 ) when using relay with integrator.
Assuming that u act (t) and y ss are the steady input and output signal of unknown plant G 1 (s), the integral error can be defined as The first-order approximation at time interval t i will bė In this way, the integral error e I (t i ) is acquired by The operation of the relay with integrator is mathematically described by following equations under the assumption that the steady-state gain of the system is positive, Here, the amplitude of relay is denoted by a and hysteresis by . For system identification experiments, the relay amplitude is 15 • /s whereas = 0.01.

Relay Response Data Analysis Using FSF
When a system is driven by the relay with integrator apparatus, it produces an oscillatory response, as shown in Figures 6 and 10. For periodic output, fundamental discrete frequency is described by as ω d = 2π/N where N is the number of samples per cycle. Let G(0) and G(e (jω d )l ) be the frequency response points of plant under relay experiment, then the relationship between the output y(k) and input u(k) using a frequency sampling model is given as in [56].
where l = 1, 2, 3, . . . N and m = (N − 1)/2. Here, f l (k) is known as FSF output vector and is defined as: Here, q −1 is a back-shift operator such that if d(n) is a discrete time signal, q −1 d(n) = d(n − 1). In case of l = 0, i.e., filter output at zero frequency, Equation (7) becomes The value of N is found by solving discrete Fourier transform of the input signal since it is periodic in nature. Afterward, the first sample with significant magnitude against its respective frequency point ω d is selected to calculate N = 2π/ω d to the closest integer [57]. The term v(k) in Equation (6) is used to incorporate noisy signal into the calculations. The distribution of noise is assumed to be Gaussian, with zero mean and variance σ 2 . Moreover, the magnitude of the filter output diminishes as higher-order terms are computed for most of the processes. Given this inverse relationship between f l (k) and |l| , only few initial values of l are considered. Keeping this in consideration, Equation (6) is approximated as A perfect periodic output signal is rarely acquired because of noisy measurements and other effects such as nonlinearity. This creates weaker even frequencies along with strong odd frequencies, as described by Fourier analysis [58]. An efficient estimation must also incorporate the effect of the weaker frequencies. Equation (9) considers the values with magnitudes close to zero through the inclusion of even terms. Therefore, it can be applied to relay feedback experiments that yield imperfect periodic output signals. Additionally, vectors presenting complex parameters and its correlating regressor vector are presented in Equations (10) and (11).
where ' * ' represents the transpose of complex conjugate of variable under consideration. In order to compute the estimated frequency parameter vector, i.e.,Θ(k) as given by Equation (13), the recursive least square (RLS) algorithm can be used. A conventional way to write the RLS algorithm is given by Equation (12), also known as a covariance matrix.

Automatic Tuning of PID Controller
When it comes to controller design, there are two basic requirements which are (1) the information of the system's original behavior and (2) the information about the system's desired behavior. These requirements can be available in the form of frequency response points, polynomials or transfer functions, etc. The concept of automatic tuning points towards a method that shapes the controller values through an automatic and simplistic way by utilizing the information of the plant's original dynamics in the perspective of the desired behavior.
Step (1) Plant's behavior: In order to design a PID controller of the form C(s) = c 2 s 2 + c 1 s + c o s , we need at least information of the system concerning at least two points on the Nyquist plot. That is, the first point in frequency response ω 1 enables evaluation of Kc and τ i , while τ D is obtained using the second point ω 2 in the frequency response data. With this in mind, consider that the frequency response of the plant at two frequency points ω 1 and ω 2 is known as G(jω 1 ), G(jω 2 ) [32,48]. When combined with PID controller transfer function in open-loop consideration, it yields L(jω) such that: For two frequencies ω 1 and ω 2 , the same can be given as Step (2) Desired behavior: The essence of any autotuner design lies within the process and complexity involved in the selection of the desired response. The purpose of the proposed autotuner is not only to achieve robust performance, but also is to keep the process simple. Therefore, the selection of desired performance is performed through the control sensitivity function of the first order as given below, where K p is the steady-state gain of a plant, τ cl is the desired closed-loop time constant and β is the performance parameter used to calculate τ cl from an known open-loop time constant (τ op ) of plant such that τ cl = βτ op . The value of β must be carefully chosen such that τ cl β > 0 and τ cl β ≈ dominant time constant of the system. It is obvious from Equation (17) that there is an inverse relationship between β and the performance of the system, i.e., the high value of β will result in slower performance and vice versa.
With the knowledge K p , τ cl and β, one can set the desired performance of system using Equation (17). In order to obtain these parameters, the suggested method utilizes the information obtained from the relay experiment. As the relay experiments proposed here use an embedded integrator, it can be verified through simple tests that the settling time of the plant can be approximated to 1 2 N∆t, which is half of the integrated relay test cycle period (N) multiplied with sampling time (∆t). Furthermore, the dominant time constant of the plant is set as one-fifth of this settling time obtained as follows: Consequently, the sensitivity function S u (s) becomes: To obtain the consistent gain value K p , direct calculation of the magnitude of plant's frequency response is preferred along with the sign of unknown steady-state gain (K ss ) of the system as under The control sensitivity function S u (s) is merged with plant information G(s) to generate a complementary sensitivity function T d (s) as given below Equation (19) sets the desired response of the system with the help of the control sensitivity function. In order to compare the desired response with actual plant open-loop response given by Equations (15) and (16), the transfer function given by Equation (19) has to be converted into open-loop desired response (L d (jω)), hence: With the help of available information in the form of actual plant response given by Equation (14) and the desired response given by Equation (20), PID parameters are calculated by equating and comparing the responses as L(jω 1 ) = L d (jω 1 ) and L(jω 2 ) = L d (jω 2 ), we obtain where X(jω 1 ) = jω 1 L d (jω 1 ) G(jω 1 ) and X(jω 2 ) = jω 2 L d (jω 2 ) G(jω 2 ) . The classical PID values are obtained via c 1 , c 2 and c 0 as given below,

Cascade Control System for Roll Attitude Control
The objective of the control system of the multi-segmented aircraft is to control its roll angle attitude and follow the reference signal. The proposed control structure uses two cascade loops, i.e., the inner and outer loop. The inner loop is set to handle the roll rate of aircraft and is tuned to act much faster than the outer loop, which controls the roll angle. The benefit of this configuration becomes apparent in the event of a disturbance, where a fast-acting inner loop takes immediate disturbance rejection actions before it affects the roll angle of the aircraft.

Inner Loop Controller Development
To proceed with the design of roll rate control loop (inner loop), the relay with embedded integrator experiments are performed for both the inner and outer segments. Figure 6a,b show the time domain response of the inner and outer segments when subjected to relay tests. The amplitude of the relay with integrator apparatus used in experiments is maintained as equal to 15 • . The responses of the inner and outer segments are passed through the frequency sampling filter (FSF) to obtain the frequency response of systems. As detailed in the working methodology of the FSF filter, its output contains an array of estimated frequency response values ranging from the most dominant to the least dominant component in response. The relay experiment leads to one frequency response point, but from the estimated output array of the FSF filter, two points are selected. These points are denoted by G pi (jω 1 ) and G pi (jω 2 ) for inner segments and G po (jω 1 ) and G po (jω 2 ) for outer segments, as shown by It is evident from Figure 7 that the response of the inner and outer segments is different. For better control of the system, each of these sets of segments, i.e., the inner and outer segments, is considered as a separate system. Therefore, separate controllers are required for inner and outer segments.
To begin with the inner loop for inner segments, we first take two points as given by Equation (24) such that G pi (jω 1 ) and G pi (jω 2 ) represent the 3rd and 7th frequency points in FSF output array. With the gain equal to K p = |G pi (jw1)| and closed loop time constant τ cl = βτ op = 0.1βN∆t, the value of β = 0.4 leads us to the following sensitivity function.
Open-loop desired response L d (jω 1 ) is calculated as Likewise, we calculate the second complementary sensitivity function T d (jω 2 ) using a similar sensitivity function for response at ω 2 i.e., G pi (jω 2 ), which leads to the following open-loop desired response.
Now, with the information of G pi (jω 1 ) and G pi (jω 2 ) along with L d (jω 1 ) and L d (jω 2 ), one can proceed to the following controller values using the relationship given by Equations (21)- (23).
Similarly, the inner loop PID controller for outer segments is designed using two frequency response points G po (jω 1 ) and G po (jω 2 ), given by Equation (25). Using β = 0.2, the inner loop controller for outer segments is found as under C(s) = c 2 s 2 + c 1 s + c 0 s = 0.0386s 2 + 0.8432s + 8.1303 s .
The classical values for the inner loop controllers of the inner and outer segments are given by Table 4. It must be noted that all of the PID controllers are equipped with a low-pass filter. The filter works along with derivative term and has the form of 1 where the value of τ f = 0.1. The implementation of the PID controller for the inner loop of both inner and outer segments is presented in Figure 8 where p * is the roll rate reference, p is the roll rate output, and δ a -plant input for the inner or outer segments.

Outer Loop Controller Development
In order to establish the dynamics for the outer loop for both inner and outer segments, another relay test is performed while keeping the inner loop closed. The relay experiment setup for outer loop dynamics identification is presented in Figure 9 where r * = 0 is the reference input to the relay apparatus. The roll reference input to the outer loop or angular position control loop, denoted by φ * , is generated by the relay, and the reference for the inner loop p * is obtained from a simple proportional controller with a gain of K T . Since the outer loop is assumed to be stable, it has been kept equal to unity gain. It is worth mentioning that while conducting the outer loop relay experiment, the inner loop PID controllers were implemented as developed in the previous section (see Table 4). The relay with integrator test yields time domain data, as shown by Figure 10, for both inner and outer segments. It is found that outer loop response signals for both of the segments have longer time periods due to the inclusion of the dynamics from the inner loop and the outer plant.  Proceeding further, the data from Figure 10 are passed through FSF filter to obtain frequency response points. As discussed in the previous section, two frequency response points, the 3rd and the 7th, are considered for PID design, as shown in Figure 11. The numeric values for obtained response points are given in Equations (26) and (27) where  With the information of G ol p pi (jω 1 ) and G ol p pi (jω 2 ) along with L d (jω 1 ) and L d (jω 2 ), one can proceed to the following controller values using relationship given by Equations (21)- (23).
Similarly, the outer loop PID controller for outer segments is designed using two frequency response points G ol p po (jω 1 ) and G ol p po (jω 2 ), given by Equation (27). Using β = 9.0, the inner loop controller for outer segments is found in the following way: The classical values for the outer loop controllers of the inner and outer segments are presented in Table 5.

Hardware Validation of Autotuned Controllers in Cascade System
When the inner and outer loop controllers are ready for both inner and outer segments, cascade configuration is deployed to integrate the controllers as shown in Figure 12 where φ * is the desired reference angle input, φ is angle output, δ ai is aileron input to the inner segments and δ ao is aileron input to the outer segments. Initially, two separate experiments were conducted to test the performance of aircraft. First, the cascade loop configuration is applied only on the inner segments, while the outer segments are kept inactive, i.e., at 0 degrees. Afterwards, the PID controllers designed for outer segments are cascaded to test the performance of outer segments while keeping inner segments inactive. It should be kept in mind that the performance of the inner and outer segments is tested in two test flight environments, i.e., in laminar and turbulent airflow.
In laminar flow or smooth airflow, the UAV encounters practically no substantial external disturbance other than native turbulence intensity of the wind tunnel test section, which was around 0.1-0.5%. However, to test the aircraft's performance in the presence of external disturbances, a turbulent environment is created. Figure 13 shows a special box placed upright in the path of incoming airflow to generate turbulence inside the wind tunnel's test section. The flow of experiments conducted in the wind tunnel is presented in Figure 14.

Performance Evaluation: Inner Aileron Segments
The step response of the roll angle is shown by Figure 15a when only inner segments are activated in laminar air flow. Whereas, roll rate response of the UAV under similar conditions is presented in Figure 15b. It is evident from Figures 7 and 11 that inner segments have lower gain and bandwidth than the outer ones; hence, there is always a trade-off between rise time and overshoots. By studying the control signal presented in Figure 16a,b, it can be observed that the inner segments are struggling to keep up with reference tracking, especially in the event of turbulence. While at t = 10, 18 and 26 s, the control signal reaches the saturation limits because of the large step changes, as shown in Figure 16a, during the laminar airflow, the situation is concerning during turbulent airflow. Figure 16b shows that the control signal spends most of the time at the extremes of the graph. This is a result of the inherent lower gain of the plant, i.e., the inner segments, as discussed earlier.   The experimental evaluation is repeated in a turbulent environment. When the UAV works in an environment that has wind gusts changing suddenly, the inner segments are found to be less effective due to a slower response time. Figure 17a,b show the roll angle and rate output during turbulent airflow. It must be noticed that the outer aileron pair is kept at 0 • during these experiments. The closed-loop responses from the experiments performed in laminar and turbulent airflow demonstrate that the inner aileron segments have the ability to control the roll motion of the UAV during step changes in the reference signal. While the experimental results show that roll angle tracking in a turbulent environment is not as effective as in laminar flow, the inner segments are still capable of maintaining the closed-loop stability.

Performance Evaluation: Outer Aileron Segments
In order to better analyze performance difference, the outer aileron segments were tested under a similar experimental setup as the one used in the inner aileron segments. The step response generated while the UAV relying on only outer segments is presented in Figure 18a,b. These roll angle and roll rate responses were recorded when the aircraft was subject to laminar airflow. During the laminar airflow, the outer segments perform almost identically to the inner segments, except for lesser overshoots being observed at t = 18 s. Figure 19a presents the control signal behavior when the outer segments are working in normal flight conditions. An important change to notice here is that the the control signal is mostly working within the range of −19% < δ ao < +18%, whereas for inner segments, the control signal is in the range of −40% < δ ai < +20%. Moreover, the control signal δ ai has quickly reached the saturation limits at every step change, while the outer segments control signal δ ao as zero taps on saturation points during the whole experiment. This behavior suggests that the outer segments, in comparison with inner ones, have good potential for tackling the big reference step changes or incoming disturbances.  However, when the UAV confronts irregular airflow, the outer segments are also able to reject externally induced disturbance and sustain the closed-loop stable operation. The closed-loop roll angle and roll rate responses are depicted in Figure 20a,b, respectively, when only the outer segments are working in a turbulent airflow. Further analysis into the control signal reveals that the outer segments are not using their full capacity to achieve the goal of reference tracking even in the presence of turbulence intensity similar to that of inner segments experiments. Figure 19b depicts that the control signal for the outer segments has the longest stay at saturation limit, i.e., +100% within the range of 17 < t < 18 s and that is because of the huge step-change in the reference signal which is from −30 • to +30 • , i.e., of 60 • .

The Error-Threshold-Based Approach to Control of Segmented Surfaces
The detrimental impact of a windy and turbulent environment on a typical fixed-wing UAV is well acknowledged. Therefore, increasing the aileron size will require larger actuators that will affect the UAV's reaction time and battery power when tackling severe turbulence. As a result, there will be additional difficulties that must be overcome, for instance, introducing the requirement for high-performance digital processors and expensive sensors. This aircraft deploys error-threshold-based aileron segment control in order to solve the problem. As was previously mentioned, the UAV in question has independent actuation capabilities on both its inner and outer aileron control surfaces. It is emphasized that only one pair of the ailerons should be active for reference tracking and rejection of insignificant disturbances in order to conserve battery energy during regular operation. The other pair of ailerons, in this case, the inner segments, is reserved as redundant ones. It is only active while rejecting powerful disturbances such as severe turbulence or improving reference following.
The control algorithm that determines whether the redundant pair of ailerons should be active or not relies on the intensity of external disturbance or the deviation of the UAV from given set-point. Since the external disturbance is directly linked with measured feedback error, i.e., the difference between reference roll angle denoted by φ * (t) and the UAV's actual roll angle φ(t), the large feedback error will call for involvement of all the aileron pairs to better stabilize the aircraft. Proceeding with this concept, the activation signal for multiple segments is formulated as, For the UAV used in this work, outer aileron segments are acting as primary actuators while inner ailerons are working as redundant ones. If the actuation threshold is defined by the pilot to be act , then the error |φ * (t) − φ(t)| ≤ act will lead to λ = 0, resulting in deactivation of inner ailerons. In the situation where error is |φ * (t) − φ(t)| > act the resulting λ will be equal to 1, which will make inner segments active and work in support of outer aileron segments.
The value of act is user-selected and can vary based on an estimate of how turbulent an environment the UAV is going to fly in. All the experiments performed in this work are based on act = 5 • . Since the value of act is independent of PID controller values, depending upon user preferences, multiple thresholds such that act ∈ [5 • , 10 • , 15 • . . .] can be programmed and triggered remotely using a flick of a switch. The independently tuned and deployed controllers for the inner and outer segments ensure that the lower the threshold, the better the disturbance rejection performance. Figure 21 represents the block diagram of the cascade controllers incorporating the error-threshold-based control. The switch before δ ai can be treated like λ, hence, deciding whether the inner segments should be active or not. The error-threshold-based control was tested in two flight environments. Figure 22a,b present the roll angle and roll rate outputs of aircraft while operating using the aforementioned control in the laminar airflow. The performance in this scenario resembles that of the outer segments since they are acting predominantly during the whole experiment. A slight improvement in the rise time can be noticed when looking at the points where step changes occur. This is because of the fact that the inner segments are active during the transition of the reference signal as |φ * (t) − φ(t) > 5 • | and working in conjunction with outer segments to minimize the error as soon as possible. The working sequence of the inner and outer ailerons is made clear while looking at the control signals given in Figure 23. It is immediately observed from Figure 23a that the outer segments are normally active all the time within the average working capacity of −19% < δ ao < +18%. When compared to the individual performance of the outer segments where the overshoots were within the range of −58% < δ ao < +88% (see Figure 19), the same ailerons are exhibiting lower overshoots at the reference step changes, i.e., within the range of −30% < δ ao < +39% because of the assistance acquired from the inner segments. Figure 23c shows the error angle signal outlining the threshold band of ±5 • . Figure 23b presents the active and inactive time of the inner ailerons (δ ai ). By comparing Figure 23b,c, the error-threshold-based control can be observed in action such that the inner ailerons are only energized when the error signal has crossed the threshold limits, whereas, for rest of the time, they are held constant at δ ai = 0 • .
The impact of the error-threshold-based control becomes clearer on the attitude performance as we proceed with experiments in a more challenging test environment. Figure 24 presents the attitude performance of the UAV in terms of the roll angle and rate while working in a turbulent airflow. It is noticed that the aircraft is able to sustain a smoother performance as compared to the previous experiments where only outer segments were active. A clear reduction in overshoots is observed, along with the proper tracking of roll angular rate, as shown in Figure 24b. The control signals and error signal behavior are depicted in Figure 25. The difference in working methodology of the inner segments is perceived in Figure 25b when compared to that of the laminar flow experiment. By analyzing the error signal given by Figure 25c, it is observed that the inner segments are active whenever the condition |φ * (t) − φ(t) > 5 • | becomes true. This methodology ensures that there is no additional load on the limited onboard battery energy of the aircraft in a normal flight, and the improved performance is available at the discretion of the user or the challenging flight environment.    The mean squared error (MSE), which is calculated in order to better quantify the boost in the closed-loop performance of the hardware experiments conducted, is defined as E = 1 M ∑ M−1 i=0 (φ * (t i ) − φ(t i )) 2 where the number of samples is denoted by M. The MSE for the three distinct control configurations is depicted in Table 6. It can be inferred that the roll angle control response of the error-threshold based approach is superior by 6% when compared to the independent performance of the outer ailerons only during laminar flow. Under similar conditions, the outer ailerons excel by a percentile of 22.3% when compared to the independent working of the inner segments. However, the performance of the error-threshold-based control is much different from the individual actuation of either inner or outer segments in the presence of turbulence. The MSE analysis shows that the error-threshold-based control can offer a performance improvement of 38.69% to 43.51% while flying in a hostile environment.

Conclusions and Future Directions
This research work commences with system identification experiments utilizing a relay with embedded integrator to identify the aircraft's dynamics. Two experiments were performed, one for the inner and another for the outer segments, to identify the unknown dynamics pertaining to the roll rate. Similarly, two more experiments were conducted to uncover the angular position dynamics. The information of the frequency response points is utilized immediately to tune the controllers using sensitivity functions and the performance parameter β. The hardware validation experiments are performed in RMIT's wind tunnel under two test environments. The error-threshold-based control is proposed and implemented in hardware to achieve an extra degree of roll attitude stability. The experiments have manifested that the error-threshold-based control improves the roll attitude stability by a margin of 38.69% to 43.51% when compared to the independent actuation of aileron pairs in a turbulent atmosphere. While theoretically, the number of ailerons segments per side of the main wing can be unlimited, in practice, such a number must be carefully selected to avoid over-burdening of the main wing. Moreover, this work can be extended to explore the performance of the aileron segments on the leading edge of the main wing of UAV. Another promising future direction of this work can be in the selective disturbance rejection for small wind gust affecting only one side of the aircraft. Since the aileron segments have the capability to be actuated independently, the UAV can be equipped with lightweight air pressure sensors to detect pressure changes and selectively activate specific segments instead of triggering all actuators.