part 3_2- control and stabilization of the inverted pendulum via vertical forces

22
190 Control and Stabilization of the Inverted Pendulum viaVertical Forces D. Maravall Department of Artificial Intelligence Faculty of Computer Science,Universidad Politécnica de Madrid Campus de Montegancedo, 28660 Madrid,Spain dmaravall@fi.upm.es Abstract. In this chapter, wepresent a detailed analysis of the possibilities of con- trolling and stabilizing the inverted pendulum(IP) by means of a vertical force. First, weestablish the dynamic equations of the IP under the action of a generic vertical force and then we analyzeits control and stabilization. The main conclu- sion is that the vertical forcehas anexcellent stabilization effect,although it re- quires a permanent fall of the IP support base when it is the only applied force. Therefore, we investigate the combination of the vertical force with the customary horizontal force,arriving at the stabilization conditions for different formal repre- sentations of the system: ordinary differential equations, state variable representa- tion and Liapunov´s direct and indirect methods. 1 Introduction The inverted pendulum(IP)is a widely studied dynamic system, whichhas re- ceived considerable attention in many fields, such as physics, mechanics,applied mathematics,control theory,and the emergent computational techniques known as soft computing [1]-[3]. There are several reasons behind such interest, in particular the importance and ubiquity of the IP in many mechanisms, including robots. Fur- thermore, its intrinsic theoretical interest and the strong challenges posed by its stabilization and control havemade the IP a sort of benchmark, in particular for the comparison of soft computing (artificial neural networks, fuzzy logic, genetic algorithms) and hard computing (ordinary differential equations, input-output con- trol, state variable techniques, like optimal control or Liapunov´s stability). Apart from being abenchmark in control engineering, the IP problem has al- ways been a testbed for computational intelligence theories and models,as it em- braces the customary sense-reason-action cycle, typical of intelligent systems [4] and [5]. Furthermore,controlling a pendulum in its unstable top position is not only an interesting physico-mathematicalproblem with a difficult engineering im- plementation,as it involves high nonlinearities and fast sensory information proc- T.-J. Tarnet al. (Eds.):RoboticWelding,Intelligence and Automation, LNCIS 299, pp. 190-211, 2004. Springer-Verlag Berlin Heidelberg 2004

Upload: hareesh-r-iyer

Post on 24-Apr-2015

51 views

Category:

Documents


1 download

TRANSCRIPT

Page 1: Part 3_2- Control and Stabilization of the Inverted Pendulum via Vertical Forces

190

Control and Stabilization of the InvertedPendulum via Vertical Forces

D. Maravall

Department of Artificial IntelligenceFaculty of Computer Science, Universidad Politécnica de MadridCampus de Montegancedo, 28660 Madrid, [email protected]

Abstract. In this chapter, we present a detailed analysis of the possibilities of con-trolling and stabilizing the inverted pendulum (IP) by means of a vertical force.First, we establish the dynamic equations of the IP under the action of a genericvertical force and then we analyze its control and stabilization. The main conclu-sion is that the vertical force has an excellent stabilization effect, although it re-quires a permanent fall of the IP support base when it is the only applied force.Therefore, we investigate the combination of the vertical force with the customaryhorizontal force, arriving at the stabilization conditions for different formal repre-sentations of the system: ordinary differential equations, state variable representa-tion and Liapunov´s direct and indirect methods.

1 Introduction

The inverted pendulum (IP) is a widely studied dynamic system, which has re-ceived considerable attention in many fields, such as physics, mechanics, appliedmathematics, control theory, and the emergent computational techniques known assoft computing [1]-[3]. There are several reasons behind such interest, in particularthe importance and ubiquity of the IP in many mechanisms, including robots. Fur-thermore, its intrinsic theoretical interest and the strong challenges posed by itsstabilization and control have made the IP a sort of benchmark, in particular forthe comparison of soft computing (artificial neural networks, fuzzy logic, geneticalgorithms) and hard computing (ordinary differential equations, input-output con-trol, state variable techniques, like optimal control or Liapunov´s stability).

Apart from being a benchmark in control engineering, the IP problem has al-ways been a testbed for computational intelligence theories and models, as it em-braces the customary sense-reason-action cycle, typical of intelligent systems [4]and [5]. Furthermore, controlling a pendulum in its unstable top position is notonly an interesting physico-mathematical problem with a difficult engineering im-plementation, as it involves high nonlinearities and fast sensory information proc-

T.-J. Tarn et al. (Eds.): Robotic Welding, Intelligence and Automation, LNCIS 299, pp. 190−211, 2004. Springer-Verlag Berlin Heidelberg 2004

Page 2: Part 3_2- Control and Stabilization of the Inverted Pendulum via Vertical Forces

191

essing, but it also, and very importantly, poses a strong challenge to any intelligent artificial agent, as it demands the coordination of perception and action and, even,some degree of reasoning. Thus, it is no wonder that IP stabilization has been at-tempted by means of robotic manipulators and specialized sensors, [6]- [9].

The bibliography on IP is literally overwhelming. However, it is rather surpris-ing that virtually all the technical literature refers to the planar pendulum with onedegree of freedom. Only very recently have a few references dealing with thespherical pendulum with two degrees of freedom appeared [9]-[11]. Due to thecomplex control problems involved, [9] addresses the stabilization of the sphericalIP by simultaneously controlling two uncoupled planar pendula (the respectiveprojections on the two orthogonal planes of the intertial coordinate system). Refer-ences [10] and [11] apply the method of controlled Lagrangians to get theoreticalstability conditions for the spherical IP.

