# Real-Time Hovering Control of Unmanned Aerial Vehicles

Authors: Cuauhtémoc Acosta Lúa; Claudia Carolina Vaca García; Stefano Di Gennaro; B. Castillo-Toledo; María Eugenia Sánchez Morales
Journal: Mathematical Problems in Engineering
 (2020)

---

## Abstract

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 fixed 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 effectiveness of the proposed control are tested, first, 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.


---

## Body

## 1. 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. Therefore, the quadrotors represent an interesting testbed for testing new control techniques.There 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.The main contribution of this paper is the design of a controller for the attitude and altitude of a quadrotor helicopter. This 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)
The reference attitude is zero for the Euler angles describing the quadrotor angular position(2)
The reference altitude is a constant valueThe performance and effectiveness of the proposed controller has been first tested with numerical simulations using the Pixhawk Pilot Support Package (PSP). Then, 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.The paper is organized as follows. Section2 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.


## 2. Mathematical Model

The quadrotor considered in this work consists of a rigid frame equipped with four rotors. The rotors generate the propeller forceFi=bωp,i2, proportional to the propeller angular velocity ωp,i, i=1,2,3,4. The propellers 1 and 3 rotate counterclockwise, and the propellers 2 and 4 rotate clockwise.DenoteRCO,e1,e2,e3 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). The quadrotor absolute position in RC is described by p=x,y,zT, whereas its attitude is described by the Euler angles α=ϕ,θ,ψT, where ϕ,θ,ψ∈−π/2,π/2 are the pitch, roll, and yaw angles, respectively. The sequence 3–2–1 has been considered by Huges [17]. Moreover, v=v1,v2,v3T and ω=ω1,ω2,ω3T are the linear and angular velocities of the center of mass of the quadrotor, expressed in RC and in RΓ, respectively.Figure 1
Quadrotor orientation using Euler angles.The translation dynamics (inRC) and rotation dynamics (in the RΓ) of the quadrotor are(1)p˙=v,v˙=1mℛαFprop+1mFgrav+1mFd,α˙=Mαω,ω˙=J−1−ω˜>Jω+τprop−τgyro+Md,where m is the mass of the quadrotor, J is the inertia matrix of the quadrotor, and J=diagJx,Jy,Jz (expressed in RΓ), and(2)ω˜=0−ω3ω2ω30−ω1−ω2ω10,is the so-called dyadic representation of ω,(3)Fprop=00∑i=14Fi,τprop=τ1τ2τ3=lF2−F4lF3−F1cF1−F2+F3−F4,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, Fgrav=00−mgT is the force due to the gravity expressed in RC.The vectors expressed inRΓ are transformed into vectors in RC by the rotation matrix:(4)ℛα=cθcψsϕsθcψ−cϕsψcϕsθcψ+sϕsψcθsψsϕsθsψ+cϕcψcϕsθsψ−sϕcψ−sθsϕcθcϕcθ,with cγ=cosγ, sγ=sinγ, and γ=ϕ,θ,ψ. The angular velocity dynamics are expressed using the matrix:(5)Mα=1sϕtgθcϕtgθ0cϕ−sϕ0sϕscθcϕscθ,with tgγ=tanγ and scγ=secγ.The rolling torqueτ1 is produced by the forces F2 and F4. Similarly, the pitching torque τ2 is produced by the forces F1 and F3. 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,(6)τgyro=∑i=14−1i+1Jpωpω˜ε3,is the gyroscopic torque due to the propeller rotations, with Jp the propeller moment of inertia with respect to its rotation axis. Finally, Fd and Md are the forces and torques due to the external disturbances, which are assumed negligible here.Under the assumption of small angles, matrixMα reduces to the identity matrix. This assumption is justified by the fact that the control objective is to maintain the quadrotor in an hover position Nagaty et al. [3]. This leads to a simplified mathematical model of the quadrotor given by(7)x¨=1mcϕsθcψ+sϕsψu1,y¨=1mcϕsθsψ−sϕcψu1,z¨=1mcϕcθu1−g,ϕ¨=Jy−JzJxθ˙ψ˙−JpJxωpθ˙+lJxτ1,θ¨=Jz−JxJyϕ˙ψ˙+JpJyωpϕ˙+lJyτ2,ψ¨=Jx−JyJzϕ˙θ˙+1Jzτ3,where the control variables are defined as(8)u1=∑i=14Fi,τ1=lF2−F4,τ2=lF3−F1,τ3=cF1+F3−F2−F4,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. The parameters used in (7) and their values are defined in Table 1.Table 1
Quadrotor parameters.
m
Mass of the airframe
1.1 kg
l
Distance of the center of mass to the rotor shaft
0.223 m
J
x
Inertia in thex-axis
6.825×10−3 kg m2
J
y
Inertia in they-axis
6.825×10−3 kg m2
J
z
Inertia in thez-axis
12.39×10−3 kg m2
J
p
Inertia of the propellers
6×10−5 kg m2
g
Gravity acceleration
9.81 m/s2
b
Thrust factor
54.2×10−6
c
Drag factor
1.1×10−6 N s2rad−2
ϕ
Roll angle
deg
θ
Pitch angle
deg
ψ
Yaw angle
deg
z
1
z-position
m


