Modeling and Design of an Aircraft-Mode Controller for a Fixed-Wing VTOL UAV

Vertical takeoff and landing (VTOL) is an essential feature of unmanned aerial vehicles (UAVs). On the one hand, VTOL can expand and enhance the applications of UAVs; yet, on the other hand, it makes the design of control systems for UAVs more complicated. +e most challenging demand in designing the control system is to achieve satisfactory response sharpness of fixedwing UAVs to control commands and ensure that the aircraft mode channels are effectively decoupled. In this work, a six-degreeof-freedom (6-DoF) model with forces and moments is established based on the aerodynamic analysis, which is carried out through computational fluid dynamics (CFD) numerical simulation.+e improved proportional derivative (PD) controller based on the extended state observer (ESO) is proposed to design the inner-loop attitude control, which increases the anti-interference ability for internal and external uncertainty of the UAV system.+emotion equations of the UAV are established and divided into independent components of longitudinal and lateral motion to design the outer loop control law under minor disturbance conditions. A total energy control system (TECS) for the longitudinal height channel is proposed, which separates speed control and track control. L1 nonlinear path tracking guidance algorithm is used for lateral trajectory tracking so as to improve curve tracking ability and wind resistance. Effectiveness of this approach is proved by actual flight experiment data. Finally, a controller based on angular velocity control is designed to prevent the attitude and head reference system (AHRS) from malfunctioning. Its effectiveness is verified by the response test of the control system.


Introduction
e VTOL functions keep the fixed-wing UAVs from relying on runways to takeoff or land and also significantly reduce the risk of accidents during takeoff and landing. Besides, the VTOL function supplies the fixed-wing UAVs, the flexibility to make it easier to perform tasks in mountainous areas, sea, and other scenarios, thereby broadening their application [1]. Furthermore, UAVs with VTOL can quickly implement one-key autonomous takeoff and landing functions, which improves the reliability and safety in takeoff and landing for potential nonprofessional and unskilled users [2,3]. Hence, the UAVs with VTOL functions have always been the focus of research in the aviation field of Western Europe and the United States [4,5]. Typical representatives are tail-mounted VD200, tiltrotor "Osprey" V-22, tilt-wing NASA "Greased Lightning," and fixed-wing HQ-60 from American Latitude Engineering LLC. e design of controllers for VTOL UAVs is widely concerned in both the industry and the research field. In the recent years, multiple novel methods have been proposed to improve the performance of VTOL UAVs. For example, Ozgür Dündar proposed to employ an aerodynamic design steps and sizing of both wing and control surfaces to improve static stability and endurance [6]. Wu et al. employed multiple sensors to design a UAV system for emergency response [7]. Oca et al. presented a longitudinal aircraft dynamics to model the takeoff and landing considering the rolling resistance forces during ground roll through a friction model [8]. Govdeli et al. developed a detailed aerodynamic modeling technique along with a fuzzy switching multimodel guidance and control strategy for a UAVs and successfully controlled the aircraft for a full flight envelope from hover to landing [9]. However, to date, the control method and algorithms have not been fully developed to fulfill the needs for various UAVs. More researches are still needed to improve the performance of VTOL UAVs in specific circumstances.
Based on novel control techniques and algorithms, this paper takes SD-40 UVA as an example and presents the modeling and design of an aircraft mode controller for fixedwing UAVs with VTOL functions. e SD-40 UVA has a fixed wing with eight horizontal rotors installed on the double-tail brace, as shown in Figure 1.
In this work, a six-degree-of-freedom (6-DoF) model with forces and moments is established. A improved proportional derivative (PD) controller based on the extended state observer (ESO) and a total energy control system (TECS) for the longitudinal height channel are proposed.
e motion equations of the UAV are established. L1 nonlinear path tracking guidance algorithm is used to improve curve tracking ability and wind resistance. Finally, a controller based on angular velocity control is designed to prevent the attitude and head reference system (AHRS) from malfunctioning. Effectiveness of these novel approaches is investigated by analyzing actual flight experiment data.

