scispace - formally typeset
Open AccessProceedings ArticleDOI

PID, LQR and LQR-PID on a quadcopter platform

TLDR
This paper aims to present a comparison between different controllers to be used in a dynamic model of a quadcopter platform and results were obtained through simulations for 10 different attitudes of the quadcopters.
Abstract
This paper aims to present a comparison between different controllers to be used in a dynamic model of a quadcopter platform. The controllers assumed in this work are an ITAE tuned PID, a classic LQR controller and a PID tuned with a LQR loop. The results were obtained through simulations for 10 different attitudes of the quadcopter, however, in this paper simulation results will be presented for the vertical attitude only (the remainder are analogous and were omitted for brevity).

read more

Content maybe subject to copyright    Report

PID, LQR and LQR-PID on a Quadcopter Platform
Lucas M. Argentim
Centro Universit
´
ario da FEI
unielargentim@fei.edu.br
Willian C. Rezende
Centro Universit
´
ario da FEI
uniewrezende@fei.edu.br
Paulo E. Santos
Centro Universit
´
ario da FEI
psantos@fei.edu.br
Renato A. Aguiar
Centro Universit
´
ario da FEI
preaguiar@fei.edu.br
Abstract—This paper aims to present a comparison between
different controllers to be used in a dynamic model of a
quadcopter platform. The controllers assumed in this work are
an ITAE tuned PID, a classic LQR controller and a PID tuned
with a LQR loop. The results were obtained through simulations
for 10 different attitudes of the quadcopter, however, in this paper
simulation results will be presented for the vertical attitude only
(the remainder are analogous and were omitted for brevity).
I. INTRODUCTION
In the last decades the use of Unmanned Aerial Vehicles
(UAV) has increased due to the development and improvement
of control systems. This increase can also be justified by
the fact that these aircrafts are very versatile in contrast to
their lower complexity. Within UAV hardware, quadcopters are
being widely used for different purposes, such as educational,
commercial or entertainment. This choice can be justified by
the fact that this model presents a very low moment of inertia
and six degrees of freedom, which results in great stability of
the quadcopter.
Facing these considerations, the motivation of this work is
to develop and compare control mechanisms for a quadcopter
model by tuning them with three different approaches. This
work applies performance indexes obtained by the ITAE
tuning method on a PID controller, a classic LQR controller
and a PID controller whose gains where obtained by a LQR
loop (according to the method proposed in [1]).
The PID controller was chosen in this work due of its
versatility and facile implementation, while also providing a
consistent response for the model dynamics attitudes. Also,
the LQR controller seemed as a good comparative controller
because of its great performance and robustness in the plant
in question. The PID controller tuned using a LQR loop is
considered since it makes use of the best characteristics of
both previous methods.
II. BIBLIOGRAPHIC REVIEW
The scientific literature describes various techniques for
controlling quadcopter models in order to perform an efficient
stabilising system and navigation. The choice of a suitable
technique to be used in a control project depends (among
a series of other factors) mainly on the intended use of the
quadcopter [2].
Among the most commonly used control techniques, one
can cite PID Control [3], Back-Stepping [4], nonlinear H
Control [5], Kalman Filter [6] and so on. In this section we
provide a brief summary of these control techniques.
There are several controllers already implemented in various
models of quadcopters, each one with its peculiarities: in [7]
a PID control system is used based on the dynamic model
taking into account the bending in the rotor and the propeller.
In [8] is presented a backstepping control that uses resources
from the Extended Kalman Filter, producing good results in a
quadcopter designed for indoor flight.
A comparison of the PID tuning and the Linear Quadratic
Regulator (LQR) is proposed in [2] where both controllers
have been studied based on a dynamic model of a quadcopter.
In this study it is concluded that both controllers provide
satisfactory feedback for a quadcopter stabilisation.
Other control strategies were also investigated, such as satu-
ration alignment techniques that were applied to a quadcopter,
as described in [9]. [5] describes the H controller, along with
a predictive state space controller for a quadcopter performing
tracking trajectories tasks.
III. DYNAMIC MODEL
The mathematical model of the quadcopter has to describe
its attitude according to the well-known geometry of this UAV.
More specifically, this aerial vehicle basically consists of four
propellers located orthogonally along the body frame. Figure
1 shows this configuration.
Fig. 1. Plant view of the Quadcopter
There are three movements that describe all possible com-
binations of attitude Figure 2 : Roll (rotation around the X
axis) is obtained when the balance of rotors 2 and 4 is changed
(speed increases or decreases). By changing the φ angle, lateral
acceleration is obtained; pitch movement (rotation around the
Y axis) is obtained when the balance of the speed of the rotors
1 and 3 is changed. The θ angle change results in a longitudinal
acceleration; yaw (ψ) (rotation about the Z axis) is obtained
by a simultaneous change of speed of the pair (1,3) or (2,4).