## 3. Control Design

### 3.1. Attitude Control

To design the attitude control law, let us define the following variables:(9)ϕ=ϕ1,θ=θ1,ψ=ψ1,ϕ˙=ϕ2,θ˙=θ2,ψ˙=ψ2,so that system (7) can be rewritten as(10)ϕ˙1=ϕ2,ϕ˙2=Jy−JzJxθ2ψ2−JpJxωpθ2+lJxτ1,θ˙1=θ2,θ˙2=Jz−JxJyϕ2ψ2+JpJyωpϕ2+lJyτ2,ψ˙1=ψ2,ψ˙2=Jx−JyJzϕ2θ2+1Jzτ3,where X=ϕ1,ϕ2,θ1,θ2,ψ1,ψ2 are the measured signals. The control objective is to match the UAV attitude X to a desired reference:(11)Xref=ϕ1,ref,ϕ2,ref,θ1,ref,θ2,ref,ψ1,ref,ψ2,ref.To this aim, let us define the tracking errors as(12)eϕ,1=ϕ1−ϕ1,ref,eϕ,2=ϕ2−ϕ2,ref+k1eϕ,1,eθ,1=θ1−θ1,ref,eθ,2=θ2−θ2,ref+k3eθ,1,eψ,1=ψ1−ψ1,ref,eψ,2=ψ2−ψ2,ref+k5eψ,1,with k1,k3,k5>0. Note that ej,1=0 implies ej,2=0, j=ϕ,θ,ψ. Deriving the error system (12) with respect to (10) is possible to calculate the error dynamics:(13)e˙ϕ,1=eϕ,2−k1eϕ,1−ϕ˙1,ref+ϕ2,ref,e˙ϕ,2=Jy−JzJxθ2ψ2−JpJxωpθ2+lJxτ1,−ϕ˙2,ref+k1eϕ,2−k1eϕ,1+ϕ2,ref−ϕ˙1,ref,e˙θ,1=eθ,2−k3eθ,1−θ˙1,ref+θ2,ref=eθ,2−k3eθ,1−θ˙1,ref+θ2,ref,e˙θ,2=Jz−JxJyϕ2ψ2+JpJyωpϕ2+lJyτ2,−θ˙2,ref+k3eθ,2−k3eθ,1+θ2,ref−θ˙1,ref,e˙ψ,1=eψ,2−k5eψ,2−ψ˙1,ref+ψ2,ref,e˙ψ,2=Jx−JyJzϕ2θ2+1Jzτ3−ψ˙2,ref+k5eψ,2−k5eψ,1+ψ2,ref−ψ˙1,ref.Using the following control law [18],(14)τ1=Jxl−Jy−JzJxθ2ψ2+JpJxωpθ2+ϕ˙2,ref−k1eϕ,2−k1eϕ,1+ϕ2,ref−ϕ˙1,ref−k2eϕ,2,τ2=Jyl−Jz−JxJyϕ2ψ2−JpJyωpϕ2+θ˙2,ref−k3eθ,2−k3eθ,1+θ2,ref−θ˙1,ref−k4eθ,2,τ3=Jz−Jx−JyJzϕ2θ2+ψ˙2,ref−k5eψ,2−k5eψ,1+ψ2,ref−ψ˙1,ref−k6eψ,2,with gains ki>0, i=2,4,6 in (13), the tracking error dynamics become(15)e˙X=e˙ϕ,1e˙ϕ,2e˙θ,1e˙θ,2e˙ψ,1e˙ψ,2=−k1100000−k2000000−k3100000−k4000000−k5100000−k6eϕ1eϕ2eθ1eθ2eψ1eψ2=AXeX,where eX=eϕ1eϕ2eθ1eθ2eψ1eψ2T, which converge exponentially to zero. In fact, considering the Lyapunov candidate(16)VXt,eX=12eXTPXeX,and differentiating along the error dynamics (15), one obtains(17)V˙Xt,eX=eXTAXTPX+PXAXeX=−eXTQXeX≤−λminQXeX2≤−αVXt,eX,α=2λminQXλminQX>0,with PX solution of the equation AXTPX+PXAX=−QX for a fixed matrix QX=QXT>0. Therefore,(18)VXt,eX≤e−αtV0,eX0,so that the tracking error converges globally exponentially to zero [19].


