Embedded Control for Quadrotor UAVs
Embedded Control for Quadrotor UAVs
net/publication/329956488
CITATIONS READS
11 3,428
4 authors, including:
Tiago P. Nascimento
Federal University of Paraíba
104 PUBLICATIONS 1,357 CITATIONS
SEE PROFILE
All content following this page was uploaded by Tiago P. Nascimento on 02 June 2019.
Sarah Pontes Madruga∗ , Augusto de Holanda B. M. Tavares∗ , Alisson Vasconcelos de Brito∗ and Tiago Pereira Nascimento∗
∗ Embedded Systems and Robotics Laboratory (LaSER)
Federal University of Paraiba,
Joao Pessoa, Paraiba, Brazil
Emails: [Link]@[Link], augustotava@[Link], alisson@[Link], tiagopn@[Link]
Abstract—In this paper, we developed an embedded sys- [8], the flight controller was developed using an embedded
tem for a flight controller applied to quadrotor UAVs. Built system based on FPGA; in [9], a navigation control system
with accessible and low cost components, open hardware for indoor quadcopters is proposed, using an APM as flight
architecture and open software, it makes possible the tests
and implementation of new control algorithms by the user, controller and a Raspberry Pi for data processing; in [10],
setting it apart from the most common alternatives available an Arduino based system is used to control UAVs through
on the market. For this device, we developed a sensoring GSM.
system for capturing and recording the quadrotor odometry,
an architecture to send the angular velocity commands to the Given the amount of tasks the UAV has to accomplish and
motors via PWM, and the processing is made on a Raspberry their nature, to operate normally and execute even its most
Pi 3. basic functions, it is necessary to have a group of devices
Keywords-Quadcopter; controller; UAV; embedded system; acting together in an independent and integrated manner, and
the data (position, orientation, or any other sensor essential
I. I NTRODUCTION for the specificity of the mission to be performed) collected
by them need to be processed. Thus, an embedded system
In the last decade, Unmanned Aerial Vehicles (UAV) have
is needed in the UAV to guarantee its autonomy.
been widely used to facilitate human life. They can perform
difficult or dangerous missions, for example, military ones There are some flight controller platforms available on
[1], or make civilian tasks more efficient, like package the market [6], [7]. Among them, we can cite mainly the
delivery. APM and PixHawk series, which are Arduino based and
In spite of the quadrotor simple mechanical configuration, some of the most used by enthusiasts. The main issue
its dynamical behavior makes the aircraft control complex, with those boards is the closed operation of the controller.
because it is, in fact, an underactuated nonlinear system [2]. They use a PID controller, which allows customization only
That is, there are only four rotors to generate input throttles by modifying its gains, and that control law cannot be
to control the six degrees of freedom in the output. substituted. This makes the research for new control methods
Furthermore, quadrotor UAVs are considered classic un- in the UAV area quite complicated, since the accessible and
stable dynamical systems [3]. Hence, the research and well documented devices cannot be used for this purpose.
study of suitable control algorithms to achieve stability is
Some solutions to this matter started to arise in the
indispensable, especially in an area where the interest of the
last year, however, they are not necessarily easy to access.
community only grew in the last few years [4], [5].
MatLab R
provided, in the January 2018 update, integrated
Regardless of the relevance and increase in the study
support for two types of PARROT quadcopters, the Mambo
of control algorithms for UAVs, it is still difficult to find,
Minidrone and the [Link] [11], [12], promising the
in the market, a proper, accessible and adaptable flight
design of control algorithms with the aid of Simulink R
.
controller platform to perform experiments where the user
Despite being a very attractive approach, this option is
can apply their own codes and algorithms. The vast majority
limited to a specific kind of drone, from a specific brand,
of alternatives available, despite having open software, do
and can also be very monetarily expensive. Its recent launch,
not allow the implementation of a new control law, only the
though, shows the relevance and need of platforms to test
tuning of a pre-existent one, because of the way they were
new algorithms for UAVs.
developed and built [6], [7]. These devices were designed
for those users who want to operate their quadcopter, not This paper proposes an open hardware architecture based
necessarily use it for research and tests, that is why we are on Raspberry Pi for a flight controller applied to quadrotors,
faced with those characteristics. where the operation of every component is specified, with
In the available literature, it is possible to find the de- the objective a high-degree of customization in the experi-
velopment of flight controllers based on various boards. In ments, according to the needs of the researcher or user.
T = cT × ω 2 (2)
Figure 1. Axis configuration and details about important variables in the
quadrotor model.
Similarly, it is possible to demonstrate Equation 3, for
the torque coefficient. In this case, cQ refers to the lumped
parameter torque coefficient, Q is the torque, and and ω is
II. M ODELING AND C ONTROL OF A Q UADCOPTER still the angular velocity of the rotor.
Table I
ROTOR SPEED INFLUENCE ON QUADCOPTER MOTION
ωss = (T hrottle%)cR + b (5)
ω1 ω2 ω3 ω4 For the final matrix, we also need to take into account the
z (Throttle) ↑ ↑ ↑ ↑ gyroscopic forces resulting on the body, which are governed
θ (Pitch) ↓ - ↑ - by the inertia of each motor rotating components (Jm ), the
φ (Roll) - ↑ - ↓
rolling and pitching rates (P and Q) and the speed of each
ψ (Yaw) ↓ ↑ ↓ ↑
motor/prop system (ωi ). Hence, Equations 6 and 7 present
the gyroscopic torques created by the motors for pitch and
roll action.
A. Quadcopter Dynamics π
For the dynamic modeling, we will start by presenting τφgyro = Jm Q (ω1 − ω2 + ω3 − ω4 ) (6)
30
the inertia matrix for the quadrotor in Equation 1 [14], [15].
This matrix describes the quadcopter mass moment of inertia π
across the axes and is fundamental to the flight dynamics of τθgyro = Jm P (−ω1 + ω2 − ω3 + ω4 ) (7)
30
the system.
Finally, we can construct the final matrix, which refers
⎡ ⎤ to the moments present in the body frame resulting from
Jxx 0 0
the aerodynamics, thrusts, and torques on the system. See
Jb = ⎣ 0 Jyy 0⎦ (1)
Equation 8.
0 0 Jzz
484
⎡ π
⎤
[Link] .ω22 − [Link] .ω42 + Jm Q 30 (ω1 − ω2 + ω3 − ω4 )
M = ⎣−[Link] .ω12 + [Link] .ω32 + Jm P 30
π
(−ω1 + ω2 − ω3 + ω4 )⎦
−cQ .ω12 + cQ .ω22 − cQ .ω32 + cQ .ω42
(8)
B. Quadrotor Control Strategy
The Proportional Integral Derivative Control technique is
largely used in quadcopters, especially for attitude control.
Classic or modified PIDs can be easily found in most
commercial flight controllers [6], [7], and also in recent
literature related to the subject [16], [17], [18], [19], [20].
Therefore, this type of controller was chosen as an exam-
ple of a possible application of the architecture and sensoring
proposed in this paper. We would like to emphasize though
that the device developed here allows the user to apply their
own control algorithms to the plant.
The PID controller reads the data from the sensors and
estimates the ideal angular velocity the motors should have
Figure 3. Drone assembled and used in the experiments.
so the aircraft can respond correctly to the commands. The
main goal is to correct the error, that is, the difference
between a measured value (usually by a gyroscope) and a
Firstly, the Trajectory Generator block sends the path
desired value. This error can be minimized by adjusting the
commands (x, y) to the Trajectory Controller. This controller
control inputs at each iteration, so that the outputs be the
outputs the roll, pitch and yaw commands to the Attitude
desired ones.
Controller. The altitude (z or throttle) command comes
de(t) directly from the Trajectory Generator.
Correction = K p × e(t) + Ki × e(t) × dt + Kd × (9) The respective adjustments in the motors angular veloci-
dt
ties to achieve the desired behavior in φ , θ , ψ and z will then
Equation 9 shows the PID control law. K p, Ki and Kd are
be sent to the quadcopter, which must possess the adequate
the controller gains to be tuned according to each system;
sensoring for a good State Input feedback and, thereafter, an
the variable e(t) represents the error in position, altitude or
accurate calculation of the error in the next control loops.
attitude, that is, the errors in x, y, φ , θ , ψ or z.
III. P ROJECT OF THE F LIGHT C ONTROL S YSTEM
An autonomous quadcopter has hardware and software
capable of substituting the human guidance during the flight
[6]. Figure 3 shows the drone built for this paper experi-
ments, connected to the flight controller device developed
here.
The quadcopter can be divided into three main parts: the
flight controller, the propulsion system and the sensoring
system.
The flight controller is the UAV’s main board that pro-
cesses information, sends commands to the motors and
receives data from the sensors. In this project, we used a
Raspberry Pi 3 to run the control algorithm and interpret
the data from the sensors connected to it.
For multirotor UAVs, the propulsion system usually con-
Figure 2. Block diagram of the control strategy. sists of brushless DC motors, controlled by Electronic Speed
Controllers (ESC) that send the velocity commands to the
The block diagram for the complete control system, for
motors. The flight controller sends the controller outputs to
position and attitude, can be seen in Figure 2. It is composed
the ESCs, and they send them to the motors. For the drone
of an external loop to control the trajectory, and an internal
in Figure 3, we used four EMAX MT3510 600kV motors and
loop that controls the attitude that must be respected so that
4 Simonk 30A ESCs.
desired path is followed.
The sensors are necessary to detect changes during the
flight or to collect data during the mission. Many types of
485
Figure 4. Complete flight controller device.
Figure 5. Controller scheme with sensors and components.
486
C. PWM Module
The PWM Module Adafruit PCA9685 is responsible for
sending the motor velocity commands to the ESCs, which
translate the PWM to a throttle response. Hence, to verify its
behavior, throttle commands were converted to PWM inside
the Raspberry Pi, sent to the ESCs and from them to the
motors. The angular velocity was validated with the help of
a laser tachometer.
The motors response was consistent to the commands and
formed the graphic shown in Figure 9. Notice the initial part
of the curve, that stays at zero value until 7% throttle. This
happens because the motor needs a minimum amount of
Figure 6. Roll, pitch and yaw data. throttle to overcome inertia. This is a unique constant for
each kind of motor and must be obtained experimentally.
487
Figure 10 presents the output commands from the PID V. C ONCLUSION
controller to one of the motors, white it tries to balance the
drone with the proposed tuning. The process is similar for Throughout this paper, we presented a project of an
the other three motors. embedded system for a flight controller applied to an
autonomous quadcopter. Amidst its advantages, we can
In Figure 11, the PID commands were converted to the
highlight open software and hardware architecture, easy
interval of the PWM signals used here and sent to the ESCs
access components to build the controller on your own,
and motors through the PCA9685 board. Note that they are
and complete user autonomy to implement and test their
limited to a maximum value, to guarantee the safety of the
own control algorithms, unlike the majority of alternatives
system.
available on the market.
For future work, we suggest firstly the implementation and
test of more complex controllers on the device developed
here, for UAVs position, attitude and altitude. Furthermore,
the design and making of an adequate test bench to tune the
controllers correctly.
R EFERENCES
Figure 10. PID outputs sent to the PWM Module. [3] M. T. Hussein and M. N. Nemah, “Modeling and control of
quadrotor systems,” in 2015 3rd RSI International Conference
on Robotics and Mechatronics (ICROM), Oct 2015, pp. 725–
730.
The only assured way of tuning the controller correctly [8] N. Monterrosa, J. Montoya, F. Jarqun, and C. Bran, “Design,
is using a test bench that allows the drone to move in development and implementation of a uav flight controller
several degrees of freedom, as what is shown in [21] and based on a state machine approach using a fpga embedded
[16]. The quadcopter is a highly nonlinear underactuated system,” in 2016 IEEE/AIAA 35th Digital Avionics Systems
Conference (DASC), Sept 2016, pp. 1–8.
system, tuning each axis separately does not work perfectly,
because the nonlinearities do not allow the application of
[9] Y. Luo, M. J. Er, L. L. Yong, and C. J. Chien, “Intelligent
the superposition principle. Building a test bench to perfectly control and navigation of an indoor quad-copter,” in 2014 13th
tune and test quadcopters was out of the scope of this project International Conference on Control Automation Robotics
though. Vision (ICARCV), Dec 2014, pp. 1700–1705.
488
[10] G. N. Solidakis, F. M. Tsokas, M. C. Batistatos, N. C. Sagias,
G. V. Tsoulos, D. A. Zarbouti, and G. E. Athanasiadou, “An
arduino-based subsystem for controlling uavs through gsm,”
in 2017 6th International Conference on Modern Circuits and
Systems Technologies (MOCAST), May 2017, pp. 1–4.
489