DIGITAL INTEGRATIVE LQR CONTROL OF A 2DOF HELICOPTER

You might also like

Download as pdf or txt
Download as pdf or txt
You are on page 1of 6

XXI Congresso Brasileiro de Automática - CBA2016

UFES, Vitória - ES, 3 a 7 de outubro

DIGITAL INTEGRATIVE LQR CONTROL OF A 2DOF HELICOPTER

Fernando dos Santos Barbosa∗, Giovanni Gallon Neto∗, Bruno Augusto Angélico∗

Laboratório de Controle Aplicado
Dept. Eng. Telecomunicações e Controle
Escola Politécnica da Universidade de São Paulo
São Paulo, SP, Brazil

Emails: barbosa.fs@usp.br, giovanni.neto@usp.br, angelico@lac.usp.br

Abstract— A two-degree-of-freedom helicopter is a simple and interesting plant, with nonlinearities and out-
put coupling, allowing the study of several subjects, such as Kalman Filters, sensor fusion, different modeling
techniques and usage of classical and modern control. Our main is to develop a digital robust multivariable
control for this plant. Therefore, the plants complete model development is shown using Lagrange’s method
followed by its linearization around an operating point (small angles). Next, a digital LQR controller is projected
using anti-windups, since integrators are used at the input of the plant in order to increase the system order and
to guarantee null error for the step inputs. Lastly, the controller obtained is simulated and tested on the built
helicopter.

Keywords— LQR, Digital Control, Helicopter, Integrator

Resumo— Um helicóptero com dois graus de liberdade é uma planta simples e interessante, apresentando
não-linearidades e acoplamento entre suas saı́das, possibilitando o estudo de diferentes assuntos, tais como o
uso do Filtro de Kalman, fusão de sensores, emprego de várias técnicas de modelagem e de controle clássico e
moderno. O principal objetivo deste artigo é desenvolver um controlador robusto digital multivariável para uma
planta deste tipo. Apresenta-se a modelagem completa do sistema com o uso do Método de Lagrange seguido
pela sua linearização em torno de um ponto de operação (pequenos ângulos). Em seguida, um controlador LQR
digital é projetado fazendo uso de anti-windups, dado que integradores são colocados na entrada da planta para
aumentar sua ordem e garantir erro nulo para entrada degrau. Por fim, o controlador obtido é simulado e testado
no helicóptero construı́do.

Palavras-chave— LQR, Controle Digital, Helicóptero, Integrador

1 Introduction et al. (2011) developed a 6 DOF IMU (Inertial


Measurement Unit) using Kalman Sensor Fusion.
Aerial vehicles are a trending topic amid engineer- MIMO systems are easily handled by opti-
ing students. With the advent of drones and mul- mal controllers, allowing the designer to determine
ticopters, they have also gained space in the media feedback gain values using efficient computation
and usage in all types of industries, such as cine- tools (Franklin et al., 1997). Linear quadratic reg-
matography and bridge inspections. Therefore, to ulator is one of the most popular choices for op-
study a two-degree-of-freedom (2DOF) helicopter timal controllers due to its performance index: a
may be a promising start, as it is relatively simpler quadratic function of the state variable and con-
than 6 DOF vehicles. trol inputs. This quadratic performance measure
Particularly, the helicopter used is a highly achieves a compromise between minimizing the
non-linear coupled MIMO (Multiple Input, Mul- regulator error and the control effort (Fadali and
tiple Output) system (Quanser, 2011) able to ro- Visioli, 2013).
tate only around the pitch and yaw axes. The This article starts by presenting the modeling
plant is controlled by two rotors, each composed of the system using Euler-Lagrange, resulting in
of a brushless DC motor and a propeller. both linear and non-linear equations. Then, the
digital controller is developed and implemented,
Guarnizo et al. (2010) present the complete
followed by its simulation, results and conclusion.
system modeling and controls a Quanser 2DOF
helicopter based on DK-iteration; Camacho et al.
(2012) show the construction of a similar heli- 2 Mathematical Modeling
copter from scratch going through the modeling
and tests; Gonzalez et al. (2012) develop a more The modeling process presented here follows the
accurate model also using the Euler-Lagrange one shown in Guarnizo et al. (2010) using the La-
equations and designs two control loops, one for grangian method. The system can rotate around
each axis, based on observers; Gutierrez et al. two axes, pitch and yaw (θ and ψ), with the fol-
(2014) used uncoupled MIMO cross-control and lowing convention:
servo tracking control with state observer; Ahmad • Helicopter is horizontal with θ = 0;
et al. (2000) and Rahideh and Shaheed (2007) also
modeled this plant; Lopez-Martinez et al. (2003) • θ̇ is positive when the nose is moving up-
used an H∞ controller. Lastly, Pérez-D’Arpino wards;