### 3.2. Altitude Control

For the altitude control, let us consider the altitude dynamics:(19)z˙1=z2,z˙2=g+cϕ1cθ11mu1.The control problem is to maintain the quadrotor at a desired constant altitudez1,ref, z2,ref=0. The tracking errors are defined as(20)ez,1=z1−z1,ref,ez,2=z2−z2,ref.Choosing(21)u1=mcϕ1cθ1g+z˙2,ref−kz,1ez,1−kz,2ez,2,with kz,1,kz,2>0, we obtain(22)e˙z=Azez,where ez=ez,1,ez.2T and(23)Az=01−kz,1−kz,2.The stability proof is similar to that of the previous section.


## 3.1. Attitude Control

To design the attitude control law, let us define the following variables:(9)ϕ=ϕ1,θ=θ1,ψ=ψ1,ϕ˙=ϕ2,θ˙=θ2,ψ˙=ψ2,so that system (7) can be rewritten as(10)ϕ˙1=ϕ2,ϕ˙2=Jy−JzJxθ2ψ2−JpJxωpθ2+lJxτ1,θ˙1=θ2,θ˙2=Jz−JxJyϕ2ψ2+JpJyωpϕ2+lJyτ2,ψ˙1=ψ2,ψ˙2=Jx−JyJzϕ2θ2+1Jzτ3,where X=ϕ1,ϕ2,θ1,θ2,ψ1,ψ2 are the measured signals. The control objective is to match the UAV attitude X to a desired reference:(11)Xref=ϕ1,ref,ϕ2,ref,θ1,ref,θ2,ref,ψ1,ref,ψ2,ref.To this aim, let us define the tracking errors as(12)eϕ,1=ϕ1−ϕ1,ref,eϕ,2=ϕ2−ϕ2,ref+k1eϕ,1,eθ,1=θ1−θ1,ref,eθ,2=θ2−θ2,ref+k3eθ,1,eψ,1=ψ1−ψ1,ref,eψ,2=ψ2−ψ2,ref+k5eψ,1,with k1,k3,k5>0. Note that ej,1=0 implies ej,2=0, j=ϕ,θ,ψ. Deriving the error system (12) with respect to (10) is possible to calculate the error dynamics:(13)e˙ϕ,1=eϕ,2−k1eϕ,1−ϕ˙1,ref+ϕ2,ref,e˙ϕ,2=Jy−JzJxθ2ψ2−JpJxωpθ2+lJxτ1,−ϕ˙2,ref+k1eϕ,2−k1eϕ,1+ϕ2,ref−ϕ˙1,ref,e˙θ,1=eθ,2−k3eθ,1−θ˙1,ref+θ2,ref=eθ,2−k3eθ,1−θ˙1,ref+θ2,ref,e˙θ,2=Jz−JxJyϕ2ψ2+JpJyωpϕ2+lJyτ2,−θ˙2,ref+k3eθ,2−k3eθ,1+θ2,ref−θ˙1,ref,e˙ψ,1=eψ,2−k5eψ,2−ψ˙1,ref+ψ2,ref,e˙ψ,2=Jx−JyJzϕ2θ2+1Jzτ3−ψ˙2,ref+k5eψ,2−k5eψ,1+ψ2,ref−ψ˙1,ref.Using the following control law [18],(14)τ1=Jxl−Jy−JzJxθ2ψ2+JpJxωpθ2+ϕ˙2,ref−k1eϕ,2−k1eϕ,1+ϕ2,ref−ϕ˙1,ref−k2eϕ,2,τ2=Jyl−Jz−JxJyϕ2ψ2−JpJyωpϕ2+θ˙2,ref−k3eθ,2−k3eθ,1+θ2,ref−θ˙1,ref−k4eθ,2,τ3=Jz−Jx−JyJzϕ2θ2+ψ˙2,ref−k5eψ,2−k5eψ,1+ψ2,ref−ψ˙1,ref−k6eψ,2,with gains ki>0, i=2,4,6 in (13), the tracking error dynamics become(15)e˙X=e˙ϕ,1e˙ϕ,2e˙θ,1e˙θ,2e˙ψ,1e˙ψ,2=−k1100000−k2000000−k3100000−k4000000−k5100000−k6eϕ1eϕ2eθ1eθ2eψ1eψ2=AXeX,where eX=eϕ1eϕ2eθ1eθ2eψ1eψ2T, which converge exponentially to zero. In fact, considering the Lyapunov candidate(16)VXt,eX=12eXTPXeX,and differentiating along the error dynamics (15), one obtains(17)V˙Xt,eX=eXTAXTPX+PXAXeX=−eXTQXeX≤−λminQXeX2≤−αVXt,eX,α=2λminQXλminQX>0,with PX solution of the equation AXTPX+PXAX=−QX for a fixed matrix QX=QXT>0. Therefore,(18)VXt,eX≤e−αtV0,eX0,so that the tracking error converges globally exponentially to zero [19].