SD-40 Motion Mathematical Model
e nonlinear model obtained by the Newton-Euler formulation involves two main right-hand reference coordinate systems [10], as shown in Figure 2. For the geodetic coordinate frame, which is expressed as O g x g y g z g . A North-East-Down (NED) orthogonal coordinate frame is established with its origin at the takeoff point.
O b x b y b z b is the body-fixed frame (BFF) attached to the center of gravity (CoG) of SD-40, where O b x b points out the nose of the SD-40, O b y b points out the right wing, and O b z b points out the belly.
B bg represents the transformation matrix from the NED frame to the BFF.
where ϕ, θ, and ψ represent the Euler angles and s and c are the shorthand notation of the sine and cosine functions, respectively.

Linear Motion Equation.
According to the momentum theorem, the kinetic equation of mass center can be obtained: where [U V W] T is the velocity vector in the BFF, m is the mass of the SD-40, [F x F y F z ] T the total force vectors expressed in the BFF, and [P Q R] T is the vector of the attitude angular rates.
where S ba is the transformation matrix from the airflow coordinate frame (AFF) to the BFF, α is the angle of attack, β is the sideslip angle, [D Y L] T is the total force vectors expressed in AFF, T is the horizontal thrust of the engine, F T is the force in BFF produced by eight motors with rotors in multirotor mode, and F D is the drag force in AFF produced by eight rotors in aircraft mode. e components of the force vector and the drag force yields are expanded as where V t is the airspeed,K d is the drag coefficient of rotors, qs is the dynamic pressure, and [C d C l C y ] T is the vector of the drag coefficient, the lift coefficient, and the side force coefficient of the fixed wing.
[Windu Windv Windw] T is the wind disturbance. e three-axis velocity in the BFF can be updated as   Mathematical Problems in Engineering V t , α, and β are equally updated as According to the relationship between the NED frame and the BFF, the kinematics equation of the mass center is obtained as where [X Y Z] T represents the position vector of the UAV in the NED.

Angular Motion Equation.
According to the moment of momentum theorem, the dynamic equation of the rotation of the mass center can be derived with respect to the inertia, the total moment of the fixed wing, and the angular rates as follows: where I is the inertia matrix of the rigid body and I − 1 is the inverse matrix of I.
[L M N] T is the total moment vectors of fix-wing expressed in the BFF, which can be expressed as where b is the wingspan and c is the length of the average aerodynamic chord.
[C r C m C n ] T is a vector representing the roll moment coefficient, the pitch moment coefficient, and the yaw moment coefficient of the fixed wing, respectively.
[M CL M CM M CN ] T is the total moment vectors of the multirotor system expressed in the BFF as where l is the multirotor wheelbase, K n is the rotational damping moment coefficient, N i is the revolutions per minute (RPM) of the rotor, T i is the force in the BFF produced by eight motors with rotors in multirotor mode, and M N i is the counter-torque of each rotor [11]. Based on the Euler Angle relation, the relationship between the attitude angle differential and the angular rate can be obtained as e 6-DoF nonlinear dynamics equations can be expressed by equations (2), (7), (8), and (12).

Flight Controller Design
e flight controller of SD-40 consists of an inner loop for attitude control and an outer loop for trajectory control. e attitude angle error is used as the input signal for the attitude control. In contrast, the external loop controller uses the trajectory error and its rate of change as input signals.

Attitude Control.
e attitude control design of the UAV can be carried out into extended state observer, pitch channel control, and roll channel control.