ISSN 2525-8311 501


XXI Congresso Brasileiro de Automática - CBA2016
UFES, Vitória - ES, 3 a 7 de outubro

• ψ̇ is positive when the helicopter rotates CW; Vm y are the pitch and yaw motors signal percent-
age. The generalized forces vector is given by
• As the system is fixed, it cannot rotate
h
around the roll axis or move along the axes. Q = [Q1 , Q2 ] = Kpp Vm p + Kpy Vm y − Bp θ̇,
i
Figure 1 shows a simple free-body diagram Kyy Vm y + Kyp Vm p − By ψ̇ (5)
of the helicopter model. However, the notation
shown in this figure is not the same used in the
modeling. with Bp and By being the air resistance acting on
the pitch and yaw axes, respectively. Lagrange’s
equation is written as:

∂ ∂L ∂
− L = Q1
∂t ∂ q˙1 ∂q1
∂ ∂L ∂
− L = Q2 , (6)
∂t ∂ q˙2 ∂q2

where q1 and q2 are the generalized coordinates


θ and ψ, respectively, and L is the Lagrangian of
the system, defined by the difference between the
total kinetic energy and the total potential energy
Figure 1: Simple free-body drawing. of the system.
Adapted from (Quanser, 2011). Solving the Euler-Lagrange’s equation results
in a non-linear equation of motion:
Starting the modeling, the total potential en-  
ergy of the system is given by Kpp Vm p + Kpy Vm y − Bp θ̇ + α + β
θ̈ = 2
(7)
EP = mheli glcm sin θ, (1) Jeq p + mheli lcm
2
α = mheli lcm ψ̇ 2 sin(θ) cos(θ) (8)
where mheli is the helicopter total moving mass, β = mheli g cos(θ)lcm (9)
g is gravity and lcm the position of the center of
mass. The total kinetic energy is Kyp Vm p + Kyy Vm y + γ − By ψ̇
ψ̈ = (10)
Jeq y + mheli cos(θ)2 lcm
2

1 1 1 2
γ = 2mheli lcm sin(θ) cos(θ)ψ̇ θ̇ (11)
EK = Jeq p θ̇2 + Jeq y ψ̇ 2 + mheli
 2 2 2
2
− sin(ψ)ψ̇ cos(θ)lcm − cos(ψ) sin(θ)θ̇lcm By linearizing the system for small angles, as
 2 this is the operating point, the equations of motion
+ − cos(ψ)ψ̇ cos(θ)lcm + sin(ψ) sin(θ)θ̇lcm are defined by
i
+ cos(θ)2 θ̇2 lcm
2
. (2) Kpp Vm p + Kpy Vm y − Bp θ̇ − mheli glcm
θ̈ = 2
Jeq p + mheli lcm
Jeq p and Jeq y are the helicopter moments of (12)
inertia around pitch and yaw. As aforementioned, Kyp Vm p + Kyy Vm y − By ψ̇
the system is controlled by two BLDC electric mo- ψ̈ = 2
. (13)
Jeq y + mheli lcm
tors, each generating torque to both axes. For ex-
ample, the pitch motor directly controls the pitch
angle using the force generated by its propeller, A state-space system is written based on these
creating torque in the yaw as an effect of air re- equations, resulting in:
sistance. Then, the torques for each axis can be
written as: ẋ(t) = Ax(t) + Bu(t)
y(t) = Cx(t) (14)
τp = Kpp Vm p + Kpy Vm y (3)
τy = Kyy Vm y + Kyp Vm p (4) where x(t) corresponds to the states of the system
and u(t) to the percentage inputs of the motor,
wherein Kpp is the pitch motor torque constant defined by:
on the pitch axis, Kpy is the yaw motor torque
constant on the pitch axis, Kyp is the pitch motor  T
x(t) = θ(t) ψ(t) θ̇(t) ψ̇(t) (15)
torque constant on the yaw axis, Kyy is the yaw  T
motor torque constant on the yaw axis, Vm p and u(t) = Vm p (t) Vm p (t) . (16)