Fig. 2. Description of the Roll(φ), Pitch (θ) and Yaw (ψ) angles
Due to the presence of two coordinate systems, it is neces-
sary to use the transformation matrix to obtain the response of
any movement from a coordinate system (Earth-fixed frame)
to the other (model-fixed frame). With 6 degrees of freedom,
modelling can be a complex task. The equations and the
parameters needed to generate the matrices that describe the
Quadcopter attitudes are estimated based on empirical exper-
imentations and measurements of a LinkQuad Quadcopter
1
.
This work assumes the physical model presented in [10] as
described below.
A. Vertical attitude equations
The equations that describe the vertical attitudes related
to the Z axis of the aircraft are shown below. The state
space matrices that make up these attitudes are described in
equations 1 through 5:
˙z
˙w
˙
1
˙
2
˙
3
˙
4
= A
z
w
1
2
3
4
+ 7BU
(1)
Y =
z w
1
2
3
4
T
(2)
where,
1
From UAS Technologies Sweden AB (http://www.uastech.com/).
A =
0 1 0 0 0 0
0 0 0.0106 0.0106 0.0106 0.0106
0 0 10 0 0 0
0 0 0 10 0 0
0 0 0 0 10 0
0 0 0 0 0 10
(3)
B =
0 0 1 1 1 1
T
(4)
C =
0 1 0 0 0 0.
(5)
In equation 1, z is the vertical coordinate in Earth-fixed
frame, w is the vertical speed in body-fixed frame and
n
is
the angular rate of each propeller. It is possible to modify the
values of the matrix C so either the vertical speed or position
are chosen as the system output.
IV. CONTROL TECHNIQUES
After analysing the transfer function from the state space
matrices, it was noticed that in most attitudes the equations
could be simplified. Some of the roots from the numerator
(zeros) could be simplified with the corresponding roots of the
denominator (poles). By doing this, it was possible to obtain a
lower-order plant model, which means that the controller gains
could be calculated in a straightforward way. This controller
(tuned with simplified equations) was able to give a consistent
response when used in the original plant, as seen in the results
shown in the following sections.
A. LQR - Linear Quadratic Regulator
A generic form of the system presented in equation 1 is
shown in equation 6 where ˙x and x represent the system
outputs and inputs respectively. The matrices A and B were
also described in equations 3 and 4 and represent the particular
dynamic model of the quadcopter LinkQuad [10].
˙x = Ax + Bu (6)
According to [11] for a Linear Quadratic Regulator Con-
troller tuning it is convenient to know a vector u that minimises
the quadratic cost function presented in equation 7 which leads
to the linear control law presented in equation 8.
J =
Z
0
(x.Qx + u.ru)dt (7)
u = Kx (8)
Therefore the vector K described in equation 8 need to
be set in order to minimise equation 7, and for this reason

the parameters k, p, e were obtained applying a lqr function
shown in equation 9, where Q is a square matrix of sixth
order described in equation 10, adjusted to provide the most
efficient values and R is a unitary vector.
[k, p, e] = lqr(A, B, Q, R) (9)
Q =
10000000 0 0 0 0 0
0 1 0 0 0 0
0 0 1 0 0 0
0 0 0 1 0 0
0 0 0 0 1 0
0 0 0 0 0 1
(10)
The output of the LQR function was the vector K shown in
equation (11) containing the six elements that controls each
state of the system individually, this makes a expansion of
the state space function necessary. This expansion is obtained
solving the equation 6 and the result is a system of six
equations 12 to 17 that represent each one of the states.
K =
3.1623 × 10
3
1.5070 × 10
3
1.3062
1.3062
1.3062
1.3062
(11)
˙x
1
= x
2
(12)
˙x
2
= 0.0106x
3
0.0106x
4
+ 0.0106x
5
+ 0.0106x
6
(13)
˙x
3
= 10x
3
+ 7u (14)
˙x
4
= 10x
4
+ 7u (15)
˙x
5
= 10x
5
+ 7u (16)
˙x
6
= 10x
6
+ 7u (17)
When a block diagram of the new expanded equations 12
to 17 is built, and the control law shown in equation 8 is
applied, it becomes a closed loop system with six feedback
gains and no inputs. As the regulators are known for leading
the responses of the system to a null value, a disturbance (step)
was performed at the state which the control was required and
a result for the vertical position is presented in figure 3.
Fig. 3. Vertical position step response for LQR control
Figure 3 shows the step response for the vertical position of
the plant with no overshooting value and with an accommo-
dating time of two seconds. It was also performed the LQR
control for all other movements of the quadcopter from where
analogous satisfactory results were obtained.
Figure 4 shows the vertical-speed step response that was
acquired when a step source was placed in the vertical position
state.
Fig. 4. Vertical speed step response for LQR Control
As mentioned above, the speed response is null after a
transition time because of the regulator controller. It does not
mean that in a practical model the vertical speed goes to zero
because there will always be a disturbance at the position state.
B. ITAE - tuning PID
1) Vertical speed controller: The simplified transfer func-
tion that describes the vertical position is shown in equation
18:
G
w
(s) =
0.0424
s(s + 10)
(18)
Once obtained the transfer function of the attitude, a con-
troller function can be defined as:
C(s) =
(k3s
2
+ k1s + k2)
s
, (19)
where k
3
, k
2
, k
1
represents, respectively, the derivative,
integral and proportional gains. Then, the transfer function of
the closed-loop system can be dened as:

F
w
(s) =
k3s
2
+ k1s + k2
s
3
+ (10 + k3)s
2
+ k1s + k2
. (20)
Equalling the coefficients of the characteristic equation 20
with ITAE model optimum coefficients [12], values k
1
, k
2
and k
3
were obtained.
k1 = 860 (21)
k2 = 8000 (22)
k3 = 25 (23)
After implementing the controller using the values found
with the ITAE method, it was verified that the plant was
not being controlled. That can be explained analysing the
behaviour of the model, which tends to a negative response
before achieving stability. This kind of process usually has its
origin on two competing effects: a fast dynamic effect and
a slow dynamic effect. These effects produce the negative
start to the response before the step recovers to settle at
a positive state value. To solve this problem, an additional
negative unitary gain is placed at the output of the controller
to maintain a negative feedback loop, which gives us a reverse-
acting controller.
The phase delay compensators are also known for their
properties of assisting for a better steady response with the
consequence of shifting the poles to the right side of the
root locus plane. This effect causes a destabilisation of the
model and a longer transient time feedback [13]. Analysing
the transfer function of the plant, it is possible to perceive
the natural presence of one integrator, so the integral gain k
2
,
shown in equation 22 was set to null.
Equations 21 and 23 (k
1
and k
3
gains) were applied in the
ways mentioned above, producing the response shown at figure
5.
Fig. 5. PID vertical speed step response.
Figure 5 shows the step response for the vertical speed
controlled by the gains calculated above. Equations 21 and
23 (respectively k1 and k3 gains) were obtained using the
simplified model shown in equation 18 and later applied to
the space state matrices given by equations 3 through 5.
2) Vertical position controller: The transfer function of
vertical position is described by equation 24, which will be
controlled by new proportional, integral and differential gains:
G
z
(s) =
0.0424
s
2
(s + 10)
. (24)
The new vertical position controller C
B
can be described
as
C
B
(s) =
(k3
B
)s
2
+ (k1
B
)s + (k2
B
)
s
. (25)
Considering the same simplification shown in equation 18,
and neglecting k
2B
for the same reason as k
2
22 , the vertical
position transfer function was obtained, as shown in equation
26.
F
z
(s) =
C
B
(s)(k3s
2
+ k1s)
s(1 + C
B
(s)((k3 + 1)s
2
+ (k1 + 10)s))
(26)
Performing an analogous process to that described in Sec-
tion IV-B1 for equation 26, the new gains k
1B
, k
2B
and k
3B
are
k
1B
= 63.92 (27)
k
2B
= 31.39 (28)
k
3B
= 0.7 (29)
Applying this new controller to the state space matrices
given by equations 3, 4 and the modified equation 5 (to
select the vertical positions as the system output), we obtained
the response illustrated in figure 6. Once again, the model
simplification was validated.
Fig. 6. PID Vertical position step response.