In practice, the only control action used in the technical literature for IP stabili-zation is a horizontal force, which is almost universally materialized by means ofan electrical cart, i.e., the popular cart-pole system shown in Figure 1.

Fig. 1. The customary cart-pole system.

Note, in Figure 1, that the pendulum is constrained to move within the XOYplane. As mentioned above, the control action is based on the horizontal displace-ments of the electrical cart.

Exceptionally, some authors have considered an alternative control action con-sisting of an oscillatory vertical force applied to the pendulum pivot. The stabiliz-ing effect of a fast vertical oscillation applied to the pendulum base is known fromthe early work of Stephenson in 1908 [12] . The Russian physicist Kapitsa was thefirst, in the fifties, to produce a rigorous demonstration of the stability conditions

191Control and Stabilization of the Inverted Pendulum

Page 3: Part 3_2- Control and Stabilization of the Inverted Pendulum via Vertical Forces

192

of the IP when its suspension base oscillates at a high frequency [13] and, there-fore, some authors use the expression Kapitsa pendulum to refer to this stabiliza-tion technique [14]. Another control alternative is based on the application of a ro-tational torque to the pendulum base, as proposed by Furuta and co-workers [15].In fact, this arrangement leads to a different kind of planar IP, known as the rota-tional IP [16] or, simply, the Furuta pendulum [17].

With the exception of vibrational control –i.e., based on oscillatory control sig-nals- which is a well-known technique for controlling mechanical systems [18]-[20], including, as mentioned above, the IP [21]-[23], the only previous work, toour knowledge, that considers the application of vertical forces to stabilize the IPwas recently performed by Wu et al. [24] and [25], who employ the IP as a basicelement to analyze the postural stability and locomotion of multi-link bipeds. Inparticular, Wu et al. model the IP base point according to cartilage and ligamentbehavior in natural joints and they apply horizontal and vertical forces and, also, arotational torque to the base pivot. Using a very simplified linear model, the result-ing overactuated control system is designed by means of Liapunov´s direct methodto obtain a desired trajectory of the IP´s center of gravity.

In this chapter, we conduct a detailed analysis of the possibilities of controllingand stabilizing the IP by means of a vertical force. The chapter is organized as fol-lows. First, we establish the dynamic equations of the IP under the action of a ge-neric vertical force and then we analyze its control and stabilization. The mainconclusion is that the vertical force has an excellent stabilization effect, although itrequires a permanent fall of the IP support base when it is the only applied force,which is, obviously, an unfeasible control policy. Therefore, we investigate thecombination of the vertical force with the customary horizontal force, arriving atthe stabilization conditions for different formal representations of the system: ordi-nary differential equations, state variable representation and Liapunov´s direct andindirect methods. In particular, we obtain the stability conditions of the IP for a PDcontrol algorithm. An appendix discusses some experimental results, including no-table improvements in IP stabilization achieved when combining the customaryhorizontal force with a vertical force.

2 Stabilization of the Inverted Pendulumwith a Vertical Force

In Figure 2 we have substituted the customary electrical cart by a platform of massM, on which the pendulum pivot is mounted. The pendulum has a total mass m andlength 2l. Apart from the gravitational force, the only existing external force ispurely vertical, Fy

The dynamic equations of the system can be straightforwardly obtained by ap-plying Lagrange´s equations

192 D. Maravall

Page 4: Part 3_2- Control and Stabilization of the Inverted Pendulum via Vertical Forces

193

Fig. 2. Planar inverted pendulum supported by a platform subject to a pure vertical force Fy

ii i

d L L Fdt q q

L K P

$ *∂ ∂− =% +∂ ∂& ,

= −

# ; 2,1=i (1)

where L is the Lagrangian, K is the kinetic energy and P the potential energy of thesystem. Fi stands for the generalized applied forces and qi are the generalized co-ordinates, which in this case are y and

!, respectively. As mentioned above, the

only existing force is F1 = Fy.

The kinetic energy is

( )2 2 2 21 1 12 2 2p pK m x y I M yθ= + + +## # # (2)

where I is the inertia of the pendulum, which we will assume to be negligible fromnow on. The coordinates of the pendulum´s center of mass are

sinpx l θ= ; cospy y l θ= + (3)

where y is the vertical coordinate of the platform’s center of gravity, which we as-sume to coincide with the pendulum hinge. As a consequence, we can also assumethat the pendulum mass is virtually concentrated at its top. The potential energy is

( ) cospP M g y m g y M m g y m g l θ= + = + + (4)

After some operation, the Lagrangian turns out to be

( ) ( )2 2 21 1 sin cos2 2

L m l M m y m l y M m g y m g lθ θ θ θ= + + − − + −# ## # (5)

193Control and Stabilization of the Inverted Pendulum

Page 5: Part 3_2- Control and Stabilization of the Inverted Pendulum via Vertical Forces

194

By substituting into the Lagrange’s equations, we finally get the equations of thesystem dynamics

( ) ( )2sin cos yM m y m l m l F M m gθ θ θ θ+ − − = − +## ###

2sin sin 0m l y m l m g lθ θ θ− + − =####

(6)

which can be expressed in the standard compact form

( ) ( ) ( ),M C G τ + + =## # #q q q q q q (7)

where M(q) is the symmetric, definite positive inertia matrix, C(q,q) is the Corio-lis/centripetal matrix and G(q) is the gravity vector