Extended State Observer. Equation 12
shows that the roll channel, pitch channel, and yaw channel are interrelated, which poses a challenge in the design of a conventional controller. However, Active Disturbance Rejection Control (ADRC) can solve this coupled problem. First, the interaction between different channels inside the system, together with the external disturbance caused by the environment, is treated as the total disturbance of the channel. en, ESO is applied to each angle channel independently to estimate the total disturbance in real time. Finally, a total disturbance is used to dynamically compensate and linearize the UAV control system [12,13].
Equation system (12) can be updated as is a modeled nonlinear dynamic system and ω i is the unmodeled dynamic system including external interference, modeling error, and other factors [14,15]. b 1 is the control input gain from the deflection angle of the aileron angle to roll angular acceleration and b 2 is the control input gain from the deflection angle of the elevator angle to pitch angular acceleration.Cl δa is the coefficient of the rolling moment, while Cm δe is the coefficient of pitching moment [16]. e second-order system can be expanded into a thirdorder system as _ e linear extended state observer can be unfolded into the following equation: where [z 1 z 2 z 3 ] T is the output of the ESO, tracking the state variables of the original system [x 1 x 2 x 3 ] T [17,18]. All poles of the ESO characteristic equation can be located at − ω 0 (on the left half-plane of the complex plane) as per the following equation: where ω 0 is denoted as the bandwidth of the ESO. e control signal can be expressed as where u 0 is the output of PD controller andβ is the compensation coefficient of total disturbance [19].

Pitch Channel Control
Loop. e pitch channel controller needs the signals from the angular rate sensor and attitude angle sensor for feedback, increasing the damping of the UAV system and improving the dynamic response of the open-loop system. e longitudinal control system structure of the SD-40 is shown in Figure 3, which is composed of the pitch attitude control loop based on ESO and the height control loop based on the total energy control system (TECS).
Pitch angle control based on ESO is an adaptive PD controller [20] with double loop feedback of the pitch angular rate Q and pitch angle θ. According to equations (14) and (15), x 1 is θ and x 2 is Q, z 1 is the estimation of the θ signal, z 2 is the estimation of the Q signal, and z 3 is the estimation of the uncertain parts. e system block diagram is shown in Figure 4, and the mathematical expression is shown in the following equation: where δ e is the deflection angle of the elevator, θ g is the pitch angle command, and Q is the pitch angular rate feedback value.
b 2 can be calculated with equation (13) as e bandwidth ω 0 of the pitch channel ESO can adjust the tracking speed of the observed state variable. According to reference [21], ω 0 ≈ 5 − 10ω c , where ω c is the equivalent bandwidth of the transient profile, which is used with a settling time of 1 s, ω c � 4, so ω 0 ≈ 20 − 40.
A higher bandwidth corresponds to a better command of the disturbance rejection and sensitivity to parameter variations. However, achievable bandwidth is limited by the hardware and software limitations, including sensor noises and the given sampling rate of the actual flight control hardware system. e comparison of responses at different values ω 0 is shown in Figure 5.
Considering the simulation results and the actual limitations, ω 0 is selected as 25. e system response versus the step input is shown in Figure 6. e pitch angle can quickly track instructions and can be well estimated by zl. Figure 7 is the observed value of total disturbance of pitch control loop. e disturbance can be suppressed in a short period.

Roll Channel Control
Loop. Similar to the pitch channel, the roll angle control is also developed based on the PD philosophy. e control block diagram of the roll channel is shown in Figure 8. e control law is as follows: where δ a is the deflection angle of the aileron, ϕ g is the roll angle command, and P is the roll angular rate feedback value, improving the short period damping. b 1 can be calculated with equation (13) [12]: e comparison of response at different values ω 0 is shown in Figure 9. As done previously for the pitch channel, the bandwidth of the roll channel ESO ω 0 is selected as equal to 25. e roll angle step response is shown in Figure 10, which has good tracking and observation effects. Figure 11 is the observed value of the total disturbance of the Roll control loop. e disturbance can be suppressed in a short period and the system can quickly reach a stable state. e pitch angle and the roll angle controller based on ESO for the inner loop can respond to and track the command effectively and achieve high precision positioning of the UAV.