ISSN 2525-8311 502


XXI Congresso Brasileiro de Automática - CBA2016
UFES, Vitória - ES, 3 a 7 de outubro

The matrices A, B and C are then written as


 
0 0 1 0
0 0 0 1 
A = 0 0 −Bp
 
Jeq p +mheli l 2 0 
cm
 
−By
0 0 0 2
Jeq y +mheli lcm
 
0 0
 0 0 
B = 
 Kpp Kpy

2 2

 Jeq p +mheli lcm Jeq p +mheli lcm 
Kyp Kyy
Jeq 2 2
y +mheli lcm Jeq y +mheli lcm
 
1 0 0 0
C = .
0 1 0 0

3 The Helicopter

For constructing the model, presented in Figure


2, two brushless DC motors were used as actu-
ators to control the yaw and pitch angles; two
encoders were used for measuring these angles.
As the simple and cheap Electronic Speed Con-
trollers (ESCs), responsible controlling brushless
motors, can only rotate their motor in one di-
rection, choosing motors with enough torque to
rotate the model is important. A development Figure 2: 2DOF Helicopter built.
platform based on ARM architecture was used to
interface sensors, ESCs and processing. ous time and then discretize the final controller;
In order to identify the rotors characteristics, or to start by plant discretization and then project
a platform was used to measure a rotor thrust the controller already in discrete time (Castrucci
and torque. Their relation to the input signal et al., 2011). Since the second was chosen, a
was approximated by polynomial equations and discrete-time system equivalent to (14) is written
linearized to get the parameters of equations (3) as:
and (4).
The rest of the parameters were obtained by x[n + 1] = Φx[n] + Γu[n]
simple system identification, presented in Table 1. y[n] = Cx[n]. (17)
It is worth explaining the Kpp , Kyy , Kpy and Kyp
signals: they are positive if they act to positively Matrices Φ and Γ are obtained from the
increase their respective angle of effect, e.g., Kpp continuous-time A and B taking the 100Hz sam-
brings the nose upward (positive pitch) while Kyy pling time into account. The resulting matrices
rotates the helicopter CCW (negative YAW). are:
 
1 0 0.0100 0
0 1 0 0.0099
Table 1: Helicopter Parameters Φ =  , (18)
0 0 0.9974 0 
Parameter Value Unit
mheli 1.317 kg 0 0 0 0.9781
−6
−8.22 · 10−8
 
lcm 0.038 m 2.33 · 10
Kpp 0.0180 N.m/% 1.18 · 10−6 −3.65 · 10−6 
Γ =  4.66 · 10−4 −1.64 · 10−5  . (19)

Kyy −0.0033 N.m/%
Kpy −6.35 × 10−4 N.m/% 2.36 · 10−4 −7.27 · 10−4
Kyp 10.76 × 10−4 N.m/%
Bp 0.1 N/% A state feedback controller u[n] = −Kx[n]
By 0.1 N/% that minimizes the cost function
Jeq p 0.384 kg.m2 ∞
1X T
x [n]Qx[n] + uT [n]Ru[n]

Jeq q 0.0432 kg.m2 J= (20)
2 n=0

is the discrete version of the Linear Quadratic


4 Digital Controller Regulator (LQR) for systems as (17). Each plant
channel receives an integrator to guarantee zero
Two paths may be taken to use a digital con- steady-state error for the step inputs, as shown in
troller: to develop the entire project in continu- Figure 3.

ISSN 2525-8311 503


XXI Congresso Brasileiro de Automática - CBA2016
UFES, Vitória - ES, 3 a 7 de outubro

Figure 3: Integrator insertion.

The integrator state equation may be written choosing diagonal matrices such that:
as follows:
1
Qii = ,
v[n + 1] = v[n] + r[n] − y[n] (max xi )2
= v[n] + r[n] − Cx[n] (21) 1
Rjj = , (27)
(max uj )2
and the closed-loop equation is (Fadali and Visioli,
2013) in which i is the state and j the control input.
By using ts = 10s and the following Q and R
x[n + 1] = (Φ − ΓK) x[n] + ΓKi v[n]. (22) matrices
 
Therefore, the complete augmented system 1 0 0 0 0 0
has the following equation: 0 1 0 0 0 0
 
0 0 5 0 0 0
Q= (28)
      
x[n + 1] Φ − ΓK ΓKi x[n] 04,2