( )

( ) ( )

2

( ) sin

sin

( )0 cos,

sin0 0

0y

y M m m lM

m l m l

M m gm lC G

m g l

F

θθ θ

θ θθ

τ

+ −' - ' -= ; =( . ( .− ) / ) /

+ ' -− ' -= ; =( . ( .− ) /) /

' -= ( .) /

#

#

q q

q q q(8)

It is interesting to compare these equations with the equations for the usual case inwhich a pure horizontal force, Fx , is applied, as illustrated in Figure 1

( ) 2cos sin xM m x m l m l Fθ θ θ θ+ + − =## ###

2cos sin 0m l x m l m g lθ θ θ+ − =####

(9)

In spite of the apparent similarity of formulae (6) and (9), the stabilization of theIP in each case is totally different, as shown in the sequel.

As a first step in the analysis of this nonlinear system, let us focus on the situa-tion of practical interest, namely, small IP movements around the unstable open-loop position θ = 0, where we can introduce the following approximations

θθ ≈sin ; 2/1cos 2θθ −≈ (10)

which, substituted into the Lagrangian function (4), yields

194 D. Maravall

Page 6: Part 3_2- Control and Stabilization of the Inverted Pendulum via Vertical Forces

195

( ) ( )2 2 2 21 1 (1 /2)2 2

L m l M m y m l y M m g y m g lθ θ θ θ= + + − − + − −# ## # (11)

Then, from the Lagrange’s equations, we get the equation of small movements

( ) ( )2cos yM m y m l m l F M m gθ θ θ θ+ − − = − +## ###

0y l gθ θ θ− + − =####

(12)

Similarly, for the horizontal force, we get

( ) xM m x m l Fθ+ + =####

0x l gθ θ+ − =####

(13)

Unlike the dynamic equations of the horizontal case, which are totally linear, theequations of the small IP movements are still nonlinear in the vertical case, mak-ing the stability analysis and the control comparatively more difficult.

By solving the simultaneous differential equations of the horizontal force in θ,we get

xFM m gM l M l

θ θ+− = −## (14)

The respective characteristic equation yields hyperbolic sines and cosines and,therefore, the pendulum dynamics is unstable. However, the horizontal closed-loopdynamics can be straightforwardly stabilized [26] by introducing a feedback con-trol law, such as a conventional PD algorithm

θθ #dpx kkF += (15)

Unfortunately, this is not the case for the vertical force, as we then have anautonomous, unforced pendulum dynamics

( ) 0l g yθ θ − + =## ## (16)

unless we consider vertical acceleration as an external control action. Specifically,we observe that this equation is unstable if the following condition holds

195Control and Stabilization of the Inverted Pendulum

Page 7: Part 3_2- Control and Stabilization of the Inverted Pendulum via Vertical Forces

196

( ) 0>+ yg ## (17)

as unbounded hyperbolic solutions are obtained in!. On the contrary, if (g+ÿ) < 0,

then stable oscillating solutions are obtained, as the characteristic equation has thefollowing roots

21,20

g y g yr r j

l l+ +

+ = → = ±## ## (18)

so that

[ ]( ) cos ( )t A t tθ ω ϕ= ⋅ + (19)

where the angular frequency ! (t) is time dependent, due to the variable verticalforce. Therefore, when the stable oscillatory condition ( g + ÿ ) < 0 holds, the pen-dulum oscillates with a constant amplitude and a slowly varying frequency givenby

22

2

(0)(0)(0)

A θθω

= +#

; 1 (0)tan(0) (0)

θϕ ω θ− ' -−= ( .⋅) /

#

1( )2

g yf t

lπ+

=##

(20)

The greater the vertical acceleration, the higher the frequency of oscillation. As for the oscillation amplitude, given the usual condition

!’(0) / ! (0) <<

!(0) , it is vir-

tually equal to the initial deviation!(0).

As a first conclusion regarding the pure vertical force, we can guarantee a stableoscillating behavior of the IP, if and only if the applied vertical force, Fy, producesa negative vertical acceleration such that y g< −## . As the stability of the IP de-

pends on the vertical acceleration, we must proceed with the analysis of the verti-cal dynamics, which for small deviation angles of the IP turns out to be

( ) ( )yM m y m l F M m gθ θ+ − = − +#### (21)

By substituting the vertical acceleration given by (21) into the pendulum dynam-ics, one obtains

196 D. Maravall

Page 8: Part 3_2- Control and Stabilization of the Inverted Pendulum via Vertical Forces

197

( ) 0yF mM mM m l

θ θ θ θ' -− + =( .++) /

## ## (22)

Then, the vertical force that guarantees oscillatory stability of the IP is

yF m l θ θ< − ## (23)

Assuming that the deviation angle has been stabilized by a vertical force satisfyingcondition (23), then

!and its second derivative are sinusoids of opposite sign, so

that the upper limit of the stabilizing vertical force is always positive

yF m l θ θ< ## (24)

Now, let us suppose, conservatively, that Fy = 0, i.e., the platform-pendulum pairis left in free-fall. In this case, the stability condition holds

( ) 0m lg yM m

θ θ+ = <+#### (25)

and the respective small oscillations of θ will be of very low frequency

1( )2

f tM m

θ θπ= +

##(26)

with an amplitude given by (20).