## 3.2. Altitude Control

For the altitude control, let us consider the altitude dynamics:(19)z˙1=z2,z˙2=g+cϕ1cθ11mu1.The control problem is to maintain the quadrotor at a desired constant altitudez1,ref, z2,ref=0. The tracking errors are defined as(20)ez,1=z1−z1,ref,ez,2=z2−z2,ref.Choosing(21)u1=mcϕ1cθ1g+z˙2,ref−kz,1ez,1−kz,2ez,2,with kz,1,kz,2>0, we obtain(22)e˙z=Azez,where ez=ez,1,ez.2T and(23)Az=01−kz,1−kz,2.The stability proof is similar to that of the previous section.


## 4. 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. Then, real-time experimental tests are performed, showing the effectiveness of the control design.


### 4.1. Simulation Results

For the numerical simulations, the quadrotor model provided by the Pixhawk PSP, in Simulink, has been used. This 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. The 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. The pitch, roll, and yaw angles are shown in Figure 3. The initial conditions considered are z0=0, ϕ0=−5.73°, θ0=5.73°, and ψ0=5.73°. The reference values are zref=2 m and ϕref=θref=ψref=0.Table 2
Gain values.
k
p
,
1
=
46
k
d
,
1
=
35
k
i
,
1
=
28
k
p
,
2
=
4.3
k
d
,
2
=
9
k
i
,
2
=
0.2
k
p
,
3
=
4.5
k
d
,
3
=
7
k
i
,
3
=
0.2
k
p
,
4
=
7
k
d
,
4
=
19
k
i
,
4
=
0.1Figure 2
Numerical simulation: quadrotor’s altitudez1 (solid) and altitude reference z1,ref (dash).Figure 3
Numerical simulation: (a) roll angleϕ1 (solid) and roll angle reference ϕ1,ref (dash); (b) pitch angle θ1 (solid) and pitch angle reference θ1,ref (dash); (c) yaw angle ψ1 (solid) and yaw angle reference ψ1,ref (dash).
(a)
(b)
(c)