Longitudinal Height Control.
e control of the longitudinal height of the SD-40 is performed through an outer loop based on the TECS. e throttle controls the change of total energy, and the deflection angle of the elevator distributes the kinetic energy and the gravitational potential energy. As such, the speed control and the height control are decoupled [22][23][24].     Mathematical Problems in Engineering e error between the kinetic energy and the specified kinetic energy at a certain moment can be expressed as where K is the kinetic energy of the particle, V t is the true airspeed, and V c t is the specified airspeed. e error between the gravitational potential energy and the specified gravitational potential energy at a certain moment can be expressed as e error of the total energy E and the allocation L of the total energy error can be expressed as per the following equation: e allocation is updated as By differentiating both sides of the total energy equation and assuming that the trajectory angle c is small, the rate of change of the total energy is approximately expressed as Meanwhile, the longitudinal dynamics equation of the UAV is expressed as per the following equation: where T and D are, respectively, the thrust and drag force of UAV during cruise state. In this balanced state, the thrust increment is expressed as In summary, the change of total energy can be controlled by the change in thrust [25]. e deflection angle of the elevator changes the track angle, which leads to the mutual conversion between the potential energy and the kinetic energy [26,27]. Assuming that there is no significant energy loss during the conversion process, the change rate of the energy distribution can be defined as    Mathematical Problems in Engineering Total energy control block diagram is shown in Figures 12 and 13.
H g is the height command, V g is the speed command. E sp is the specified energy, L sp is the specified energy distribution, and _ E sp and _ L sp are the corresponding rates of change. E is the total energy, L is the energy distribution, and _ E and _ L are the corresponding rates of change, respectively. K _ E⟶ΔT is the gain from energy change rate to throttle andK _ L⟶Δθ is the gain from energy distribution change rate to pitch angle. e complete TECS control law, as well as the total energy change control channel, can be expressed as where _ E max and _ E min are the max and min rate of change of the total energy in climbing mode and descending mode, respectively. δ Tmax and δ Tmin are the max and min opening of the throttle, respectively. e total energy distribution control channel could then be expressed as Controlling _ L c with the elevator requires a pitch rate/ pitch attitude feedback inner-loop control law, where θ g will be transformed into elevator command to stabilize the UAVs short period mode. us, _ L c develops θ g , serves as the input of the pitch attitude control loop, which acts indirectly on the elevator [28][29][30].
where gV t is the conversion coefficient from the climb angle to energy distribution change rate, which adapts to a range of speed changes.
Case 1: Given the initial state of UAV, height is 100 m and speed is 30 m/s. When t � 1 s, change the height command to 105 m, then the height step response is shown in Figure 14.
From the graph in Figure 15, the height can track the command well with some overshoot. Meanwhile, the speed is basically unchanged, and the fluctuation is controlled within ±0.5 m/s.
As the height increases, the kinetic energy is converted into potential energy, which requires a larger throttle energy value. Even though the value of the elevator energy is negative, the UAV performs an upward movement. When the new balance is reached, the value comes back to zero. Case 2: Given the initial state of UAV, the height is set equal to 100 m and the speed to 30 m/s. When time t � 1 s, change the speed command to 32 m/s, then speed step response is shown in Figure 16. As shown in Figure 17, the speed can track the command well, with some likely overshoot. Meanwhile, the height is unchanged, and the fluctuation is controlled within a distance of ±0.3 m.

Mathematical Problems in Engineering
As the speed increases, the kinetic energy increases, requiring a larger throttle energy value. e elevator's value is positive to accelerate the UAV, and when the new balance is reached, the value keeps at 2°, as shown in Figure 15.
(2) Flight Data. e UAV's initial height is 1470 m and speed is 30 m/s. When t � 1 s, the change in height command and the speed command are H g � 1170 m, V g � 32m/s, then step response is shown in Figure 18.
As shown in Figures 18 and 19, the altitude drops slowly with the command, and the airspeed is kept at 35 ± 1 m. Since the UAV flyes at a constant speed, the throttle remains unchanged to keep the kinetic energy intact. e elevator command is essentially negative, raising the UAV's head and increasing the drag as the gravitational potential energy slowly converts to internal power to work done against friction.