C. LQR - tuning PID
1) Vertical speed controller: As a comparative criterion, we
decided to tune controllers for the same attitudes, but this time
using the method proposed by [1], where the PID gains are
calculated based on equations 30 trhough 34
K
p
K
d
= K
p
C
1
(30)
K
i
= (I
m
+ K
d
CB)K
i
(31)
Where:
C =
C
CA CBK
p
(32)
K
p
= (I
m
+ K
d
CB)
1
(K
p
C + K
d
CA) (33)
K
i
= (I
m
+ K
d
CB)
1
K
i
(34)
The methodology for obtaining the PID parameters is fully
described in [1]. For better tuning results, it is necessary
to execute the algorithm innumerous times until the desired
response for the system is reached. In order to accomplish that,
an algorithm was developed
2
that calculates automatically the
gains based on the simplified space state matrices generated
from equation 18 of the plant and the matrix Q (from the
LQR control theory). Development time increased drastically
and the controller could be tuned with reasonable parameters
for the system.
Using matrix Q = diag[0, 10000, 10000] as a parameter of
our algorithm, the following gains k
P w
, k
Iw
and k
Dw
were
obtained:
k
P w
= 2.3758 × 10
3
(35)
k
Iw
= 1 (36)
k
Dw
= 173.6511 (37)
Figure 7 shows the step response for the vertical speed
controller.
Fig. 7. PID - LQR vertical speed step response
2
Available at: https : //dl.dropbox.com/u/9185049/P ID LQ.m
2) Vertical position controller: Analogously, the same
methodology can be applied for the vertical position controller,
by using the state space matrices given by equation 24.
Using matrix Q = diag[0, 0, 1000, 10000] as parameter for
the software, the parameters k
P z
, k
Iz
and k
Dz
are as follows:
k
P z
= 834.6291 (38)
k
Iz
= 1 (39)
k
Dz
= 701.7901 (40)
Figure 8 shows the step response for the vertical position
controller.
Fig. 8. PID - LQR vertical position step response.
V. RESULT ANALYSIS
Looking back at the step responses shown above, it is clear
that each control system has a different response for the same
attitudes. However, it is possible to choose the most suitable
technique based on the characteristics that is needed for the
quadcopter.
A. Vertical speed responses
Comparing figures 4, 5 and 7, it is possible to notice
that the PID controller tuned by LQR theory is the fastest.
The controller presented a fast response with no overshooting
value.
B. Vertical position responses
The results for the vertical position controllers presented
some differences between their performances. The PID con-
troller tuned with ITAE performance indexes, presented in
figure 6, showed a faster response compared to the other
controllers. Even with less than ten percent overshooting, the
settling time is around 0.25 seconds.
When looking at the step response for the PID tuned with
LQR theory (figure 8) and the classic LQR (figure 3) , the
settling time is about the same, but with no overshoot value.
However, it is important to point out that the robustness of
the controllers are not being analysed. Faster controllers does
not necessarily means consistent responses under disturbances.