0 0 0 5 0 0
= · + ·r[n],
v[n + 1] −C I2,2 v[n] I2,2
 
0 0 0 0 0 0
| {z }
x̂[n] 0 0 0 0 0 0
(23)
 −2 
90 0
wherein x̂[n] is the new augmented states vector R= (29)
0 50−2
and the state matrix expands as
    the resulting gain matrix was:
Φ 04,2 Γ  
− · K −K (24)
−C I2,2 02,2 | {z i}

418.8146 71.8968 233.6604 ...
K̂ =
57.3546 −243.4466 36.9813 ...
| {z } | {z }

Φ̂ Γ̂ 
... 35.8345 −1.9874 −0.3618
and each matrix stands for new augmented Φ̂, Γ̂ . (30)
... −110.8521 −0.2527 1.1461
and K̂.
As matrices Q and R are weakly connected
to performance specifications, the pincer proce- 5 Simulation and Results
dure (Franklin et al., 1997) creates a new degree
The first step was simulating the complete sys-
of freedom for the controller to keep the closed-
tem with Simulink. The control commands were
loop poles inside a 1 /α radius circle, with α > 1.
manually programmed, as would be done in a mi-
Assuming the following modified cost function
crocontroller; here is where the anti-windup part

1 Xh n was considered. Not considering the anti-windup
T
J= (α x̂[n]) Q (αn x̂[n]) may seem good initially but its usage guarantees
2 n=0
i that the integral error will not grow beyond the
T
+ (αn u[n]) R (αn u[n]) , (25) motors limits, causing a slow response after the
system gets back to the normal conditions of op-
then eration. Motors saturations and dead-zones were
  also included.
αn+1 x̂[n + 1] = αn+1 Φ̂x̂[n] + Γ̂u[n] The simulation procedure was as follows:

= αΦ̂ (αn x̂[n]) + αΓ̂ (αn u[n]) , • During the first seconds, wait for the system
(26) to stabilize at θ = 0 and ψ = 0;

and the optimal control problem may be formu- • at 20s, give a step reference of 0.35rad for the
lated as αn u[n] = −K̂ (αn x̂[n]), i.e., u[n] = pitch and at 35s a step reference of −0.35rad
−K̂x̂[n]. Finally, α is defined as 100Ts /ts , with for the yaw;
Ts the sampling time and ts the settling time cho-
sen for a 1% criteria (Franklin et al., 2001). • at 50s, give a new reference to take the pitch
Lastly, to determine the Q and R matri- back to zero and do the same to the yaw at
ces, Bryson’s rule (Franklin et al., 2001) suggests 65s.

ISSN 2525-8311 504


XXI Congresso Brasileiro de Automática - CBA2016
UFES, Vitória - ES, 3 a 7 de outubro

Figure 4 shows all the four states and their


response to the simulation procedure, proving the 100
stabilization capability of the digital optimal con- Vm p
Vm y
troller developed. The control effort is shown in
80
Figure 5, in which is interesting to notice that
the pitch control effort is maximum when the he-
licopter is horizontal. 60

Motor %
The next step was uploading the controller to
the development board and controlling the real 40
helicopter. The same test procedure presented for
the simulation was used.
20
Figure 6 presents the real system response, in
which it is possible to verify the stabilization capa-
bility of the controller developed. Figure 7 shows 0
the respective motor percentage. The main differ- 0 10 20 30 40 50 60 70 80
t (s)
ences from the simulated system may be caused by
poor system identification as well as by the power Figure 5: Motors percentage for non-linear model
cable position, causing unmodeled dynamics. simulation.

6 Conclusion
0.4
It was presented the complete development of the θ
digital integrative LQR controller using Bryson’s 0.3 ψ
rule and pincer procedure. This optimal controller
0.2
was capable of not only stabilizing the helicopter
Amplitude (rad)

but also taking it to points far from the operating 0.1


one chosen for linearization.
0
In normal conditions of operation, there is
no need to implement an anti-windup code, since -0.1
both motors are far from saturation. However, if
-0.2
considering a system with the possibility of exter-
nal forces acting on it, the anti-windup is advised. -0.3
Different choices of Q and R matrices and α
would force the system to react in different man- -0.4
0 10 20 30 40 50 60 70 80
ners. Changing them allows the system to respond t (s)
faster or slower, remembering to always be cau-
tious of the control effort. Figure 6: Results from the controller applied to
Future works consist in performing better sys- the built helicopter.
tem identification, implementing filters and test-
ing different controllers.