Lateral Trajectory Control.
e lateral trajectory consists of the roll and yaw motions, which have been considered in the controller design. L1 guidance is well known for its simplicity in tracking circular and linear motions typical for fixed-wing vehicles' flight plans. However, the law has a specific ADRC effect in curve tracking, which is introduced for circular trajectory tracking, as shown in Figure 20. Under this section, the controller design is presented along with simulated results and the profile of the flight data.
When the UAV moves laterally, the roll angle is not zero, resulting in lift tilt and lateral acceleration as expressed by the following equation:   Mathematical Problems in Engineering where a s cmd is the acceleration command, L 1 is the distance between the reference point and the UAV, which is a fixed value, and η is the angle from the ground speed to the line L 1 . Meanwhile, the velocity direction change due to the acceleration can be expressed as Based on the equations (33) and (35), we can get Vc/L 1 , and c � ���������� � 1 − (L 1 /2R) 2 . e undamped natural frequency is determined by V and L 1 : e period and damping ratio are taken as the control parameters of the control law and L 1 as a variable proportional to the flight speed [31]. e lateral acceleration is provided by the lateral component of the lift force during the rolling of the UAV as a s cmd � g · tanϕ.
(38) e roll angle command can be expressed as L1 control structure diagram shown in Figure 21 is designed based on the following equation: Mathematical Problems in Engineering where K x � ω 2 n � 4π 2 /T 2 , K v � 2ζω n � 4πζ/T, and R is the radius of the tracked circular arc.
(1) Tracking Simulation. A nonlinear model in Matlab/ Simulink environment has been adopted to carry out the circular trajectory tracking simulation. Given the L1 guidance law parameters period damping ζ � 0.707, the simulation data at different periods T, as shown in Figures 22 and 23.
It can be seen from Figures 22 and 23, with the decrease of the period T, the response time of the lateral deviation distance and yaw angle error, that the error rapidly narrows, and the steady-state error of the lateral deviation distance decreases accordingly. In contrast, the yaw angle error fluctuates significantly. Reducing the period T will make the system response faster and the control effect more practical. A smaller value of the period T will lead to more aggressive navigation or sharper corners, while a more considerable value will lead to gentler navigation. Meanwhile, considering the safety and control rapidity in the UAV operation, the value of T is selected here as equal to 20 s.
Setting ζ � 0.707 and T � 20 s simulation initial state V t � 30m/s, constant wind disturbances in the north direction and east direction are added U � 5m/s and V � 5m/s. Track a circular trajectory with a radius of 600 m (R � 600 m). e velocity profile with wind disturbances is shown in Figure 24. e tracking effect is shown in Figures 25 and 26.
As shown in Figure 24, the crosswind with 5 m/s has been simulated.
Simulation results show that the lateral deviation distance can be controlled at ±3 m precision, while the yaw angle error is ±0.5°, which offers a good effect of the circular trajectory tracking. Figures 27 and 28 show the simulation of circular track tracking in a windless environment. Setting ζ � 0.707 and T � 20s, initial state V t � 30m/s, track a circular trajectory with a radius of 600 m. e lateral deviation distance is controlled at − 1 m, while the yaw angle error is 0.4°, which shows a good effect of circular trajectory tracking without wind disturbance.
(2) Flight Data Profile. e UAV tracks a circle with a radius of R � 450 m, and the center of the circle is located at longitude: 100.23°, latitude: 41.01°, the tracking effect is shown in Figure 29.
Under the constant wind disturbance of 7 m/s (direction 184), airspeed values vary from 30 m/s to 37 m/s, as shown in Figure 30.
e value of the lateral deviation distance is between 0 and − 4 m (shown in Figure 31), which means the UAV keeps on the left of the desired circular path. e yaw angle error can be controlled at ±3°(shown in Figure 32), larger than the value obtained by simulation. It is affected by crosswind to some extent, but the overall tracking effect is relatively good.

10
Mathematical Problems in Engineering For the SD-40, L1 guidance law enhances the circular trajectory tracking control ability and the ability to resist wind, using the insensitive period and damping parameters. is law can calculate different expected accelerations according to different speeds V and offers good adaptability to different usual flight speeds and interference of ambient wind in actual flight. Furthermore, L1 guidance law can track irregular curves and be extended to more advanced trajectory algorithms, including obstacle avoidance flight and formation flight. In all these four cases, a triaxial attitude angle information and geomagnetic course information are invalid. e control method is the same in all the four cases because it is designed to deal with this information invalidation. In this study, we intend to propose a general solution for this information invalidation. e traditional attitude angle control technology is no longer applicable, and the control law based on the angular rate is needed [32]. Sound signals for flight controllers are UAV's position information, track angle, and ground speed provided by GPS; airspeed, atmospheric altitude, and rate of change information supplied by atmospheric pressure sensor; triaxial acceleration and triaxial angular rate provided by AHRS. e emergency controller design looked at the longitudinal and lateral control of the UAV.