### 4.2. 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. The 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. The onboard electronic system consists of a flight controller, a hardware setup, and some ultrasonic sensors.


#### 4.2.1. Flight Controller

The 3DR-PIXHAWK is a high-performance 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 Cortex-M4F with 256 KB in RAM and 2 MB flash and has 14 PWM/Servo outputs and abundant connectivity options for additional peripherals, such as 5x UART (serial ports), one high-power capable, 2x with HW flow control, 2x CAN, Spektrum DSM/DSM2/DSM–X® Satellite compatible input, PPM sum signal input, RSSI (PWM or voltage) input, I2C, SPI, 3.3 and 6.6 V ADC input. Moreover, the 3DR-Pixhawk has different sensors, such as ST Micro L3GD20H 16 bit gyroscopes, ST Micro LSM303D 14 bit accelerometers/magnetometers, Invensense MPU 6000 3-axis accelerometers/gyroscopes, and MEAS MS5611 barometers.


#### 4.2.2. Hardware Setup

The 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. The battery used in this setup is a 3S, 2800 mAh, 25C. The 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 Table2 were used. The initial condition for the altitude was z0=2.16 m. For the pitch, roll, and yaw angles, the initial condition were chosen at ϕ10=1.6°, θ10=0.9°, and ψ10=−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.Figure 4
Experimental implementation: quadrotor’s altitudez1 (solid) and altitude reference z1,ref (dash).Figure 5
Experimental simulation: (a) roll angleϕ1 (solid) and roll angle reference ϕ1,ref (dash) (degree vs. s); (b) pitch angle θ1 (solid) and pitch angle reference θ1,ref (dash) (degree vs. s); (c) yaw angle ψ1 (solid) and yaw angle reference ψ1,ref (dash).
(a)
(b)
(c)


## 4.1. Simulation Results

For the numerical simulations, the quadrotor model provided by the Pixhawk PSP, in Simulink, has been used. This 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. The 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. The pitch, roll, and yaw angles are shown in Figure 3. The initial conditions considered are z0=0, ϕ0=−5.73°, θ0=5.73°, and ψ0=5.73°. The reference values are zref=2 m and ϕref=θref=ψref=0.Table 2
Gain values.
k
p
,
1
=
46
k
d
,
1
=
35
k
i
,
1
=
28
k
p
,
2
=
4.3
k
d
,
2
=
9
k
i
,
2
=
0.2
k
p
,
3
=
4.5
k
d
,
3
=
7
k
i
,
3
=
0.2
k
p
,
4
=
7
k
d
,
4
=
19
k
i
,
4
=
0.1Figure 2
Numerical simulation: quadrotor’s altitudez1 (solid) and altitude reference z1,ref (dash).Figure 3
Numerical simulation: (a) roll angleϕ1 (solid) and roll angle reference ϕ1,ref (dash); (b) pitch angle θ1 (solid) and pitch angle reference θ1,ref (dash); (c) yaw angle ψ1 (solid) and yaw angle reference ψ1,ref (dash).
(a)
(b)
(c)


