Full text
INVERTED PENDULUM VIRTUAL CONTROL
LABORATORY
Jos´e L. Lima, Jos´e C. Gon¸cal es,
Paulo G. Cos a, A. Paulo Mo ei a
Poly echnic Ins i u e o B agan¸ca, Po ugal
{jllima, goncal es}@ipb.p
Facul y o Enginee ing o he Uni e si y o Po o, Po ugal
{paco,amo ei a}@ e.up.p
Abs ac :
This pape desc ibes a ool o in e ac i e lea ning ha can be used o imp o e
con ol sys ems design. The de eloped sys em is eady o use and allows es ing
di e en con ol me hods. I can be used by s uden s o p oblem sol ing and
indi idual lea ning. The i ual con ol labo a o y was implemen ed as a eaching
aid du ing lec u es on con ol sys ems. As he e is no need o do any special
p og amming o debugging, he s uden s can ocus on he con ol i ems. Classical
con ol me hods such as PID and S a e-Space app oaches a e a ailable and gains
can be uned. A iendly appea ance based on openGL 3D shows a simula ion o
he eal wo d: A ca wi h an in e ed pendulum is ”bumped” wi h a o ce. The
dynamic equa ions o mo ion o he con ol sys em a e linea ized assuming ha
he pendulum does no mo e mo e han a ew deg ees away om he e ical
allowing o apply linea con ol me hods. Al hough, he simula ed sys em is
ealis ic and based on a Dynamics Engine.
Keywo ds: Con ol educa ion, In e ac i e p og ams, Simula ion
1. INTRODUCTION
Tasks like modeling, iden i ica ion, analysis and
simula ion a e common in con ol sys em design
(K oumo e al., 2003). The de eloped applica ion
suppo s he simula ion o an in e ed pendulum
sys em wi h i s con olle . The simula ed wo ld
beha io and g aphics a e based on open sou ce
pla o ms. The objec i e o his p ojec is o allow
he s uden s o lea n and es con ol sys ems in
an easy way. S uden s need a ” eady o go” and
iendly applica ion o lea n by playing con ol
heo y (Saco e al., 2002).
Some i ual labo a o ies exis on-line on he web
(W. and Tzes, 1999), p esen ing ad an ages like
low cos , iendly use and suppo ing simul a-
neous mul iple use s, as examples: ’Labo a o io
Vi ual: pendulo in e ido’ (Uni e sidad de Val-
ladolid (UVA), Labo a o io i ual: pendulo in e -
ido, 2006) and Fuzzy Pendulum Demo p oposed
by he In eg a ed Reasoning G oup o he Ins i-
u e o In o ma ion Technology o he Na ional
Resea ch Council o Canada (Ins i u e, 2006).
Tools like Ma lab a e powe ul bu some imes
ha d o p og am. A s uden o ien ed applica ion is
p esen ed in o de o selec and une he con olle
ha closes he loop. The inal esul is a iendly
3D in e ace scene allowing he use o mo e
a ound he wo ld.
This pape is o ganized as ollows: Ini ially, he
in e ed pendulum sys em and some applica ions
CONTROLO 2006
7 h Po uguese Con e ence on Au oma ic Con ol
Ins i u o Supe io Técnico, Lisboa, Po ugal
Sep embe 11-13, 2006
a e desc ibed. Then, in sec ion 3, sys em modeling
equa ions whe e a S a e-Space app oach is used is
desc ibed. Sec ion 4 p esen s he wo ld cons uc-
ion, beha io and i is also shown how s uden s
can in e ac wi h he g aphical in e ace, being
possible o con ol he sys em manually. Then,
in sec ion 5, he eal ime closed loop simula ion
whe e esul s o di e en con ol me hods a e
shown is p esen ed. Finally, sec ion 6 ounds up
wi h conclusions and u u e wo k.
2. INVERTED PENDULUM OVERVIEW
An in e ed pendulum is a pendulum ha ing i s
cen e o g a i y loca ed abo e i s pi o poin . An
in e ed pendulum is he e o e inhe en ly uns a-
ble. When i s cen e o g a i y is di ec ly abo e
he pi o poin , i may emain s a ic. I he pi o is
s a ic and he cen e o g a i y is sligh ly displaced
om he e ical posi ion, he pendulum will no
e u n o i s o iginal posi ion bu will end o ind
a new equilib ium posi ion such ha i s cen e
o g a i y is a i s lowes possible posi ion. A
eedback con ol sys em ha posi ions he pi o
may be used o balance an in e ed pendulum
(K akow, 2005).
Some applica ions o he in e ed pendulum a e
p esen ed in he nex subsec ions.
2.1 Segway
An in e ed pendulum is p esen in de ices such
as a unicycle and a Segway Human T anspo e
(Figu e 1). In hese de ices, he pi o o he
pendulum is he axle o a wheel o pai o wheels.
In a unicycle he wheel is powe ed by he ide .
In a Segway Human T anspo e , he wheel is
powe ed by an elec ic mo o . Mo ion o he
wheel, o pai o wheel, is con olled so ha he
pendulum is dynamically balanced (Segway web
page, 2006).
Fig. 1. Segway Human T anspo e
The e is also ano he e sion o Segway, he Seg-
way Robo ic Mobili y Pla o m (RMP), ha is
a modi ied e sion o he Segway Human T ans-
po e (HT) designed o p o ide scien is s and
enginee s a mobile base o use in obo ics esea ch
(Segway Robo ic Mobili y Pla o m, 2006).
I has been well es ablished wi hin he li e a u e
abou agen s and obo ics ha simula ion can be
a powe ul ool o speeding up he de elopmen
cycle o obo con ol sys ems (Go e al., 2004).
2.2 Rocke Na iga ion
The in e ed pendulum con ol model is simila o
he ocke launch (Oga a, 2002). I was belie ed
ha , in ligh , he ocke would ”hang” om he
engine like a pendulum hanging om a pi o . The
weigh o he uel ank would keep he ocke
lying s aigh up as long as he uel las ed.
Howe e , his belie is inco ec , such a ocke will
ne e ly in a s aigh line and will always u n and
c ash in o he g ound soon a e launch. This is
wha happened o Godda d’s ocke (Wikipedia -
The ee encyclopedia, 2006). In he p esen wo k,
he pendulum is ee o mo e in plane xy and he
ca is able o slide ac oss xaxle only.
Nowadays, Rocke s use Ine ial Na iga ion o
sol e his p oblem. Ine ial na iga ion employs
accele ome e s and gy oscopes o de e mine speed
and posi ion. (Japan Ae ospace Explo a ion Agency
(JAXA), 2006).
3. SYSTEM MODELING
Con olling he in e ed pendulum is a classical
p oblem in con ol labo a o ies because he pen-
dulum dynamics is bo h nonlinea and uns able
(Samad and Balas, 2003). The dynamic equa ions
o mo ion o he con ol sys em a e linea ized,
al hough he simula ed sys em is ealis ic and
based on a Dynamics Engine.
The in e ed pendulum sys em consis s o wo
mo ing pa s:
•The pendulum
•The ca
The dynamic equa ions o mo ion o he sys em
a e linea ized assuming ha pendulum does no
mo e mo e han a ew deg ees away om he e i-
cal. One impo an issue o emphasize is ha ca
wheels dynamics is igno ed, in o he wo ds, hei
mass and momen o ine ia a e conside ed null.
The ac ua o and senso dynamics a e despised
bu a sa u a ion nonlinea i y can be applied o
he ac ua o as shown in he sec ion 5 whe e a
as dynamic con olle is applied.
The modeled Sys em is shown in Figu e 2.
Fig. 2. In e ed pendulum sys em
The cons an s and a iables o his case s udy
a e de ined as ollows:
•Mmass o he ca 3 kg
•mmass o he pendulum 1.57 kg
•b ic ion o he ca 0.1N/m/s
•lleng h o pendulum cen e o mass 2 m
•Iine ia o he pendulum 8.37 kgm2
•F o ce applied o he ca
•N eac ion o ce applied o he ca
•xca posi ion coo dina e
•θpendulum angle om e ical
•gg a i y accele a ion 9.8m/s2
Whe e he pendulum momen o ine ia is shown
in equa ion (1).
I=1
3ml2(1)
The well known New on’s second law o mo ion,
equa ions (2) and (3), whe e Fis he applied
o ce, P he g a i a ional o ce and T he applied
o que, allows o w i e he Lag angian equa ions
o he sys em desc ibed in equa ions (4) and (5)
(Uni e si y o Michigan, Ma lab con ol u o ial,
2006).
XF=ma (2)
XT=I¨
θ(3)
F−N−b˙x=M¨x(4)
−Pl sin(θ)−Nl cos(θ) = I¨
θ(5)
In o de o apply linea con ol me hods he
sys em equa ions should be linea ized, assuming
ha θ=π+φ, whe e φ ep esen s a small angle
om he e ical upwa d di ec ion. The e o e,
cos(θ)≈ −1, sin(π+φ)≈ −φ, and ˙
θ2≈0
(Uni e si y o Michigan, Ma lab con ol u o ial,
2006).
The linea ized sys em equa ions can be ep e-
sen ed in S a e-Space o m (Ribei o, 2002), as
shown in he nex equa ions:
˙x
¨x
˙
θ
¨
θ
=A
x
˙x
θ
˙
θ
+B u (6)
Y=C
x
˙x
θ
˙
θ
(7)
A=
0 1 0 0
0−(I+ml2)b
λ
m2gl2
λ0
0 0 0 1
0−mlb
λ
mgl(M+m)
λ0
(8)
Whe e λ=I(M+m) + Mml2.
B=
0
(I+ml2)b
λ
0
ml
λ
(9)
C=1 0 0 0
0 0 1 0 (10)
Resul ing Ain ma ix (11) and Bin ma ix (12).
A=
0 1 0 0
0−0.0257 1.6925 0
0 0 0 1.0000
0−0.0055 2.4632 0
(11)
B=
0
0.2566
0
0.0550
(12)
4. WORLD CONSTRUCTION AND
BEHAVIOR
Dynamic engines like New on Dynamics, YADE-
Ye Ano he Dynamic Engine and ODE-Open
Dynamics Engine a e powe ul ools ha allow
p og amme s o c ea e a physic wo ld composed
by objec s connec ed h ough join s and simula e
hem. The simula ion dynamics a e based on a -
icula ed igid body dynamics and includes o ces
and collision ea men . The ODE base objec s o
he pendulum and he ca a e a pa allelepiped
and a cylinde espec i ely. The pa allelepiped is
connec ed h ough an hinge join o one end o
he cylinde , allowing i o mo e eely in he xy
plane. I is also connec ed h ough a slide join
allowing mo emen s along xaxle.
4.1 In e ac i e en i onmen issues
Some ime ago, simula ion ools we e mainly ex
based. Nowadays, compu e g aphics de elopmen
allow us o make g ea scena ios like 3D ende ing,
came a posi ioning and eedom ex u es cap i a -
ing people’s a en ion. An in e ac i e educa ional
sys em should ha e he ollowing equi emen s
(K oumo e al., 2003):
•G aphical use in e ace: easy HMI (human
machine in e ace) educing as much as pos-
sible ex yping.
•People wan o easily each esul s wi h-
ou much manual eading. Mos s uden s
ha e mo e success expe imen ing han ead-
ing om books only.
•Simple e ms a e a mus : o unde s and he
complex con ol me hods, s uden s should
ha e access o basic e ms and concep s.
•The simula ion sys em should be easily ac-
cessible.
The p esen ed sys em aims o help s uden s in
con ol enginee ing cou ses. Concep s like eed-
back, s abili y, PID Tunning and S a e-Space ap-
p oach a e applied.
Tools like Simulink, make he simula ion possible
bu hey a e designed o co e a wide enginee ing
a ea and s uden s mus memo ize some commands
in o de o use hese powe ul So wa e. In he
de eloped sys em he e a e no commands bu
bu ons ins ead wi h a iendly 3D g aphical en-
i onmen , as shown in Figu e 3.
The g aphical based in e ac i e in e ace, allows
use s o change PID gains and closed loop poles
pa ame e s o he S a e-Space eedback con-
olle app oach. Random noise in he measu e
is also in oduced in o de o e alua e he sys em
obus ness.
5. REAL TIME CLOSED LOOP SIMULATION
Assuming ha simula ion ime s ep is much as e
han dynamics, i is possible o assu e ha i
is a con inuous ime model. A ime s ep o 20
ms is enough o alida e his app oach. The e
a e h ee closed-loop con ol me hods ha can be
used in his p ojec : he use can manually con ol
he applied o ce o he ca , he PID con ol
Top
iew
Da a acquisi ion
g aph
Closed loop
poles
Se ling ime
Feedback
gain ec o
Se
poin
Noise
addi ion
Came a
posi ioning
S a e
ec o
Con ol
me hod
Nonlinea
sa u a ion
Fig. 3. Vi ual Con ol Labo a o y Sc een Sho
whe e use can in oduce p opo ional, in eg al
and de i a i e gains and he S a e-Space eedback
con ol whe e use can apply a pole placemen ap-
p oach o in oducing he ime se ling, esul ing
in a eedback gain ec o . A g aphical ime e olu-
ion shows he ca posi ion, speed and pendulum
angle and a zoom ea u e is also implemen ed in
o de o highligh some de ails. A op and a on al
iew, whe e use can place he came a e e ywhe e,
shows he 3D eal wo ld. Use can also de ine he
se poin and noise addi ion.
5.1 PID
The analog PID con ol has been used success ully
in many indus ial con ol sys ems o o e hal a
cen u y. The basic p inciple o he PID con ol
scheme is o ac on he a iable o be manipu-
la ed ough a p ope combina ion o h ee con ol
ac ions: p opo ional con ol ac ion (whe e he
con ol is p opo ional o he e o signal, which is
he di e ence be ween he inpu and he eedback
signal), in eg al con ol ac ion (whe e he con ol
ac ion is p opo ional o he in eg al e o signal)
and de i a i e con ol ac ion (whe e he con ol
ac ion is p opo ional o he de i a i e o he e o
signal). In i s mos simple o m, PID in ol es
h ee ma hema ical con ol unc ions wo king o-
ge he : P opo ional, In eg al and De i a i e, as
shown in equa ion (13).
m( ) = Kp[e( ) + 1
T i Z
0
e( ) + T dde( )
d ] (13)
As an example, is shown in Figu e 4 he closed
loop sys em esponse o a dis u bance in he pen-
dulum, whe e he ca posi ion is no con olled.
Fig. 4. PID closed loop sys em wi h Kp=8, Ki=0
and Kd=8 da a g aph
5.2 S a e-Space eedback con olle
The o ce applied o he ca can be gi en by he
s a e eedback ec o p esen ed in equa ion (14).
F=−(K1K2K3K4
x
˙x
θ
˙
θ
(14)
Ha ing he sys em desc ibed in S a e-Space, he
K alues (closed loop gains) can be ound by
equa ion (15) (Vacca o, 1995).
K=0 0 0 1 Q−1α(A) (15)
Whe e α(s), he cha ac e is ic equa ion, p esen ed
in equa ion (17) and Q he con ollabili y ma ix,
gi en by equa ion (16).
Q=B AB A2B A3B(16)
α(s) = (s−p1)(s−p2)(s−p3)(s−p4) (17)
The desi ed closed loop poles a e p esen ed in
equa ions (18) and (19).
poles1,2=a±ib (18)
poles3,4=c±id (19)
As esul , he S a e-Space eedback ec o is gi en
by he nex equa ions:
K1=−1.8553(c2+d2)(b2+a2)
K2= (3.7106a)d2+ 3.7106c2a+
3.7106 b2c+ 3.7106a2c−0.1
K3= (18.182 + 8.6560a2+ 8.6560b2)d2
+72.727 c a+18.182 c2+ 18.182b2+ 18.182a2
+8.6560 b2c2+ 8.6560a2c2+ 44.786
K4= (−17.312a)d2−36.364a−36.364c
-17.312 c2a−17.312cb2−17.312ca2
A S a e-Space as dynamic con olle , based on a
ou h o de Bessel p o o ype wi h a ime se ling
o 4 seconds (Vacca o, 1995), is shown in Figu e
5, whe e a=−1.00, b=1.27, c=−1.38 and d=0.41
wi h he eedback gain ec o ep esen ed by:
K=−10.09 −21.27 278.20 185.51 .
An example o nonlinea sa u a ion ea u e o he
inpu o ce is also shown.
Fig. 5. S a e-Space as dynamic con olle wi h
sa u a ion da a g aph
A slowe dynamic con olle , based on a ou h
o de Bessel p o o ype wi h a ime se ling o 10
seconds (Vacca o, 1995), p esen ed in Figu e 6,
is implemen ed whe e a=−0.40, b=0.51, c=−0.55
and d=0.17, wi h he eedback gain ec o ep e-
sen ed by:
K=−0.26 −1.46 75.80 41.03 .
5.2.1. Noise dis u bance ea u e Da a acquisi-
ion in Physical Sys ems su e s p oblems such
as signal noise, cumula i e e o s, elec omagne ic
in e e ence and empe a u e d i .
Random noise addi ion in pendulum angle and
ca posi ion measu emen allows o illus a e his
Fig. 6. S a e-Space slow dynamic con olle da a
g aph
p oblem. The Da a acquisi ion is shown in Figu e
7.
Fig. 7. S a e-Space con olle da a g aph wi h
noise
6. CONCLUSIONS AND FUTURE WORK
This pape has in oduced an in e ac i e lea ning
ool o au oma ic con ol cou ses, whe e i is
desi ed o con ol an in e ed pendulum. The
de eloped sys em allow s uden s o ocus on he
con ol heo y, helping hem o imp o e hei
skills. The 3D isualiza ion and anima ion e ec s
a e also an ad an age o s uden s o a be e
unde s anding o he physical sys ems. The eal
ime g aphic, whe e a e shown pendulum angle,
ca posi ion and applied o ce, p esen s da a in a
way ha can be easily decoded by s uden s.
As u u e wo k, a wo dimensional in e ed pen-
dulum, placed in an omnidi ec ional ca , is being
de eloped.
REFERENCES
Go, Ja ed, B e B owning and Manuela Veloso
(2004). Accu a e and lexible simula ion
o dynamic, ision-cen ic obo s. In e na-
ional Con e ence on Au onomous Agen s
and Mul i-Agen Sys ems.
Ins i u e, NRC (2006). Fuzzy pendulum demo.
h p://www.ii .n c.ca/IR public/ uzzy
/FuzzyPendulum.h ml.
Japan Ae ospace Explo a ion Agency (JAXA)
(2006). h p://spacein o.jaxa.jp/
no e/ ocke /e/ oc10 e.h ml.
K akow, Kalman I. (2005). Sys em-speci ic PI
Con ol Theo y o Fluid and Mo ion Sys-
ems. Uni e sal publishe s.
K oumo , Vale i, Keishi Shibayama and Aki a
Inoue (2003). In e ac i e lea ning ools o
enhancing he educa ion in con ol sys ems.
33 d ASEE/IEEE F on ie s in Educa ion
Con e ence.
Oga a, Ka suhiko (2002). Mode n Con ol Engi-
nee ing (4 h Edi ion). P en ice Hall.
Ribei o, Ma ia Isabel (2002). An´alise de Sis emas
Linea es. IST P ess.
Saco, Robe o, Edua do Pi es and Ca los God id
(2002). Real ime con olled labo a o y plan
o con ol educa ion. 33nd ASEE/IEEE
F on ie s in Educa ion Con e ence.
Samad, Ta iq and Ga y Balas (2003). So wa e-
Enabled Con ol: In o ma ion Technology o
Dynamical Sys ems. Wiley-In e science.
Segway Robo ic Mobili y Pla o m (2006).
h p://segway.com/segway/ mp/.
Segway web page (2006).
h p://www.segway.com/.
Uni e sidad de Valladolid (UVA),
Labo a o io i ual: pendulo in e ido (2006).
h p://eupisa.u a.es/labo a o ios
/pendulo in e ido/index.php.
Uni e si y o Michigan, Ma lab con ol u o ial
(2006). www.engin.umich.edu/g oup/c m/.
Vacca o, Richa d J. (1995). Digi al Con ol a
s a e-Space app oach. McG aw-Hill In e na-
ional Edi ions.
W., O e s ee and Tzes (1999). An in e ne -
based eal- ime con ol enginee ing labo a-
o y. In: Con ol Sys ems. Vol. 19. pp. 19–34.
Wikipedia - The ee encyclo-
pedia (2006). h p://en.wikipedia.o g/wiki/
Pendulum Rocke Fallacy.