Longitudinal Control Law.
TECS can decouple the height control loop and the speed control loop of the longitudinal motion, while the latter has no attitude control loop but directly controls the engine's thrust. erefore, the speed control loop of TECS law can continue to be used. On the other hand, the height control law needs to be updated. e pitch control loop is used to stabilize the pitch attitude and serves as the inner loop of the height controller. Since there is no pitch angle feedback information, height control based on angular pitch rate is proposed. e reduced-order ESO model is used for the inner-loop angular rate control. e longitudinal controller structure is shown in Figure 33: where Q g is the given pitch angular rate and _ H is the vertical speed of the UAV. e outer loop height control output serves as the input to the inner-loop attitude angular rate control loop, which ultimately acts on the elevator. e UAV's initial state of the simulation: height is 100 m and speed is 30 m/s. When t � 1 s, the height command is changed toH g � 105 m. e vertical speed is obtained according to a specific proportional relation of the error between height and its command. When t � 1 s, there is a sudden change in the vertical speed command due to the considerable height error, but the vertical speed can track the command well and respond quickly ( Figure 34).
As shown in Figure 35, the value of the elevator energy is negative to enable the UAV to move upward, and when the new balance is reached, the energy value comes back to zero. e height step command is tracked without overshoot, and the response is quick (see Figure 36). In addition, by putting an integral part into the pitch angular rate control loop, the influence of external interference on the system can be easily neglected.

Lateral Control Law.
e structure of lateral roll angular rate control is similar to that of longitudinal pitch angular rate control. e turning control of UAV is realized by controlling the yaw angular rate. e outer track control loop outputs the roll angular rate command, which will be used as input to the inner loop of the roll to control the aileron deflection angle (see Figure 37 and equations (42) and (43)): where P g is the roll angular rate command, R is the feedback of yaw angular rate, and Psi is the feedback of the track azimuth, which can be provided by GPS. As shown in Figure 38, the track azimuth tracked the command well without overshoot. e yaw angular rate command needs to be optimized into a smooth transient profile (Figure 39), as the desired trajectory to allow the output to follow more closely.
It can be seen from Figures 40 and 41 that the proportion term plays a significant role in the roll angular rate control loop. In addition, simulation data show that when AHRS fails, the emergency control law without Euler Angle feedback can track the control instructions well and enable the UAV to make a crash landing or continue to perform the mission, improving flight safety.     14 Mathematical Problems in Engineering

Conclusion
In this paper, an aircraft flight mode controller for fixedwing UAVs with VTOL functions has been successfully designed where the SD-40 served as a reference. e controller design process starts by establishing linear and angular perspective, then proceeds with the design of flight controller. Controllers for the attitude, the trajectory, and emergency condition flight have been developed and tested through simulations in the MATLAB and SIMULINK environment. First, pitch and roll channel controllers have been designed for attitude control. Next, the total energy control system, the extended state observer, and L1 guidance have been proposed for longitudinal and lateral control of fixed-wing UAV SD-40. An attitude controller based on the ESO has been proved to be effective from its anti-interference ability. e TECS is again proposed for the longitudinal height channel, while the L1 guidance law is used for lateral trajectory tracking. e controller and simulation data show that the controller effectively responds to the command and decouples the speed control and the track control while improving the curve tracking ability and the wind resistance ability. Finally, a controller based on angular rate has been proposed in emergency and simulation data to verify its effectiveness.

Data Availability
e data used to support the findings of this study are included within the article.

Conflicts of Interest
e authors declare that there are no conflicts of interest regarding the publication of this paper.

Authors' Contributions
Deng Zhao performed the study, collected the data, and wrote the manuscript. Professor Wu conceived the idea of the study and designed the study. Professor You conceived the idea of the study and provided equipment and instruments for the research. All authors contributed to analyze the data and revisions.