## 4.2. 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. The 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. The onboard electronic system consists of a flight controller, a hardware setup, and some ultrasonic sensors.


### 4.2.1. Flight Controller

The 3DR-PIXHAWK is a high-performance 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 Cortex-M4F with 256 KB in RAM and 2 MB flash and has 14 PWM/Servo outputs and abundant connectivity options for additional peripherals, such as 5x UART (serial ports), one high-power capable, 2x with HW flow control, 2x CAN, Spektrum DSM/DSM2/DSM–X® Satellite compatible input, PPM sum signal input, RSSI (PWM or voltage) input, I2C, SPI, 3.3 and 6.6 V ADC input. Moreover, the 3DR-Pixhawk has different sensors, such as ST Micro L3GD20H 16 bit gyroscopes, ST Micro LSM303D 14 bit accelerometers/magnetometers, Invensense MPU 6000 3-axis accelerometers/gyroscopes, and MEAS MS5611 barometers.


### 4.2.2. Hardware Setup

The 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. The battery used in this setup is a 3S, 2800 mAh, 25C. The 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 Table2 were used. The initial condition for the altitude was z0=2.16 m. For the pitch, roll, and yaw angles, the initial condition were chosen at ϕ10=1.6°, θ10=0.9°, and ψ10=−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.Figure 4
Experimental implementation: quadrotor’s altitudez1 (solid) and altitude reference z1,ref (dash).Figure 5
Experimental simulation: (a) roll angleϕ1 (solid) and roll angle reference ϕ1,ref (dash) (degree vs. s); (b) pitch angle θ1 (solid) and pitch angle reference θ1,ref (dash) (degree vs. s); (c) yaw angle ψ1 (solid) and yaw angle reference ψ1,ref (dash).
(a)
(b)
(c)


## 4.2.1. Flight Controller

The 3DR-PIXHAWK is a high-performance 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 Cortex-M4F with 256 KB in RAM and 2 MB flash and has 14 PWM/Servo outputs and abundant connectivity options for additional peripherals, such as 5x UART (serial ports), one high-power capable, 2x with HW flow control, 2x CAN, Spektrum DSM/DSM2/DSM–X® Satellite compatible input, PPM sum signal input, RSSI (PWM or voltage) input, I2C, SPI, 3.3 and 6.6 V ADC input. Moreover, the 3DR-Pixhawk has different sensors, such as ST Micro L3GD20H 16 bit gyroscopes, ST Micro LSM303D 14 bit accelerometers/magnetometers, Invensense MPU 6000 3-axis accelerometers/gyroscopes, and MEAS MS5611 barometers.


## 4.2.2. Hardware Setup

The 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. The battery used in this setup is a 3S, 2800 mAh, 25C. The 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 Table2 were used. The initial condition for the altitude was z0=2.16 m. For the pitch, roll, and yaw angles, the initial condition were chosen at ϕ10=1.6°, θ10=0.9°, and ψ10=−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.Figure 4
Experimental implementation: quadrotor’s altitudez1 (solid) and altitude reference z1,ref (dash).Figure 5
Experimental simulation: (a) roll angleϕ1 (solid) and roll angle reference ϕ1,ref (dash) (degree vs. s); (b) pitch angle θ1 (solid) and pitch angle reference θ1,ref (dash) (degree vs. s); (c) yaw angle ψ1 (solid) and yaw angle reference ψ1,ref (dash).
(a)
(b)
(c)


## 5. Conclusions

In this paper, a controller based on the stabilization technique for the altitude and attitude error has been proposed for a quadrotor. The simulation results have been performed using the Pixhawk PSP. Then, the controller has been implemented on a laboratory quadrotor. The simulation and experimental results show a good performance, even in outdoor environment, showing some degree of robustness in the presence of environmental disturbances.



---

*Source: 2314356-2020-07-27.xml*