Citations
More filters
Journal ArticleDOI

Swarms of unmanned aerial vehicles — A survey

TL;DR: The purpose of this study is to analyse the core characteristics of the swarming drones and measure the public awareness levels with respect to these swarms, which demonstrate that the swarms of drones are fundamental future agenda and will be adopted with the passage of time.
Journal ArticleDOI

Type-2 Fuzzy Logic Trajectory Tracking Control of Quadrotor VTOL Aircraft With Elliptic Membership Functions

TL;DR: In this paper, the authors compared and contrasted type-1 and type-2 fuzzy neural networks (T2FNNs) for the trajectory tracking problem of quadrotor VTOL aircraft in terms of their tracking accuracy and control efforts.
Journal ArticleDOI

A review of quadrotor UAV: control methodologies and performance evaluation

TL;DR: A comprehensive survey of research methodologies proposed for quadrotor control is provided, categorised into three different control design domains and each methodology is discussed in detail.
Journal ArticleDOI

Quadcopter Robust Adaptive Second Order Sliding Mode Control Based on PID Sliding Surface

TL;DR: A robust adaptive second-order sliding mode controller that rejects external disturbances and uncertainties to improve the tracking performance of attitude and altitude in a quadcopter based on a Proportional–Integral–Derivative sliding surface is presented.
Proceedings ArticleDOI

Dynamics modelling and linear control of quadcopter

TL;DR: In this paper, a cascade PID feedback control algorithm is proposed to stabilize the attitude of a quadcopter so that the balancing state can be ensured in spite of disturbances, which reveals the exact relationships among all the variables involved.
References
More filters
Book

Modern control engineering

TL;DR: This comprehensive treatment of the analysis and design of continuous-time control systems provides a gradual development of control theory and shows how to solve all computational problems with MATLAB.
Book

Modern Control Systems

TL;DR: This book presents a control engineering methodology that, while based on mathematical fundamentals, stresses physical system modeling and practical control system designs with realistic system specifications.
Proceedings ArticleDOI

PID vs LQ control techniques applied to an indoor micro quadrotor

TL;DR: The results of two model-based control techniques applied to an autonomous four-rotor micro helicopter called quadrotor are presented, a classical approach (PID) assumed a simplified dynamics and a modern technique based on a more complete model.
Journal ArticleDOI

Robust pole assignment in linear state feedback

TL;DR: Numerical methods are described for determining robust, or well-conditioned, solutions to the problem of pole assignment by state feedback such that the sensitivity of the assigned poles to perturbations in the system and gain matrices is minimized.
Journal ArticleDOI

An integral predictive/nonlinear H∞ control structure for a quadrotor helicopter

TL;DR: An integral predictive and nonlinear robust control strategy to solve the path following problem for a quadrotor helicopter with parametric and structural uncertainties presented to corroborate the effectiveness and the robustness of the proposed strategy.
Related Papers (5)
Frequently Asked Questions (13)
Q1. What have the authors contributed in "Pid, lqr and lqr-pid on a quadcopter platform" ?

This paper aims to present a comparison between different controllers to be used in a dynamic model of a quadcopter platform. The controllers assumed in this work are an ITAE tuned PID, a classic LQR controller and a PID tuned with a LQR loop. The results were obtained through simulations for 10 different attitudes of the quadcopter, however, in this paper simulation results will be presented for the vertical attitude only ( the remainder are analogous and were omitted for brevity ). 