Summarizing, the IP can be stabilized by means of the free-fall of the platform-pendulum pair, which is obviously an impractical control strategy. For such rea-son, we need to investigate whether it is possible, at some point after the stabiliza-tion of the IP, to stop the platform falling and, even, to raise it to its original posi-tion. More specifically, let us introduce a positive vertical force, Fy = (M + m) g,just to balance the force of gravity, in which case the platform stops falling. Thus,the dynamics of the vertical force is now

m lyM m

θ θ= +#### (27)

which, substituted into the pendulum dynamics given by (16), yields the followingcondition for maintaining the small oscillations of θ around the vertical position

m l gM m θ θ >+

## (28)

197Control and Stabilization of the Inverted Pendulum

Page 9: Part 3_2- Control and Stabilization of the Inverted Pendulum via Vertical Forces

198

Condition (28) is obviously violated for realistic values of the parameters M, mand l and provided that we are, precisely, hypothesizing small values of the pendu-lum’s deviation angle and its successive derivatives,. Consequently, the platform-pendulum pair would have to remain in free-fall in order to maintain the stable ini-tial oscillations.

Our preceding discussion of the IP stability conditions has been based on rather qualitative reasoning. So, let us now take a more rigorous approach by analyzingthe Mathieu equation that determines the pendulum dynamics –see expression(16)-. Thus, once the inverted pendulum has been stabilized by applying a negativevertical force, the deviation angle of the pendulum and its two first derivatives are

( )( ) cost A tθ ω ϕ= + ; ( )( ) sint A tθ ω ω ϕ= − +#

( )2( ) cost A tθ ω ω ϕ= − +##

(29)

which, substituted into the vertical dynamics, yields the vertical acceleration

( ) ( )2 2 2 2sin cos yFm ly A t t gM m M m

ω ω ϕ ω ϕ= + − + + −' -) /+ +## (30)

whence the pendulum dynamics turns out to be

( ) ( )2 2 cos2 0yF m A tM m l M m

θ ω ω ϕ θ− ' -+ + + =( .) /+ +

## (31)

which is, as mentioned above, the well-known Mathieu equation

( )cos( ) 0x t xδ ε ω+ + =## (32)

The Mathieu equation, in particular its stability conditions, has been extensivelyanalyzed [1] and [27]. The analytical stability conditions of the Mathieu equationconfirm the conclusions that we drew from our qualitative discussion, namely, that the IP stabilization with a vertical force – i.e., Fy > 0 and

!< 0 – is impossible, as

virtually all the corresponding negative half-plane encompasses instability regions of the Mathieu equation. Another interesting result derived from the analyticalstudy of equation (32), not directly observed in the qualitative discussion, is that,even for negative vertical forces –i.e., Fy < 0 and

!> 0 -, there are instability re-

gions that depend on the physical parameters Fy, M, m, l, ! (t) and!(0) that must

be carefully analyzed. Given the complex interactions of these parameters andtheir influence on the instability regions, the most advisable design strategy is tochoose as high as possible a

!and, afterwards, check an " that does not drive the

system to an instability region.

198 D. Maravall

Page 10: Part 3_2- Control and Stabilization of the Inverted Pendulum via Vertical Forces

199

As a general conclusion, the application of a single, sustained vertical force tostabilize and control the IP is unfeasible, although its excellent and, in particular,its fast stabilization effect makes the combination of the vertical force with the cus-tomary horizontal force looks very attractive. Therefore, our next and central topicis the stabilization of the IP via the combination of the vertical force with the cus-tomary horizontal force.

3 Combination of Horizontal and Vertical Forces

After having investigated the stabilization of the IP by means of a vertical force,we are now going to explore its combination with the usual horizontal force. Themechanism for implementing the vertical force, Fy, is a platform of mass m’,mounted on the customary electrical cart, which, as usual, produces the horizontalforce, Fx.

The total kinetic energy of the cart-platform-pendulum ensemble is

( ) ( )2 2 2 2 21 1 12 2 2 p pK M x m x y m x y′= + + + +# # # # # (33)

and the potential energy

pP m g y m g y′= + (34)

By applying Lagrange´s equations

iii

Fq

L

q

L

dt

d =∂∂−++

,

*%%&

$

∂∂#

0,;,;, 332211 ====== FqFFyqFFxq yx θ

(35)

we get the global system dynamics

( ) 2cos sin xM m m x m l m l Fθ θ θ θ′+ + + − =## ###

( ) ( )2sin cos

cos sin sin 0

ym m y m l m l F m m g

x y l g

θ θ θ θ

θ θ θ θ

′ ′+ − − = − +

− + − =

## ###

#### ##

(36)

To analyze this highly nonlinear system, let us first make the following qualitativeremarks.

199Control and Stabilization of the Inverted Pendulum

Page 11: Part 3_2- Control and Stabilization of the Inverted Pendulum via Vertical Forces

200

1. From the study of the pure vertical force case, we know that the only exoge-nous control action is vertical acceleration, which leads to the unfeasible stabiliza-tion strategy of maintaining the platform in free-fall.

2. On the contrary, the pure horizontal force can be used as a feedback controlaction that straightforwardly stabilizes the IP.

3. Due to the equivalence of the joint (x,!) dynamics of the combined case

given by (36) and the pure horizontal case, equation (9), we can, in principle, ex-ploit the feedback stabilization capacity of force Fx by focusing on the joint (x,

!)

dynamics of the horizontal plus the vertical case and considering vertical accelera-tion as an external control action.

Thus, let us rewrite the joint (x,!) dynamics of the combined case

