Real-Time Hovering Control of Unmanned Aerial Vehicles

In this paper, the design of a controller for the altitude and rotational dynamics is presented. In particular, the control problem is to maintain a desired altitude in a ﬁxed position. The unmanned aerial vehicle dynamics are described by nonlinear equations, derived using the Newton–Euler approach. The control problem is solved imposing the stability of the error dynamics with respect to desired position and angular references. The performance and eﬀectiveness of the proposed control are tested, ﬁrst, via numerical simulations, using the Pixhawk Pilot Support Package simulator provided by Mathworks. Then, the controller is tested via a real-time implementation, using a quadrotor Aircraft F-450.


Introduction
Quadrotors have recently attracted the attention of many researchers due to their interesting applications. As a matter of fact, the potential applications of such devices are countless. Examples of such applications include searching and surveillance, monitoring, and rescuing tasks. From a methodological point of view, the interest relies on the fact that a quadrotor is a complex underactuated system with high nonlinearities and strong dynamical couplings. Furthermore, it is affected by aerodynamic disturbances, unmodeled dynamics, and parametric uncertainties. erefore, the quadrotors represent an interesting testbed for testing new control techniques.
ere are a large number of works dealing with quadrotors. As far as the mathematical model is concerned, in Bouabdallah et al. [1], Zeng and Zhao [2], and Nagaty et al. [3], a Newton-Euler model was presented. Furthermore, Magnussen et al. [4] and Valenti et al. [5] considered quaternions to describe the angular kinematics, whilst Antonio-Toledo et al. [6] applied the Euler-Lagrange equations to obtain the whole quadrotor mathematical model. Regarding the control of quadrotors, many control techniques have been proposed. In Panomruttanarug et al. [7] and Pounds et al. [8], the linear quadratic regulator control and the proportional integral derivative control, respectively, were exploited to design a control law. However, these controllers ensure only local stability. In order to enlarge the basin of attraction, nonlinear control techniques have also been considered. Examples are sliding model control Luque-Vega et al. [9], backstepping Bouabdallah and Siegwart [10], and adaptive control Matouk et al. [11]. Moreover, a global fast dynamic terminal sliding mode control method was proposed for position and attitude tracking control in Xiong and Zhang [12]. An adaptive command filtered backstepping control law was designed for trajectory tracking in Choi and Ahn [13]. In Liu et al. [14], a robust adaptive attitude tracking control for a quadrotor with an unknown inertia matrix and bounded external disturbances was proposed. A command filtered implementation of an adaptive backstepping was proposed in Dong et al. [15], and the stability of the closed loop system was proved via the Lyapunov direct method. Finally, in Islam et al. [16], an observer-based adaptive fuzzy backstepping controller was designed for trajectory tracking, in the case of a quadrotor undergoing wind gusts and with parametric uncertainties. All these aforementioned methods provide good dynamic performance and robust stability and are tested mainly considering numerical simulations. e main contribution of this paper is the design of a controller for the attitude and altitude of a quadrotor helicopter.
is controller has been designed using the backstepping technique and has been tested using numerical simulations and real-time experimentation. In particular, the focus of this paper is to obtain a controller ensuring hovering so that (1) e reference attitude is zero for the Euler angles describing the quadrotor angular position (2) e reference altitude is a constant value e performance and effectiveness of the proposed controller has been first tested with numerical simulations using the Pixhawk Pilot Support Package (PSP). en, the real-time implementation has been performed implementing the proposed controller on a real F-450 quadrotor equipped of a Pixhawk and tested under environmental perturbations. e paper is organized as follows. Section 2 introduces the description and the mathematical model of the quadrotor. In Section 3, the control problem is solved. In Section 4, numerical simulations and real-time tests are provided to show the effectiveness of the proposed controller. Finally, some concluding remarks are commented in Section 5.

Mathematical Model
e quadrotor considered in this work consists of a rigid frame equipped with four rotors. e rotors generate the propeller force F i � bω 2 p,i , proportional to the propeller angular velocity ω p,i , i � 1, 2, 3, 4. e propellers 1 and 3 rotate counterclockwise, and the propellers 2 and 4 rotate clockwise.
Denote RC(O, e 1 , e 2 , e 3 ) and RΓ(Ω, ε 1 , ε 2 , ε 3 ) as the frames fixed with the Earth and the quadrotor, respectively, with Ω coincident with the center of mass of the quadrotor (see Figure 1). e quadrotor absolute position in RC is described by p � (x, y, z) T , whereas its attitude is described by the Euler angles α � (ϕ, θ, ψ) T , where ϕ, θ, ψ ∈ (−π/2n, qπh/2) are the pitch, roll, and yaw angles, respectively. e sequence 3-2-1 has been considered by Huges [17]. Moreover, v � (v 1 , v 2 , v 3 ) T and ω � (ω 1 , ω 2 , ω 3 ) T are the linear and angular velocities of the center of mass of the quadrotor, expressed in RC and in RΓ, respectively. e translation dynamics (in RC) and rotation dynamics (in the RΓ) of the quadrotor are where m is the mass of the quadrotor, J is the inertia matrix of the quadrotor, and J � diag J x , J y , J z (expressed in RΓ), and is the so-called dyadic representation of ω, are the forces and moments produced by the propellers (inputs), with l as the distance between the center of mass to the rotor shaft. Moreover, F grav � 0 0 −mg T is the force due to the gravity expressed in RC. e vectors expressed in RΓ are transformed into vectors in RC by the rotation matrix: Figure 1: Quadrotor orientation using Euler angles.