In future work, the results will be applied in a LinkQuad quadcopter recently obtained, which will allow us to make considerations about the actual applicability of the controllers proposed, while also assessing the robustness of the methods. 

Due to the presence of two coordinate systems, it is necessary to use the transformation matrix to obtain the response of any movement from a coordinate system (Earth-fixed frame) to the other (model-fixed frame). 

Once obtained the transfer function of the attitude, a controller function can be defined as:C(s) = (k3s2 + k1s+ k2)s , (19)where k3, k2, k1 represents, respectively, the derivative, integral and proportional gains. 

The phase delay compensators are also known for their properties of assisting for a better steady response with the consequence of shifting the poles to the right side of the root locus plane. 

There are several controllers already implemented in various models of quadcopters, each one with its peculiarities: in [7] a PID control system is used based on the dynamic model taking into account the bending in the rotor and the propeller. 

K = −3.1623× 103 −1.5070× 1031.3062 −1.3062 1.3062 −1.3062 (11)ẋ1 = x2 (12)ẋ2 = −0.0106x3 − 0.0106x4 + 0.0106x5 + 0.0106x6 (13)ẋ3 = 10x3 + 7u (14)ẋ4 = 10x4 + 7u (15)ẋ5 = 10x5 + 7u (16)ẋ6 = 10x6 + 7u (17)When a block diagram of the new expanded equations 12 to 17 is built, and the control law shown in equation 8 is applied, it becomes a closed loop system with six feedback gains and no inputs. 

the transfer function of the closed-loop system can be dened as:Fw(s) = k3s2 + k1s+ k2s3 + (10 + k3)s2 + k1s+ k2 . (20)Equalling the coefficients of the characteristic equation 20 with ITAE model optimum coefficients [12], values k1, k2 and k3 were obtained. 

Equations 21 and 23 (respectively k1 and k3 gains) were obtained using thesimplified model shown in equation 18 and later applied to the space state matrices given by equations 3 through 5.2) Vertical position controller: 

It is known that the LQR controllers are robust and produce a very low steady state error, but with a big transition delay and using six feedback gains, that makes them a bad choice when the system needs fast parameters update and has no direct access to all states of the plant. 

In [8] is presented a backstepping control that uses resources from the Extended Kalman Filter, producing good results in a quadcopter designed for indoor flight. 

The matrices A and B were also described in equations 3 and 4 and represent the particular dynamic model of the quadcopter LinkQuad [10].ẋ = Ax+Bu (6)According to [11] for a Linear Quadratic Regulator Controller tuning it is convenient to know a vector u that minimises the quadratic cost function presented in equation 7 which leads to the linear control law presented in equation 8.J = ∫ ∞ 0 (x.Qx+ u.ru)dt (7)u = −Kx (8)Therefore the vector K described in equation 8 need to be set in order to minimise equation 7, and for this reasonthe parameters k, p, e were obtained applying a lqr function shown in equation 9, where Q is a square matrix of sixth order described in equation 10, adjusted to provide the most efficient values and R is a unitary vector.[k, p, e] = lqr(A,B,Q,R) (9)Q = 10000000 0 0 0 0 00 1 0 0 0 0 0 0 1 0 0 0 0 0 0 1 0 0 0 0 0 0 1 0 0 0 0 0 0 1 (10)The output of the LQR function was the vector K shown in equation (11) containing the six elements that controls each state of the system individually, this makes a expansion of the state space function necessary. 

Using matrix Q = diag[0, 10000, 10000] as a parameter of their algorithm, the following gains kPw, kIw and kDw were obtained:kPw = −2.3758× 103 (35)kIw = −1 (36)kDw = −173.6511 (37)Figure 7 shows the step response for the vertical speed controller.