( ) 2cos sin xM m m x m l m l Fθ θ θ θ′+ + + − =## ###

( )cos sin 0x l g yθ θ θ + − + =#### ##

(37)

which is equivalent to the pure horizontal case –see equations (9)-, except that thegravity dynamics is perturbed by the term ÿ sin

!. Remember that this perturbation

is generated by the vertical dynamics, given by the second equation of (36). Thus,by considering vertical acceleration as an exogenous element in the pendulum dy-namics, the combined forces case turns out to have the same formal structure as thehorizontal force case. Therefore, we can tackle the combined case as an ordinarydifferential equation (ODE) problem and stabilize the IP via the horizontal forceFx using any standard control law, as in [26]. Alternatively, we can also approachthe control problem with the state variable representation and stabilize the IP witha plethora of available techniques, including Liapunov’s direct and indirect meth-ods. Let us begin our study with the ODE approach, which conveys a very intuitiveand direct physical interpretation.

3.1 Ordinary Differential Equations Analysis

As usual, we are interested in the neighborhood of the IP vertical position, sothat we linearize the system dynamics (38) by approximating θθ ≈sin ,

2/1cos 2θθ −≈ , 2 0θ ≈# . After solving the ODE system in!, we get

( ) ( ) ( )xFM m m g y

M m l M m lθ θ′+ +− + = −′ ′+ + ## ## (38)

which is virtually equivalent to the pure horizontal case

xFM m gM l M l

θ θ+− = −## (39)

200 D. Maravall

Page 12: Part 3_2- Control and Stabilization of the Inverted Pendulum via Vertical Forces

201

Thus, let us apply a PD control law of the error variable

x p d p dF k e k e k kθ θ= − − = + ## (40)

Which, substituted into (38), yields

( ) 0pdkk M m m g y

M l M l M lθ θ θ' -′+ ++ + − + =( .) /## # ## (41)

Again, it is equivalent to the close-loop horizontal force case, whose ODE [26] is

0pdkk M m g

M l M l M lθ θ θ' -++ + − =( .) /## # (42)

the only remarkable effect of the vertical acceleration being on the root locus ofthe combined forces case. As is well-known, both coefficients must be positive toguarantee stability of (41)

0 0dd

kk

M l> → > ; ( )( )pk M m m g y′> + + + ## (43)

The first condition has a straightforward interpretation; namely, it implies that thefeedback control force, Fx, must have a component directly proportional to thependulum angular speed

!. To illustrate this fact, the four possible states of the IP

have been represented in Figure 5. Note that in cases (b) and (c) the pendulum is returning to its vertical position, while in cases (a) and (d) it is moving away fromit. In all cases, the orientation of the corresponding control force has been indi-cated.

(a) (b) (c) (d)

Fig. 3. The four possible IP states. Observe the orientation of the respective feedback force.

The second stabilization condition in (43) is even more intuitive, as the feed-back force must always have the same orientation as the IP’s angular displacement.

201Control and Stabilization of the Inverted Pendulum

Page 13: Part 3_2- Control and Stabilization of the Inverted Pendulum via Vertical Forces

202

Furthermore, the gain kp should guarantee the positiveness of the respective coef-ficient. Note that when the platform is falling, the vertical acceleration ÿ strength-ens IP stabilization. Inversely, when the platform is ascending to recover its origi-nal position, the respective positive vertical acceleration detracts from IPstabilization. Therefore, the vertical force component –i.e., the generation of verti-cal acceleration- must be carefully designed to tackle with this double-sided effect.Roughly speaking, when the pendulum is moving away from the vertical position,the vertical force should be immediately activated to produce a strong negativevertical acceleration . Inversely, with the pendulum recovering its vertical position,we can make Fy > 0 to bring the platform towards its original position. In short, thevertical displacement of the platform must be synchronized with the IP move-ments. This general control strategy can be succintly formalized as follows

( ) ( )[ ] 0 0 0 0sgn sgn y yIf then F y else F yθ θ < → < > → >= ' - ' -) / ) /# ## ## (44)

Apart from controlling the IP’s deviation angle, which is obviously the main goal,it is also of interest to minimize the platform displacement, which must be con-strained to some specific range. To this end, let us distinguish the following threestates of the cart-platform-pendulum ensemble.

1. The IP is moving away from the vertical position – i.e., ( ) ( )sgn sgnθ θ= # .

2. The IP is returning to the vertical position –i.e., ( ) ( )sgn sgnθ θ≠ # - but is still

far from it.3. As in state 2, but near the vertical position.

Note the fuzzy linguistic qualifiers introduced to make a further distinction inthe basic IP state returning to the vertical position.

Accordingly, we introduce the following control action for each IP state.

1. The pendulum is leaving the vertical position

( ) ( ) ( )y p dF t k t k tθ θθ θ= − +' -) /# (45)

2. The pendulum is returning to and is far from the vertical position

( ) ( ) ( ) ( ) ( ) ( )1y p d py dyF t p k t k t p k y t k y tθ θθ θ= − + − − +' - ' -) /) /# # (46)

where 0 < p < 1 weights the importance of the two control objectives: the IP devia-tion angle,

!, and the platform movement, y. Note that the latter action is aimed at

minimizing the vertical displacement.

202 D. Maravall

Page 14: Part 3_2- Control and Stabilization of the Inverted Pendulum via Vertical Forces

203

3. The pendulum is returning to and is near to the vertical position