Mathematical Problems in Engineering
with c c � cos(c), s c � sin(c), and c � ϕ, θ, ψ. e angular velocity dynamics are expressed using the matrix: with tg c � tan(c) and sc c � sec(c). e rolling torque τ 1 is produced by the forces F 2 and F 4 . Similarly, the pitching torque τ 2 is produced by the forces F 1 and F 3 . Due to Newton's third law, the propellers produce a yawing torque τ 3 on the body of the quadrotor, in the opposite direction of the propeller rotation. Moreover, is the gyroscopic torque due to the propeller rotations, with J p the propeller moment of inertia with respect to its rotation axis. Finally, F d and M d are the forces and torques due to the external disturbances, which are assumed negligible here.
Under the assumption of small angles, matrix M(α) reduces to the identity matrix. is assumption is justified by the fact that the control objective is to maintain the quadrotor in an hover position Nagaty et al. [3]. is leads to a simplified mathematical model of the quadrotor given by where the control variables are defined as where l is the distance of the center of mass to the rotor shaft, c is the drag factor, and ω p � ω p,1 − ω p,2 + ω p,3 − ω p,4 is the so-called rotor relative speed. e parameters used in (7) and their values are defined in Table 1.

Attitude Control.
To design the attitude control law, let us define the following variables: so that system (7) can be rewritten as where X � (ϕ 1 , ϕ 2 , θ 1 , θ 2 , ψ 1 , ψ 2 ) are the measured signals. e control objective is to match the UAV attitude X to a desired reference: To this aim, let us define the tracking errors as with k 1 , k 3 , k 5 > 0. Note that e j,1 � 0 implies e j,2 � 0, j � ϕ, θ, ψ. Deriving the error system (12) with respect to (10) is possible to calculate the error dynamics: Mathematical Problems in Engineering with gains k i > 0, i � 2, 4, 6 in (13), the tracking error dynamics become where e X � e ϕ 1 e ϕ 2 e θ 1 e θ 2 e ψ 1 e ψ 2 T , which converge exponentially to zero. In fact, considering the Lyapunov candidate and differentiating along the error dynamics (15), one obtains with P X solution of the equation so that the tracking error converges globally exponentially to zero [19].

Altitude Control.
For the altitude control, let us consider the altitude dynamics: e control problem is to maintain the quadrotor at a desired constant altitude z 1,ref , z 2,ref � 0. e tracking errors are defined as Choosing with k z,1 , k z,2 > 0, we obtain where e z � (e z,1 , e z.2 ) T and e stability proof is similar to that of the previous section.

Simulation and Experimental Results
In this section, the performance of the attitude and altitude controllers (14) and (21) is tested considering an F-450 quadrotor. First, numerical simulations are carried out.
en, real-time experimental tests are performed, showing the effectiveness of the control design.

Simulation Results.
For the numerical simulations, the quadrotor model provided by the Pixhawk PSP, in Simulink, has been used. is model contains the attitude and altitude flight control model called px4 demo attitude control, which shows a good performance in predicting the dynamic quadrotor behavior, very close to the real drone dynamics.
Controllers (14) and (21) use the nominal values of Table 1 and the gains of Table 2. e simulations have been performed in two steps. In the first one, the quadrotor is stabilized in altitude. In Figure 2, the altitude z is shown. In the second step, the quadrotor is stabilized in attitude. e pitch, roll, and yaw angles are shown in Figure 3. e initial conditions considered are z(0) � 0, ϕ(0) � −5.73°, θ(0) � 5.73°, and ψ(0) � 5.73°.
e reference values are

Experimental Results.
In this section, we describe the physical setting of the embedded control that allows stabilizing the quadrotor. An embedded control system generally consists of three elements: sensors, actuators, and a microcontroller. e microcontroller interacts with the continuous dynamics of the plant via the sensors and actuators, and its major function is to compute and generate control commands for the actuators that are based on sensor measurements. e onboard electronic system consists of a flight controller, a hardware setup, and some ultrasonic sensors.

Flight Controller.
e 3DR-PIXHAWK is a highperformance autopilot-on-module suitable for fixed wing, multi rotors, helicopters, cars, boats, and other mobile robotic platforms. Its processor can run to 168 MHz/252 MIPS

Hardware Setup.
e structure of the quadrotor is composed by an F-450 frame with integrated PCB wiring, whereas the rotors are brushless motors manufactured by E-max, with 935 rpm/V and a 10 × 4.5″ propellers. Turnigy speed drivers (ESC) are BHC type at 18 A max. e battery used in this setup is a 3S, 2800 mAh, 25C. e radio-transmitter is a Turnigy with 9 PPM channels working at 2.4 GHz.
An LV-MaxSonar-EZ4 sensor with a resolution of 2.54 cm, 20 Hz reading rate, 42 kHz ultrasonic sensor measures, a maximum Range of 645 cm, operating in the range of 2.5-5.5 VDC was used to measure the altitude.
For the real-time running, the same parameter values and gains shown in Table 2 were used. e initial condition for the altitude was z(0) � 2.16 m. For the pitch, roll, and yaw angles, the initial condition were chosen at ϕ 1 (0) � 1.6°, θ 1 (0) � 0.9°, and ψ 1 (0) � −1.6°. Figures 4 and 5 show the dynamic behavior of the altitude and the pitch, roll, and yaw angles, respectively. It is worth noticing that these     experimental tests were performed in an outdoor environment, without using the GPS sensor.

Conclusions
In this paper, a controller based on the stabilization technique for the altitude and attitude error has been proposed for a quadrotor. e simulation results have been performed using the Pixhawk PSP. en, the controller has been implemented on a laboratory quadrotor. e simulation and experimental results show a good performance, even in outdoor environment, showing some degree of robustness in the presence of environmental disturbances.
Data Availability e figures, tables, and other data used to support 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. Mathematical Problems in Engineering 7