Jtam-A4.dvi JOURNAL OF THEORETICAL AND APPLIED MECHANICS 51, 3, pp. 751-761, Warsaw 2013 ROBUST CONTROL OF THE MICRO UAV DYNAMICS WITH AN AUTOPILOT Arkadiusz Mystkowski Białystok University of Technology, Bialystok, Poland e-mail: a.mystkowski@pb.edu.pl This paper presents a nonlinear robust control design procedure for a micro air vehicle, which uses the singular value (µ) and µ-synthesis technique. The optimal robust control law that combines parametric and lumped uncertainties of themicroUAV(unmanned aerial vehicle) which are realized by serial connection of the Kestrel autopilot and the Gumstix microprocessor. Thus, the robust control feedback loops, which handle the uncertainty of aerodynamics derivatives, are used to ensure the robust stability of theUAV local dynamics in longitudinal and lateral control directions. Key words: robust optimal control, mu-synthesis, uncertainty design, micro aerial vehicle, autopilot 1. Introduction The control of dynamics of small air vehicles requires overcoming many characteristic features that are specific to these flying aircraft such as open-loop instability, very fast dynamics, nonli- near behaviour andhigh degree of coupling amongdifferent state vector elements. Thedynamics of amicro aircraft has an uncertainty effect that causes variability of themodel dynamics during the flight phases. The most sensitive are aerodynamics derivatives which change the micro air vehiclemodel.Most initial attempts to achieve stable autonomous flight have beenbased onPID controller design. Many commercial autopilots such as Procerus’s Kestrel [11] or Micropilot’s MP2128 [6] are based on PID controllers. Themain advantage of PID control is that controller parametersmaybe easily adjustedwhen themodel is not exactly known.This is a cheap and fast technique, where the PID controller parameters can be tuned on-line during the test flight. Ho- wever, in spite of such advantages, the PID control method does not perfectly follow the system dynamics because of uncertainty in the aircraft dynamical forces and moments. Furthermore, the PID controllers are of the SISO type. It is assumed that controlled states are not strongly coupled. In the paper, the robust optimal nonlinear control law that combines parametric and lumped uncertainties of the micro UAV (unmanned aerial vehicle) is investigated. The robust control feedback loops are used to ensure the robust stability of the UAV local dynamics in longitu- dinal and lateral control directions. The µ-synthesis robust control algorithms are calculated by using the robust control toolbox Matlab and optimized via fixed-point arithmetics [5]. The µ-synthesis controllers are of a high order, thus the real realization of the control code needs a powerful microprocessor. The considered micro air vehicle is supported with commercial, small Kestrel autopilot [11]. The Kestrel system includes software and control libraries. Meanwhile, this autopilot is not able to properly run such a high order control algorithms. Therefore, the optimized control algorithms in C++ language were implemented in the Gumstix Verdex Pro single-board microcomputer [14]. Then, the Gumstix was integrated with the autopilot to take control of the micro aerial vehicle (MAV) local dynamics. The micro aerial vehicle (MAV) ba- sed on single-delta wing configuration (BULLIT)with theKestrel autopilot connected with the 752 A.Mystkowski external microcomputer was used as a control system. By using serial connection of the Kestrel autopilot supported by software codes and Gumstix microprocessor, the local control loops of the Kestrel are switched off and the external processor takes control of the micro plane. The way-point global control loop andKalmanfilters of flight signals are realized by theKestrel auto- pilot and are not investigated here. The hardware in the loop simulations results were presented due to tested robust control algorithms with using the real micro air vehicle with the Kestrel autopilot and Gumstix microprocessor. The developed controllers were proved to be efficient. The hardware-in-the-loop simulations results were presented due to tested robust control algorithms with using the real micro aerial vehicle. The developed controllers proved to be efficient. 2. The BULLIT Themicro air vehicle (MAV) examined in this paper as the control plant is called BULLIT [15]. The single-delta wing MAV is equipped with the Kestrel autopilot and Gumstix Verdex Pro microprocessor electronics. ThemainMAVdata are: wingspan of 0.84m,weight “ready to flight status” 1.3kg and the chord length of theNACA0012modification profile of 0.57m.The control is accomplished using a set of aileron and elevator control surfaces. Thus, the airplane control system allows one to control the lateral-directional and longitudinal-directional dynamics. The full model has three control inputs: aileron, elevator and throttle. The aileron and elevator controls are realized by the Gumstix microprocessor, and the throttle control is evaluated by the Kestrel autopilot. The geometry data, model of motion and aerodynamics derivatives are provided byMystkowski (2012a,b). The measured outputs are the MAV states due to the body frame coordinates (X,Y,Z) (Fig. 1), and in the case of the lateral-directional control are: roll, roll rate, yaw rate and lateral velocity. Therefore, the state vector consists of (u,w,q,θ,h), where: u – velocity along X [m/s], w – velocity along Z [m/s], q – pitch rate [rad/s], θ – pitch angle [rad], and h – altitude [m]. The lateral state vector is given by (v,p,r,φ), where: v – velocity along Y [m/s], p – roll rate [rad/s], r – yaw rate [rad/s], and φ – roll angle [rad]. Fig. 1. BULLIT with Kestrel autopilot andGumstix microprocessor – during assembling 3. Sensitivities of micro UAV Theaerodynamics of themicro unmannedaerial vehicles are usually determinedusing a low spe- ed free-stream velocity of 10-20m/s and the Reynolds number of 10000-100000. The Reynolds Robust control of the micro UAV dynamics with an autopilot 753 number, small size of geometry and low weight causes the vehicle model extremely difficult to identify. The micro wings-level study to consider, e.g. sweeps across the angle of attack and/or angle of sideslip are often poor in facility. The computation of static derivatives in the pitch, roll and yaw does not allow one to predict the derivatives variations.Moreover, the variations of the UAV forces and moments with respect to the time rates of change of the angle of attack and angle of sideslip can not be estimated. Consequently, the UAV measured data obtained in the wind tunnel is not sufficient to completely characterize the UAV flight dynamical model. Thus, the facility did not allow one to estimate the dynamical derivatives. In the paper, the wind tunnel data and numerical calculations performed for BULLIT de- noted some anomalies in aerodynamics. The experimental measurements were performed in an open-wind tunnel (Mystkowski and Ostapkowicz, 2011). The aerodynamics numerical compu- tations were performed in the Tornado-Matlab and the XFLR5 software by using the Vortex Lattice Method (Gordnier, 2009; [10], [12]). These analyses assume incompressible and not vi- scid flow, which generate some errors in the resulting solution. A set of static and dynamic lateral/longitudinal derivatives are calculated at a given flight condition presented inTable 4. In particular, the lift/drag coefficients due to angle of attack derived in wind tunnel do not agree with the simulation results (see Figs. 2a,b). Fig. 2. (a) Lift coefficient, (b) drag coefficient ThemicroUAVs are characterized by their instability and nonlinearity, e.g. turbulence flow, air vortex along lifting surfaces, low stall speed, high sensitivity to external flight disturbances andmore. Also, the variations of the UAV forces andmoments with respect to flight conditions are difficult to predict. Therefore, to include these properties, some tools of the robust optimal method with a structural singular value are used (Zhou et al., 1996; Zhou andDoyle, 1998). The structure of the micro UAV model (including the order) is usually known, but some of the parameters may be uncertain (Aguiar and Hespanha, 2007). The UAV model is in error because of missing dynamics. It is caused by unmodeled or neglected dynamics, usually at high frequencies.TheUAVmodel is nonlinear, thus, the poormodel accuracy is caused byunmodeled physical air-flowprocesses.Thedescriptionof theseparameters/modelperturbations ispresented here anddenotedas aparametric and lumpeduncertainty.Theuncertainty analysis allows one to determine theUAVuncertaintymodel. Then, the uncertaintymodel of theUAV local dynamics is handled by using the µ-synthesis control (Balas et al., 1991; Zhou et al., 1996). 3.1. Parametric uncertainty In this section, the stability test of the nominally stable UAV local dynamics under parameter variations, is considered. The UAV dynamical parameters, which are not stationary, are formu- lated and called here as parametric uncertainties. The parametric uncertainty means that the structure of the UAV model is known, but some parameters are uncertain. The uncertainties 754 A.Mystkowski of the UAV selected parameters are introduced/joined into the UAV model during the design of the µ-synthesis controller. The basis for the robust stability criteria for the UAV uncertain system is the so-called small gain theorem (Zhou and Doyle, 1998). Based on the small gain theorem, for the internal family P(s) of strictly proper control plants (where C(s) is the stabilizing controller) the closed-loop system can be stable for all perturbations of control plant (denoted here as ∆P(s)) such that ‖∆P(s)‖ ∞ <γ ⇐⇒ sup ∥ ∥ ∥ [1+P(s)C(s)]−1C(s) ∥ ∥ ∥ ∞ <γ−1 (3.1) where γ is a positive constant coefficient that is equivalent to the largest singular value of the uncertainty matrix (introduced in 3.2). Equation (3.1) can be rewritten in the form ∀∆∈ RH ∞ where ‖W−1∆ ∆‖∞ < 1 if ‖W∆f(P,C)‖∞ ¬ 1 (3.2) where ∆ is the uncertainty (bounded perturbation), H ∞ – frequency H-infinity norm, W∆ – boundary function (uncertainty shaping function), f(P,C) – closed-loop function, C – robust stabilizing controller and P – augmented control plant (including a nominal model and uncertainties). Suppose M(s)=W∆f(P,C) and M ∈ RH∞, then the UAV dynamics system is well posed and internally stable for all ∆(s)∈ R or ∆(s)∈ RH ∞ or ∆(s)∈ Cqxp with ‖∆‖ ∞ ¬ γ−1 ⇐⇒ ‖M(s)‖ ∞ <γ (3.3) Meanwhile, for a good representation of the actual UAV local roll/pitch-axes dynamics by the nominalmodel P0, theuncertaintymodel ∆ shouldbeas small as possible.TheUAV“real/true” parameters Ki consist of the nominal values Ki0 and their parametric uncertainties δi and are given in the following form Ki =Ki0+W∆iδi for |δi| ¬ 1 (3.4) In this paper, only theUAVderivatives (parametric) uncertainties are investigated. Meanwhile, the prediction of these variability is highly challenging. The prediction uncertainty ranges (the UAV derivatives accuracy) for the longitudinal and lateral selected derivatives are shown in Table 1. 3.2. Lumped uncertainty The lumped uncertainty represents one or more sources of the unmodelled dynamics and/or parametric uncertainty combined into a single lumped perturbation given in Fig. 3. Figure 3 presents the single channel µ-synthesis control loop for the UAV local dynamics. Theweighting functions We, . . . ,Wy are explained inMystkowski (2012a,b). The uncertainty here was introduced to the nominal UAV model in the multiplicative way. The structuredmultiplicative uncertainty ∆M for the nominal controlmodel P0 and the “true” augmented model P is given by Zhou and Doyle (1998) |∆M(jω)|= |P(jω)−P0(jω)| P0(jω) (3.5) where |∆M(jω)| ¬ 1 ∀ω ⇒ ‖∆M‖∞ ¬ 1 (3.6) Robust control of the micro UAV dynamics with an autopilot 755 Table 1.BULLIT derivatives – nominal values and their uncertainties Longitudinal Nominal Uncertainty Lateral Nominal Uncertainty derivatives value [±%] derivatives value [±%] CLα 2.61100 5 CYβ −0.20707 10 CDα 0.14762 5 Clβ 0.04342 10 Cmα −0.71274 5 Cnβ −0.05729 10 CLu 0.10230 30 CYP 0.10814 20 CDu 0.02860 30 ClP −0.14521 20 Cmu 0.03270 30 CnP 0.02744 20 CLQ 4.34620 30 CYR −0.13474 10 CDQ 0.22854 30 ClR 0.02744 10 CmQ −1.83640 30 CnR −0.03765 10 Longitudinal Nominal value Uncertainty [±%] Lateral Nominal value Uncertainty [±%] control control derivatives derivatives CLδe 1.11110 5 CYδa −0.05213 1 CDδe 0.05939 0 Clδa 0.12987 5 Cmδe −0.68376 5 Cnδa −0.01192 5 Fig. 3. Single channel µ-synthesis control loop The structural singular value (denoted SSV or µ) is a function which provides a generalization of the singular value and its upper bound σ. The µ is used to determine the robust stability and robust performance of theUAVdynamics. The definition of µ is given by (Zhou andDoyle, 1998) µ(M) := 1 min{σ(∆) : ∆∈∆, det(I−M∆) = 0 (3.7) Then, the uncertainty is limited by bound σ (M(jω))<µ (3.8) The UAV dynamics model uncertainty data are collected in Table 2. The some plots resulting from the combination of ∆ and the uncertainty shaping function are presented in Fig. 4. 756 A.Mystkowski Table 2.Model uncertainty for pitch/roll control and pitch weights data Name Type Uncertainty type Structured/multiplicative Error dynamics gain across frequency (bound) < 1 Sample state dimension of error dynamics 5 UAVmodel uncertainty influence 10% up to 10Hz and 100% over 10Hz Uncertainty shaping function model: W∆(s)= s+ω∆M −1 ∆ e∆s+ω∆ gain –M∆ =10, cut-off frequency – ω∆ =10 ·2pi, bound – e∆ =0.5 Pitch uncertainty weight W∆(s)= s+6.283 0.5s+62.83 Pitch error signal weight We(s)= 0.2941s+62.83 s+0.6283 Pitch control signal weight Wu(s)= 1 Measured signal weight Wy(s)= 6672 s2+98.02s+6672 Pitch actuator weight Wa(s)= 0.3491s s+0.3491 Fig. 4. Bode plot of UAV perturbations and uncertainty weight 4. Robust control system data In order to design the µ-synthesis controllers for theUAVdynamics, the robust stability perfor- mances shouldbedeterminedbyusing theweighting functions.The selected robustperformances of the UAV control model are presented in Table 3. TheUAVnominal model data is denoted here as the nominal state, and is given in Table 4. 5. The µ-synthesis decoupled control model The dynamics of the UAV/MAV was decoupled due to the control axis, and the late- ral/longitudinal single channel flight controllers are designed (see scheme, Fig. 6). Therefore, the µ-synthesis controllers are simplified to SISO models. The lateral and longitudinal dyna- mics of the aileron and elevator vectors of the MAV are considered due to the state vector described in Section 2. Robust control of the micro UAV dynamics with an autopilot 757 Table 3.Robust performances of the UAV µ-synthesis control system Parameter Nominal Upper/lower value limits Error signal pitch/roll – ±0.34rad Command signal pitch/roll – ±0.30rad Estimated roll/pitch – ±3.14rad We function slope −2 Wu andWy function slope +2 Cut-off frequency for command signal (Gumstix serial port) 10Hz Cut-off frequency for command signal (Kestrel local loops) 50Hz Aileron/elevator deflection rate – 0.69rad/s Aileron/elevator deflection – ±0.34rad Table 4.BULLIT, the nominal state Parameter Nominal value Parameter Nominal value UAV total mass 1.270kg Wingspan 0.840m Air speed 15m/s Wing chord 0.570m Altitude 100m Outer chord 0.135m Trim angle of attack 0.087rad Area of the wing 0.296m2 Trim sideslip angle 0rad Area of the propeller 0.033m2 Trim pitch angle 0rad Taper ratio 0.236 Inertia moments: 0.0184/0.0367/0.0550 MAC 0.397m Ixx/Iyy/Izz/Izx/Ixy/Iyz /−0.00021/0/0kgm 2 Fig. 5. DecoupledMAV I/O control model The µ-synthesis control method enables the design of a multivariable optimal robust con- troller for complex linear systems with any type of uncertainties in their structure (Balas et al., 1991; Valavanis, 2007; Zhou et al., 1996; Zhou and Doyle, 1998). The µ-synthesis controllers were calculated by using the tools of Robust Control ToolboxTM of Matlab [5]. The command dksyn allows one to perform the synthesis and set the frequency grid used for the µ-synthesis. The µ-controller is calculated during the recurrence algorithm, which seeks a matrix D, until the following condition is met (Zhou and Doyle, 1998) ‖DTy1u1D −1‖ ∞ ¬ 1 (5.1) where: D= diag ( d1(s)Ik1, . . . ,dn(s)Ikn ) , and Ty1u1 – closed loop function. The µ-controller optimizes the following cost function (Zhou and Doyle, 1998) µ= min D(jω) σ ( D(jω)Ty1u1(jω)D −1(jω) ) (5.2) The µ-controller synthesized for the augmented plant model P must meet the analysis objectives presented by themaximal singular value µ (see Section 3.2). The control structure of 758 A.Mystkowski the UAV with the Kestrel autopilot, serial communication, external processor, and the robust controller, is presented in Fig. 6. Fig. 6. Basic cascade µ-synthesis control structure 6. The µ-synthesis algorithm implementation in Gumstix microcomputer The µ-synthesis controllers for lateral and longitudinal (pitch/roll only) control feedback-loops are of the 6th order. In order to implement the robust optimal controller in the Gumstixmicro- processor, the control algorithm shouldbe realized using thedigital representationwith thefixed sample period T . The discrete timemodels of the µ-synthesis and their coefficients bn/am were found using a difference equation method (Burns, 2001). In this method, all of the subsequent differentials of the control signal u(t) and the error signal e(t) were discretized for the i-th time step by using a well known formulae du dt ≈ u(i)−u(i−1) T (6.1) The frequency of packet data flow between the Kestrel autopilot and Gumstix was 10Hz. The- refore, the robust control algorithms were discretized with the sample time which equals 0.1s. These algorithms are written in form of the Z transform as u0 ei (z)= b0+ b1z −1+ . . .+ b6z −6 1+a0+a1z −1+ . . .+a6z −6 (6.2) Equation (6.2) can be presented as amicroprocessor implementation (for the k-th time step) in the form u0(kT)=−a1u0(k−1)T−. . .−a6u0(k−6)T+b0ei(kT)+b1ei(k−1)T+. . .+b6ei(k−6)T (6.3) The structures of aileron and elevator control loops for the UAV (by using a serial connection between the Kestrel autopilot and Gumstix processor) are presented in Figs. 7 and 8. 7. Hardware in the loop results The hardware in the loop simulation uses a real aircraft with an autopilot where the flight environment is simulated [11]. This software and hardware connection enables one to verify the control strategy. The hardware communication block diagram for normal flight (wireless) and during the simulation state (serial cable connection) are given in Figs. 9 and 10. TheHIL simulation uses the Aviones software to simulate the flight conditions and environ- ment [11]. In order to increase themodel accuracy simulated in the Aviones, somemodification have beenmade to theAviones configurationfiles.The results of the roll/pitch upmanoeuver are Robust control of the micro UAV dynamics with an autopilot 759 Fig. 7. Gumstix-Kestrel aileron µ-synthesis control feedback loop Fig. 8. Gumstix-Kestrel elevator µ-synthesis control feedback loop shown in Figs. 11 and 12. The state was recorded by the logger of the flight/telemetry datawith the frequency of 5Hz. Figure 11 shows that the mu-controller hasmet the robust performances specs due to the UAV derivatives uncertainties. The measured roll angle follows the desired value, where the aileron stick control energy isminimalized. The overshot and control errors are limited due to simulated wind disturbances. The µ-synthesis control properties were compared with the PID control. The PID control algorithm was tested as originally implemented by the Lockheed Martin Procerus in Kestrel autopilot. As can be seen, the aileron stick signal during PID control has a bigger amplitude than the aileron stick signal generated by the µ-synthesis controller. For the µ-synthesis control the aileron deflection angle limit was set by theweighting functions. The two states (see Figs. 11 and 12), when the roll angle equals to 29◦, were recorded during the UAV aileron commands. However, in Fig. 11, there is some delay introduced by the serial connection of Gumstix andKestrel autopilot. This delay is forced by the low frequency of the data packet exchange which is limited to 10Hz. 760 A.Mystkowski Fig. 9. Communication during normal flight Fig. 10. Communication during HIL Fig. 11. HIL, µ-synthesis roll control Fig. 12. HIL, PID roll control 8. Summary and conclusion The very short specifications of the BULLIT UAV are introduced in the first Section. Next, the UAV parameters variations are presented as the uncertainty models. The lumped UAV uncertainty was investigated and introduced to the control loop in a multiplicative way. The robust control system structure with weighting functions, which are used to meet the robust Robust control of the micro UAV dynamics with an autopilot 761 performances, is presented. Then, the robust control system data for the micro UAV are given. Next, the µ-synthesis decoupled control design and digital implementation are performed for the uncertain model of the UAV. Finally, the control feedback loop structure and results of the hardware in the loop tests are shown and commented. The longitudinal/lateral-directional control loops of the UAVuse the decoupled µ-synthesis control law.The µ-synthesis controllerswere performed to check if the specs can bemet robustly when taking into account the uncertainty ∆. These controllers can keep the closed-loop gain below µ = 0.89 for the specified parameters uncertainty. This indicatives that the robustness specs can be fully met for the family of the aircraft models. The design goal was to develop the “true” UAV model, for which the response to the longitudinal stick agrees well with the real response. References 1. AguiarA.P.,Hespanha J.P., 2007,Trajectory-trackingandpath-followingof underactuatedau- tonomous vehicles with parametricmodeling uncertainty, IEEE Tran. on Automation Conference, 52, 1362-1379 2. Balas G.J., Packard A.K., and J.T. Harduvel J.T., 1991, Application of µ-synthesis tech- niques to momentum management and attitude control of the space station, AIAA Guidance, Navigation and Control Conference, NewOrleans 3. Burns R.S., 2001,Advanced Control Engineering, Butterworth-Heinemann 4. GordnierR.E., 2009,High fidelity computational simulation of amembranewing airfoil,Journal of Fluids and Structures, 25, 897-917 5. Mathworks Inc., www.mathworks.com 6. Micropilot Inc., www.micro-pilot.com 7. MystkowskiA., 2012a,An application ofµ-synthesis to control of a small air vehicle – simulation results, Journal of Vibroengineering, 14, 1, 79-86 8. Mystkowski A., 2012b, The robust control of unmanned aerial vehicle, Research project report No, 0029/R/T00/2010/11, conducted in the years: 2010-2013 [in Polish] 9. Mystkowski A., Ostapkowicz P., 2011, Verification of MAV dynamics model with vortex piezo-generators to boundary flow control,Warsaw Inst. of Aviation, 216, 103-125 10. NASA, 1976,Vortex-lattice utilization, NASA SP-405, NASA-Langley,Washington 11. Procerus, Inc., www.procerus.com 12. Tornado 1.0, 2001,User Guide, Reference manual, Relase 2.3 13. Valavanis K.P., 2007,Advances in Unmanned Aerial Vehicles, State of the Art and the Road to Autonomy, Springer, 33 14. www.gumstix.com 15. www.topmodelcz.cz 16. Zhou K., Doyle J., 1998,Essentials of Robust Control, Prentice Hall 17. Zhou K., Doyle J.C., Glover K., 1996,Robust and Optimal Control, Prentice Hall Manuscript received May 29, 2012; accepted for print January 14, 2013