( ) ( ) ( )y py dyF t k y t k y t= − +' -) /# (47)

We must remember that in our preceding discussion the vertical acceleration ofthe platform-pendulum couple is given by

( ) ( )2sin cos ym m y m l m l F m m gθ θ θ θ′ ′+ − − = − +## ### (48)

so that the high nonlinearity of the vertical dynamics must be taken into account inthe tuning of the control parameters appearing in formulae (45)-(47).

Summarizing the basic philosophy of our combined forces control, the dynam-ics of the IP is directly controlled by the customary horizontal force, plus the indi-rect action of a vertical acceleration, ÿ, which, in turn, is controlled by the verticalforce given by formulae (45)-(47).

Continuing with our qualitative and general discussion of the combined forces control, we are now going to proceed with the stabilization of the IP under thestate variable representation.

3.2 State Variable Representation

Although basically similar to the ODE analyis, the state variable representation canbe used to extend the possibilities of IP stabilization. In particular, as shown in thesequel, we shall refine the stability conditions by means of Liapunov’s directmethod.

Following our proposed stabilization strategy, which basically involves control-ling the joint (x,

!) dynamics by means of the customary horizontal force and, si-

multaneously, by the vertical acceleration of the platform, let us introduce the fol-lowing variables change in the pendulum dynamics given by (41)

θθ #== 21 , xx (49)

to get the state variable representation. Thus, after some operation, we obtain

21 xx =# (50)

203Control and Stabilization of the Inverted Pendulum

Page 15: Part 3_2- Control and Stabilization of the Inverted Pendulum via Vertical Forces

204

( ) ( )( )

21 1 1 2 1

2 21

sin sin cos cossin

xM m m g y x m l x x x F xx

M m l m l xθ ′+ + + − −= =

′+ +##

###

which is of the more compact form

( )2111 , xxfx =# ; ( )2122 , xxfx =# (51)

Liapunov’s indirect method, also known as the first method, approximates thenonlinear dynamics by the first, linear terms of the Taylor development around acertain equilibrium point ( )1 2,eq eqx x

( ) ( )eq

eq

eq

eq

xxx

fxx

x

fx 22

2

111

1

11 −

∂∂+−

∂∂≈#

( ) ( )eq

eq

eq

eq

xxx

fxx

x

fx 22

2

211

1

22 −

∂∂+−

∂∂≈#

(52)

In vector form

( )eq eqJ≈ −#x x x (53)

where Jeq is the system’s Jacobian particularized into the equilibrium point of in-terest, in our case, ( ) ( ) ( )1 2, 0,0,x x θ θ= =# . After some operation, we get for this

equilibrium point

( )( ) ( )

1

2

1 0

/ 1eq x xJ M m m F x F

M m l M m l x

' -( .= ′+ + − ∂ ∂ ∂− ( .′ ′+ + ∂) /

(54)

The characteristic equation, ( )det 0eqI Jλ − = , yields

( ) ( ) ( ) ( )2

1 2

1 1 0x xF FM m m g y

M m l x M m l xλ λ∂ ∂' -′− + + + − + =′ ′( .+ ∂ + ∂) /

## (55)

To guarantee stability, both coefficients must be positive

2

0 ; 0x xd d

F FFx k k

θ∂ ∂≡ > # = >∂ ∂

##

(56)

204 D. Maravall

Page 16: Part 3_2- Control and Stabilization of the Inverted Pendulum via Vertical Forces

205

which coincides with the respective ODE stability condition (43). Additionally,

( ) ( )1

x xF FM m m g y

x θ∂ ∂ ′≡ > + + +∂ ∂ ## (57)

also coinciding with the second ODE’s stability constraint, provided that we applya PD control law such that

p dF k kθ θ= + # .

Both the linearized ODE and Liapunov’s indirect method only guarantee the lo-cal stability of the system. Liapunov’s direct method, also known as the secondmethod, is stronger as it provides the global stability conditions.

Thus, as for any mechanical system, let us try a Liapunov function based on thetotal energy of the system

( ) ( ) ( )12

22

21 cos121

cos121

, xxxxV −+=−+= θθ# (58)

which is definite positive for πθπ <<− , that determines a region beyond thepractical interest of IP stabilization. Its first derivative is

( ) ( ) ( )1 2 2 2 1 1 1 2 1, sin sin sinV x x x x x x x x x θ θ θ= + = + = +# ### # # # # (59)

In order to get the global stability of the equilibrium point of interest ( ) ( ) ( )1 2, 0,0,x x θ θ= =# , we must guarantee that ( )21, xxV# is definite negative in a

region comprising the equilibrium point, so that

( )0 sin 0 sin 0If then elseθ θ θ θ θ < + > + <' - ' -) / ) /# ## ##

0;/ ≠∀<<−∀ θπθπθ(60)

Thus, solving θ## in the global nonlinear system given by (37) yields

( )( ) ( )

2

2

1sin

sin sin cos cosx

M m l m l

M m m g y m l F

θθθ θ θ θ θ

=′+ +

′+ + + − −' -) /

##

###

(61)

which substituted into (59) gives

205Control and Stabilization of the Inverted Pendulum

Page 17: Part 3_2- Control and Stabilization of the Inverted Pendulum via Vertical Forces

206

( ) ( ) ( ) ( )[{

( ) ] }

1 2 2

2 2

, cossin

sin cos sin

xV x x F M m m g yM m l m l

M m l m l m l

θ θθ

θ θ θ θ