0.4 100
Vm p
0.3 Vm y

80
0.2
Amplitude (rad)

0.1 60
Motor %

0
40
-0.1

-0.2 θ
ψ 20
-0.3 θ̇
ψ̇
-0.4 0
0 10 20 30 40 50 60 70 80 0 10 20 30 40 50 60 70 80
t (s) t (s)

Figure 4: System states for non-linear model sim- Figure 7: Motors percentage used to control the
ulation. θ and ψ are in rad, θ̇ and ψ̇ in rad/s. built helicopter.

ISSN 2525-8311 505


XXI Congresso Brasileiro de Automática - CBA2016
UFES, Vitória - ES, 3 a 7 de outubro

Acknowledgment Lopez-Martinez, M., Ortega, M. and Rubio, F.


(2003). An h infin; controller for a double ro-
The authors would like to thank the Programa de tor system, Emerging Technologies and Fac-
Excelência Acadêmica (Proex) from the Coordi- tory Automation, 2003. Proceedings. ETFA
nation for the Improvement of Higher Education ’03. IEEE Conference, Vol. 1, pp. 253–259.
Personnel (CAPES) for grant 0212083 and the Na-
tional Counsel of Technological and Scientific De- Pérez-D’Arpino, C., Vigouroux, D., Medina-
velopment (CNPq) for grant 151881/2015-4. We Melendez, W., Fermin, L., Torrealba, R.,
also thank Kennedy X. B. Peixoto for his incredi- Grieco, J. and Fernandez-Lopez, G. (2011).
ble work and help with building the helicopter and Development of a low cost inertial mea-
Freescale for donating the FRDM-K64F develop- surement unit for uav applications with
ment platforms. kalman filter based attitude determination,
Technologies for Practical Robot Applica-
References tions (TePRA), 2011 IEEE Conference on,
pp. 178–183.
Ahmad, S., Chipperfield, A. and Tokhi, M. (2000).
Quanser (2011). Quanser 2-DOF Helicopter - Lab-
Dynamic modeling and optimal control of a
oratory Manual, 2.0 edn, Quanser Inc.
twin rotor mimo system, National Aerospace
and Electronics Conference, 2000. NAECON Rahideh, A. and Shaheed, M. H. (2007). Math-
2000. Proceedings of the IEEE 2000, pp. 391– ematical dynamic modelling of a twin-rotor
398. multiple input-multiple output system, Pro-
ceedings of the Institution of Mechanical En-
Camacho, K., Burgos, J. and Combita, L. (2012).
gineers, Part I: Journal of Systems and Con-
Construction and modeling of a two-degree-
trol Engineering 221(1): 89–101.
of-freedom helicopter, Robotics Symposium
and Latin American Robotics Symposium
(SBR-LARS), 2012 Brazilian, pp. 150–155.
Castrucci, P., Bittar, A. and Moura Sales, R.
(2011). Controle Automático, LTC.
Fadali, M. and Visioli, A. (2013). Digital Control
Engineering - Analysis and Design, 2nd edn,
Elsevier.
Franklin, G. F., Powell, D. J. and Emami-Naeini,
A. (2001). Feedback Control of Dynamic Sys-
tems, 4th edn, Prentice Hall PTR, Upper
Saddle River, NJ, USA.
Franklin, G. F., Workman, M. L. and Powell, D.
(1997). Digital Control of Dynamic Systems,
3rd edn, Addison-Wesley Longman Publish-
ing Co., Inc., Boston, MA, USA.
Gonzalez, E., Rivera, D. and Gomez, E. (2012).
Model and observer-based controller design
for a quanser helicopter with two dof, Elec-
tronics, Robotics and Automotive Mechan-
ics Conference (CERMA), 2012 IEEE Ninth,
pp. 267–271.
Guarnizo, M., Trujillo, R. and Guacaneme, M.
(2010). Modeling and control of a two dof he-
licopter using a robust control design based
on dk iteration, IECON 2010 - 36th Annual
Conference on IEEE Industrial Electronics
Society, pp. 162–167.
Gutierrez, J., Duarte, E. and Arcos, J. (2014).
Control systems for a helicopter with two de-
grees of freedom, III International Congress
of Engineering Mechatronics and Automa-
tion (CIIMA), pp. 1–6.

ISSN 2525-8311 506

You might also like