− ′= − + + +′+ +

′+ + + −

## ##

#

(62)

Note that in step (61) we have, again, made use of the control strategy based onconsidering the vertical acceleration as an exogenous variable in the pendulum dy-namics, which is the most feasible procedure for controlling the system when si-multaneously applying horizontal and vertical forces.

From (62), we propose the control law

( ) ( ) ( )[2 2sin cos

x

d

F M m m g y M m l

m l m l tg kθ θ θ θ θ

′ ′= + + + + +

+ − +-/

##

# #

(63)

that with 0>dk completely guarantees the definite negativeness of the first deriva-

tive of the Liapunov function for πθπ <<−

( ) ( )2

1 2 2,sin

dkV x x

M m l m lθ

θ− =

′+ +## (64)

Note that the control law (63) can be expressed for the values of interest of thevariable

!as a conventional PD control law

x p d p dF k tg k k kθ θ θ θ= + ≈ + # # (65)

In fact, the control law (63) is a refinement of the stability conditions that we ob-tained in the ODE analysis and with Liapunov’s indirect method –see expressions (43) and (56)-(57), respectively-.

Thus, by applying Liapunov’s direct method, we have arrived at a more preciseand refined control law that guarantees the global IP stability. Consequently, thefirst step in the actual stabilization of the IP is to design a quantitative control lawby introducing specific performance indices such as rise time, settling time, per-cent overshoot, bandwith etc. Afterwards, the global stability of the IP is guaran-teed by additionally constraining the designed control law to satisfy the conditiongiven by (63).

206 D. Maravall

Page 18: Part 3_2- Control and Stabilization of the Inverted Pendulum via Vertical Forces

207

4 Concluding Remarks

Although the use of high-frequency oscillating vertical forces for IP stabilization isa well-known technique, the application of generic vertical forces to stabilize theIP has not been, theoretically and practically, fully developed to date. In this chap-ter, the novel idea of controlling and stabilizing the IP via vertical forces has beenintroduced and thoroughly analyzed. After having established the dynamic equa-tions of the IP with a generic vertical force applied to its base, we studied IP con-trol and stabilization. The final conclusion is that the vertical force has an excellentand fast stabilization effect, although at the cost of maintaining the IP in free-fall.

After this preliminary analysis, the chapter approaches its main contribution,namely, the combination of the customary horizontal force with the vertical force.Roughly speaking, the horizontal force permits a direct stabilization of IP bymeans of a feedback control action, while the vertical force significantly improvesIP stabilization, mainly due to its fast response to external perturbations of the IPequilibrium state. The theoretical analysis of the combined forces has been devel-oped for both the ODE and the variable state representations. In particular, thenecessary and sufficient conditions of the local stability of the IP controlled by aPD algorithm have been obtained. Furthermore, by applying Lyapunov’s directmethod, the control law, which turns out to be a PD-like feedback action that guar-antees the global stability of the IP, has also been obtained. As a general conclud-ing remark, the chapter has demonstrated the excellent properties of the verticalforce as regards the stabilization of the inverted pendulum.

Acknowledgments

The idea of stabilizing the inverted pendulum via a vertical force originated fromendless discussions with my father, Prof. Dario Maravall-Casesnoves of the RoyalAcademy of Sciences, Madrid. The control law defined by expressions (46) and(47) was proposed by Javier Alonso-Ruiz. Special thanks are due to Prof. C. Zhouof the Singapore Polytechnic for very fruitful discussions and insightful commentsand for his invitation to write this chapter.

References

1. Khalil HK (1996) Nonlinear systems. Second edition. Prentice-Hall, UpperSaddle River, NJ

2. Nelson J, Kraft LG (1994) Real-time control of an inverted pendulum systemusing complementary neural network and optimal techniques. Proc. AmericanControl Conference, 2553-2554

207Control and Stabilization of the Inverted Pendulum

Page 19: Part 3_2- Control and Stabilization of the Inverted Pendulum via Vertical Forces

208

3. Zhou C, Ruan D (2002) Fuzzy control rules extraction from perception-basedinformation using computing with words. Information Sciences 142: 275-290

4. Ghosh BK, Xi N, Tarn TJ (1999) Control in robotics and automation: sensor-based integration. Academic Press, San Diego, CA

5. Maravall D, de Lope J (2002) A reinforcement learning method for dynamicobstacle avoidance in robotic mechanisms. In: Ruan D, D´hondt P, Kerre EE(eds) Computational intelligent systems for applied research. World Scientific,Singapore, 485-494

6. Schaal S (1997) Learning from demonstration. In: Mozer MC, Jordan M, Pet-sche T (eds) Advances in neural information processing systems 9. MIT Press,Cambridge, MA, 1040-1046

7. Sprenger B, Kucera L, Mourad S (1998) Balancing of an inverted pendulumwith a SCARA robot. IEEE/ASME Trans. Mechatronics 3 (2): 91-97

8. Schreiber G, Ott C, Hirzinger G (2001) Interactive redundant robotics: controlof the inverted pendulum with nullspace motion. Proc. IROS 2001, 158-164

9. Chung CY (2002) Balancing of an inverted pendulum with a kinematically re-dundant robot. Int. J General Systems 31 (1): 1-15

10. Bloch AM, Leonard NE, Marsden JE (2000) Controlled Lagrangians and thestabilization of mechanical systems I: the first matching theorem. IEEE Trans.Automatic Control 45 (12): 2253-2270

11. Bloch AM, Chang DE, Leonard NE, Marsden JE (2000) Controlled Lagran-gians and the stabilization of mechanical systems II: potential shaping. IEEETrans. Automatic Control 46 (10): 1556-1570

12. Stephenson A (1908) On induced stability. Philosophical Magazine 15: 233-236

13. Kapitsa PL (1951) Dynamic stability of a pendulum with a vibrating point ofsuspension. Zh. Ehksp. Teor. Fiz. 21 (5): 588-598

14. Fliess M, Levine J, Martin P (1995) Flatness and defect of non-linear systems:introductory theory and examples. Int. J Control 61 (6): 1327-1361

15. Furuta K, Yamamoto M, Kobayashi S (1992) Swing-up control of invertedpendulum using pseudo-state feedback. J Systems Control Eng. 206 (6): 263-269

16. Widjaja M, Yurkovich S (1995) Intelligent control for swing up and balancingof an inverted pendulum system. Proc. IEEE Conf. Control Applications, 534-542

17. Fantoni I, Lozano R (2001) Non-linear control for underactuated mechanicalsystems. Springer, Berlin

18. Meerkov S (1980) Principle of vibrational control: theory and applications.IEEE Trans. Automatic Control 25: 755-762

19. Bogaevski V, Povzner A (1991) Algebraic methods in nonlinear perturbationtheory. Springer-Verlag, New York

20. Hillsley KL, Yurkovich S (1993) Vibration control of a two link flexible ro-bot arm. Dynamics and Control 3 (3): 261-280

21. Acheson D (1993) A pendulum theorem. Proc. Royal Society of London, se-ries A 443: 239-245

208 D. Maravall

Page 20: Part 3_2- Control and Stabilization of the Inverted Pendulum via Vertical Forces

209

22. Baillieul J, Lehman B (1996) Open-loop control using oscillatory inputs. In:Levine WS (ed) The control Handbook. CRC Press & IEEE Press, BocaRaton, FL, 967-980

23. Dimeo RM, Thomopoulos SCA (1994) Novel control of an inverted pendu-lum. Proc. American Control Conference, 2185-2189

24. Wu Q, Thornton-Trump AB, Sepehri N (1998) Lyapunov stability control ofconstrained inverted pendulums with general base point motion. Int. J Non-linear Mechanics 33: 801-818

25. Wu Q (1999) Lyapunov´s stability of constrained inverted pendulums. Proc.American Control Conference, 293-297

26. Raya A, Maravall D (2001) Contribution to the control and stabilization of thepole-cart system. In: Moreno-Diaz R, Buchberger B, Freire JL (eds) Com-puter aided ystems theory. LNCS 2178, Springer, Berlin, 437-449

27. Jose JV, Saletan EJ (1998) Classical dynamics: a contemporary approach.Cambridge University Press, Cambridge

Appendix. Experimental Results

J. Alonso-Ruiz and D. MaravallDepartment of Artificial Intelligence, Faculty of Computer ScienceUniversidad Politécnica de Madrid, Madrid 28660SPAIN

We briefly present some of the experimental results obtained from computer simu-lations, in which IP stabilization via the combination of horizontal and verticalforces is investigated and compared with a single horizontal force. We have con-sidered the values of the system parameters to be as follows: cart mass, 2 kg; plat-form mass, 0.2 kg; pendulum mass and length, 0.1 kg and 0.5 m, respectively.Unless otherwise indicated, distances are in meters (m), time in seconds (s), forcesin newtons (N) and angular displacements in radians in all figures.

In all the reported examples the respective PD algorithm gains have been ob-tained to optimize the usual performance indices: rise time, overshoot peak andsettling time, either for the combined horizontal and vertical forces or for the sin-gle horizontal force. Furthermore, for the combined case, the stability conditionsobtained in the theoretical analysis –see expressions (43), (56), (57) and (63)- havebeen applied. Figure 4 shows the IP trajectories for initial deviations from 5º to 30ºin 5º steps.

209Control and Stabilization of the Inverted Pendulum

Page 21: Part 3_2- Control and Stabilization of the Inverted Pendulum via Vertical Forces

210

(a) (b)

Fig. 4. Instances of IP stabilization with (a) a combination of horizontal and vertical forces and with (b) a single horizontal force.

Note the significant improvement achieved by the addition of the vertical force,which makes the IP stabilize much faster. In particular, the greater the IP initialdeviation, the stronger the positive effect of the vertical component. It is also in-teresting to compare the control efforts, so the respective horizontal forces profiles are depicted in Figure 5. Note the + 20 N restriction over the range of the appliedforces. The same initial deviations as in Figure 4 have been considered.

(a) (b)

Fig. 5. Profiles of the horizontal forces of (a) the combined case and (b) the single horizon-tal case. The greater the initial deviation, the stronger the applied force.

Note that the reductions in the control effort achieved with the combination ofhorizontal and vertical forces are significant. Of course, in these cases there is anadditional control effort produced by the vertical force, although its respective en-ergy cost is comparatively negligible, because the platform mass is small in com-parison to the cart mass. Figure 6 shows the vertical forces profiles and the respec-tive vertical displacements of the platform.

210 D. Maravall

Page 22: Part 3_2- Control and Stabilization of the Inverted Pendulum via Vertical Forces

211

Fig. 6. Vertical forces profiles and platform vertical displacements for the same range ofinitial deviations as above.

211Control and Stabilization of the Inverted Pendulum