Beruflich Dokumente
Kultur Dokumente
discussions, stats, and author profiles for this publication at: https://www.researchgate.net/publication/220157144
CITATIONS READS
40 57
3 authors:
Francisco Gordillo
Universidad de Sevilla
107 PUBLICATIONS 1,126 CITATIONS
SEE PROFILE
Some of the authors of this publication are also working on these related projects:
All content following this page was uploaded by Francisco Gordillo on 03 March 2015.
The user has requested enhancement of the downloaded file. All in-text references underlined in blue are added to the original document
and are linked to publications on ResearchGate, letting you access and read them immediately.
A family of smooth controllers for swinging up a pendulum
Abstract
The paper presents a new family of controllers for swinging up a pendulum. The swinging up of the pendulum is derived
from physical arguments based on two ideas: shaping the Hamiltonian for a system without damping; and providing damping
or energy pumping in relevant regions of the state space. A family of simple smooth controllers without switches with nice
properties is obtained. The main result is that all solutions that do not start at a zero Lebesgue measure set converge to the
upright position for a wide range of the parameters in the control law. Thus, the swing-up and the stabilization problems
are simultaneously solved with a single, smooth law. The properties of the solution can be modified by the parameters in the
control law. Control signal saturation can also be taken into account using the Hamiltonian approach.
x22 x22 1
Hd (x1 , x2 ) = Vd (x1 ) + , (2) Hd (x1 ) = + cos x1 − a cos2 x1 − . (8)
2 2 4a
where the potential energy Vd should have a minimum Other cases are considered in [3].
at the desired upright position. Then, the generalized
Hamiltonian target system adopted is
The reason for the choice of a0 is clear below. With the
" # " #" # choice (8) the matching problem is solved with the feed-
ẋ1 0 1 ∂Hd /∂x1 back law
= , (3)
ẋ2 −1 −ka (x) ∂Hd /∂x2
u = 2a sin x1 . (9)
which, with Hd as given by (2), yields
It should be noted that controller (9), with a = 1, was
ẋ1 = x2 proposed in [6] in another context. Control law (9) gives
(4) a Hamiltonian closed loop system whose level curves are
ẋ2 = −Vd′ (x1 ) − ka (x)x2 . shown in Fig. 1.
1842
3
3 Damping and Pumping
2
B1
1 B2
Since for ka = 0 the system is Hamiltonian all tra-
jectories are stable but not asymptotically stable. It is
x2
C A
0 then easy to influence the system significantly by chang-
−1 B2 ing damping ka 6= 0. Even a small change can have a
major impact. To do so we introduce the control law
B1
−2 u = ues + upd where ues = 2a sin x1 is the energy-
−3
shaping control term (9) and upd is an additional control
−1 −0.5 0
x1 /π
0.5 1
signal which have to be chosen to provide the appro-
priate damping or pumping. As we have seen, the first
Fig. 1. Some level curves for function Hd (x1 , x2 ) with a = 1. term, ues , of the control law gives a closed-loop system
In solid the level curve Hd = 0. with Hamiltonian (8). It is easy to see that system (1)
with u = ues + upd is a PCH system [9] with natural
So far we have focused our attention in the solvability of passive output y = g ⊤ (x)∂Hd /∂x = −x2 cos x1 , where
the matching problem and we have not considered the g(x) = [0 − cos x1 ]⊤ . This means that taking as input
global behavior of the target system. Function Vd im- upd = −ka y the system behaves in such a way that Hd
plicit in (8) has some undesirable features. As required, decreases. That is good when the trajectory is in the
for a > 0.5 it has a minimum at the origin, but it has good well or approaching it. But when it is in an undesir-
another minimum that makes the desired equilibrium able well we have to inject energy. Therefore we should
point not to be the only possible equilibrium. For this modulate the sign of ka accordingly.
Vd the additional minimum coincides with the undesired
hanging position. Making u = ues + upd in (1), the instantaneous energy
variation is given by
The fact of having undesirable minima apart of the de- Ḣd = −x2 upd cos x1 . (10)
sired one, extends to the full family of Vd given by (6).
Ideally we would like to have an energy function which By choosing upd = bF (x1 , x2 )x2 cos x1 , with b > 0 being
has a unique minimum at x1 = 0. Unfortunately this a tuning parameter, the sign of the time derivative of Hd
cannot be achieved with potential energy functions Vd is determined by the sign of the new function F (x1 , x2 )
such that Vd′ is given by (5) and (7) because as Vd′ = (to be defined). Hence the control law is
− sin x1 + sin x1 cos x1 β̄(cos x1 ) then, we have Vd′ = −1
for x1 = π/2 (and Vd′ = 1 for x1 = −π/2). This means u = 2a sin x1 + bx2 F (x1 , x2 ) cos x1 . (11)
the there is at least one maximum at |x1 | = x01 in the in-
terval (0, π/2) (resp. (−π/2, 0)). These maxima will give The first term of this controller can be interpreted as a
rise to saddles in the energy function (2). Function Vd nonlinear spring and we can therefore call it the “spring
implicit in (8) has one pair of undesirable minima but term”. This term makes the pendulum to behave conser-
other choices for Vd may have more minima. In any case vative. The second one is the pumping-damping term.
the undesired minima cannot be avoided.
Figure 1 shows that the level curve for Hd (x1 , x2 ) = 0
With pure damping strategies, the extra minima give separates the state space into three regions. Region A,
rise to undesired basins, which we will call “undesirable which contains the desired equilibrium where the pen-
wells” in the energy landscape, because they hamper the dulum is upright, is bounded by the solide curve. Region
global nature of the stability of the equilibrium at the C, which contains the equilibrium where the pendulum
upright position. hangs straight down, is bounded also by the solid line.
The rest is region B, which later will be divided into the
regions B1 and B2 that appear in the figure.
Notice that the reference for the potential energy a0 has
been chosen so that the curve Hd = 0 limits the unde- A natural choice is to take F negative in region C and
sirable well (i.e. the curve passes through the saddles). positive elsewhere. To have a continuous control law the
function should also vanish on the boundary of region
To overcome the difficulty associated with the undesir- C. Thus, we could consider a curve that matches Hd = 0
able wells we propose a strategy that consists in pump- at the boundary of√region C (for√ a = 1, one such a func-
ing energy inside them, to make the trajectories to leave tion is F = |x2 | + 2 cos x1 − 1/ 2). However, this idea
their basin. This strategy is similar to the one intro- does not work: it makes the stable manifold of the sad-
duced in [1], but the one presented here has more physi- dle points “very attractive” causing trajectories to tend
cal meaning, as we are dealing with energy. This strategy to the saddle and, once there, the behavior is very sensi-
is discussed in the next section. tive to disturbances (this behavior around the saddles is
1843
similar to the behavior around the origin in usual swing- where x0 = arccos(1/2a), and from them the index
up laws [5]). Therefore, from a strict mathematical point
of view, trajectories could not leave region C with this Zx0
△
choice and they would turn around the heterocline join- Φ(a) = ϕH (x1 )K(x1 , ϕH (x1 ))dx1
ing the saddles. 0
Zπ
To avoid this problem, it is proposed to search for a
smooth closed curve close to the boundary of any unde- + ϕF (x1 )K(x1 , ϕH (x1 ))dx1 . (14)
sirable well, but not coinciding exactly with this bound- x0
ary. An example is the dashed curve in Fig. 1 where a
new region, B2 ⊂ B, has been introduced. Energy is in- Function ϕH (x1 ) is the x2 coordinate of the upper curve
jected by the controller in this region. As it will be seen defined by Hd (x1 , x2 ) = 0 (with Hd given by (8)) and the
below, this “imperfect matching” between curves H = 0 function ϕF (x2 ) is the x2 coordinate of the upper curve
and F = 0 gives a closed-loop system with appropriated defined by F (x1 , x2 ) = 0 (plotted with dashed trace in
properties. Actually, the fact that B2 is not an empty Fig. 1). We have the following result.
set is a key point in the approach proposed here. The
problems that this “incorrect” injection of energy raises Theorem 1 Consider system (1) with control law (11)
will be discussed below in Sect. 4. where F given by (13) and b > 0. Then, for any a > 0.5
such that Φ(a) > 0, the origin is asymptotically stable in
Our problem now is to find a simple function F with S × R except for a set of zero measure.
these characteristics. A possible choice is to consider
ovals of the form Proof We will investigate how the energy Hd given by
(8) changes in the different regions. From Fig. 1 it is clear
F (x1 , x2 ) = α2 x22 + α1 cos x1 − 1 = 0, (12) that in region A, which is bounded by the level curve
Hd = 0 and contains the origin, we have Ḣd ≤ 0. There-
and making curves Hd = 0 and F = 0 to match at the fore, applying LaSalle invariance principle, it is easy to
saddle point and at x1 = π. This requirement yields see that the origin is (at least locally) asymptotically
stable and that region A belongs to the domain of at-
x22 2a + 1 traction of the origin. Convergence is faster the larger b
F (x1 , x2 ) = + (2a cos x1 − 1). (13)
2 4a is.
It can be seen that the oval F (x1 , x2 ) = 0 circumscribes In region C we have Hd ≤ 0 and Ḣd ≥ 0. All trajectories
about the boundary region of C and it is a reasonable will leave the region, faster the larger b is. In region B
approximation for Hd = 0 as it is shown in Fig. 1. Func- we have Hd ≥ 0 but the derivative Ḣd can be both
tion F (x1 , x2 ) takes a positive value in regions A and B1 , positive and negative. Therefore, as shown in Fig. 1, we
and a negative one in regions C and B2 . The fact that have divided the region into two subregions B1 = {x ∈
F = 0 circumscribes about region C will be used below B|F (x) > 0} and B2 = {x ∈ B|F (x) ≤ 0}; that is, B2
for the stability proof. is the region where the control law “incorrectly” injects
energy.
Control law (11) has good physical interpretation. The
first term shapes the energy function so that the equi- Introduce D = B2 ∪ C. In B1 we have damping and
librium at the origin is a center. The second term intro-
the energy will decrease. It thus remains to investigate
duces energy damping in region A and almost all of re-
what happens with trajectories originating in D. To ac-
gion B, and energy pumping in region C. The size of the complish this we will investigate the total change in en-
regions are adjusted by the parameter a and the amount
ergy along the trajectories (we will consider the case for
of damping by the parameter b.
x2 > 0; the case x2 < 0 can be analyzed with a simi-
lar argument). In D we have ẋ1 > 0 except at the sad-
4 Stability Analysis dle equilibrium. Taking into account that in D we have
Ḣd ≥ 0, almost all trajectories in D will thus eventually
We will now analyze the stability of the closed-loop sys- leave D. We will separate two cases characterized by tra-
tem. To formulate a global stability criterion for control jectories that enter A after leaving D and trajectories
we introduce the following functions: that do not. The trajectories that enter A will converge
to the origin. Now, on the other hand, we will show that
△
K(x1 , x2 ) = cos2 (x1 )F (x1 , x2 ) the trajectories that do not directly enter A will suffer a
r net energy loss over a period (i.e. a complete pendulum
△ 1
ϕH (x1 ) = + 2a cos2 x1 − 2 cos x1 revolution) if Φ(a) > 0. In this way and taking into ac-
r 2a count that x1 is defined on the manifold S, the system
△ 1 + 2a will enter region A in finite time (perhaps after some
ϕF (x1 ) = (1 − 2a cos x1 ), x0 ≤ x1 ≤ π complete revolutions).
2a
1844
2.5
P3 P4 1
Φ(a)
2
ϕF 0.5
1.5
P0
1 P1P2 0
0.5
x2
0
ϕH
0.5 0.6 0.7 0.8 0.9
a
1 1.1 1.2 1.3 1.4 1.5
−0.5
−2
−2.5
This yields
0 0.2 0.4 0.6 0.8 1
x1 /π
x2 K(x1 , x2 ) ≥ ϕF (x1 )K(x1 , ϕH (x1 )). (17)
Fig. 2. Example of a trajectory entering and leaving region
B2 (shadowed in the figure).
For the points in region B2 , we have F (x1 , x2 ) ≤ 0,
x2 ≤ ϕF (x1 ) and F (x1 , x2 ) > F (x1 , ϕH (x1 )) and, thus,
We have Ḣd (x1 , x2 ) = −bx22 K(x1 , x2 ). Dividing by ẋ1
inequality (17) is also fulfilled:
gives dHd (x1 , x2 ) = −bx2 K(x1 , x2 )dx1 .
x2 K(x1 , x2 ) ≥ ϕF (x1 )K(x1 , ϕH (x1 )).
Consider the change of energy over the interval 0 ≤ x1 ≤
π for trajectories that start in D and do not enter region
Consequently,
A, (see, for instance, trajectory P0 P1 P2 P3 P4 in Fig. 2).
Due to symmetry, the following reasoning also applies to Zπ Zπ
the interval [−π, 0]. The total energy change along the
trajectory is ∆Hd where bx2 K(x1 , x2 )dx1 ≥ bϕF (x1 )K(x1 , ϕH (x1 ))dx1 .(18)
Zπ x0 x0
The argument corresponding to the second integral in Remark 1 The plot of the function Φ in Fig. 3 shows
the right-hand side of (15) is a little more involved since that stable systems are obtained for all a > 0.94 and b >
it corresponds to points in region B1 (points between 0. The positive slope of this curve is intuitively reasonable
P1 and P2 and points between P3 and P4 in Fig. 2) as since the size of region A increases with increasing a.
well as to points in region B2 (points between P2 and
P3 ). For the points in region B1 , F (x1 , x2 ) > 0 and, fur- Remark 2 The estimate is conservative because energy
thermore, x2 ≥ ϕF (x1 ) and F (x1 , x2 ) > F (x1 , ϕH (x1 )). pumping in D = B2 ∪ C is overestimated and damping
1845
3
5 Control signal saturation
2
−1
−2
0 50 100 150 Consider system (1) with the control law
2
x2
−2
u = ues = 2a sin x1 (19)
0 50 100 150
2 u
upd which only does energy shaping. Assume that the con-
u
−2
troller saturates at u = û, i.e., |u| ≤ û (for a start, û may
0 50 100 150
be considered equal to ū, but it will redefined below) .
t Then, we have for the closed loop system
Fig. 4. Simulated swing-up for a = 1 and b = 0.1.
ẋ1 = x2
3
(20)
ẋ2 = sin x1 − cos x1 satû (2a sin x1 ),
2
−0.5
−1
−1.5
• Region R3 = {(x1 , x2 ) : sin x1 < −û/(2a)}. In this re-
0 5 10 15 20
gion u = −û/(2a).
2
x2
4 u
ues
u
H1 if x ∈ R1 ,
2 upd
0
−2
0 5 10 15 20
Hsat = H2 if x ∈ R2 , (21)
t
H if x ∈ R ,
Fig. 5. Simulated swing-up for a = 1 and b = 1. 3 3
with
outside D is underestimated. This means that it is possible
to have stable systems, for any value of b, for values of x22 û2
a smaller than 0.94. By simulation it can be seen that H1 (x1 , x2 ) = cos x1 − a cos2 x1 + + +a (22)
2 4a
the actual value for this bound is a = 0.81. The system 2
H2 (x1 , x2 ) = x2 /2 + cos x1 + û sin x1 (23)
can also be stable for smaller values of a by making b
sufficiently large. H3 (x1 , x2 ) = x22 /2 + cos x1 − û sin x1 . (24)
1846
3 10
R1 R1 9
R3 R2
8
R1 7
1
6
a
5
x2
0
4
3
−1
−2 1
−3
−1 −0.8 −0.6 −0.4 −0.2 0 0.2 0.4 0.6 0.8 1
δ
x1pi
by (8) in the unsaturated case and H = Hsat given by with ues = 2a sin x1 and upd = bx2 F (x1 , x2 ) cos x1 .
(21) in the case of saturation. We have chosen function Hsat such that, for upd = 0,
Ḣsat = 0. Therefore,
5.1 Pumping and damping
Ḣsat = −x2 cos x1 sat(1−δ)ū (bx2 F (x1 , x2 ) cos x1 ).
The introduction of the pumping-damping term in a sim- Using the same arguments of Sect. 4 it suffices to esti-
ilar way to Sect. 3 has to be done carefully since the mate the net energy balance along full revolutions yield-
pumping-damping term can distort the boundary be- ing
tween the zones making that Hamiltonian Hsat is not
longer continuous and, thus, invalidating stability anal- Zπ
△ Ḣsat
−∆Hsat = − dx1
ysis similar to the one of Sect. 4. A simple way to avoid 0
ẋ1
this problem is to introduce u in the following way: x0
Z1
≥ sat(1−δ)ū (bϕH (x1 )F (x1 , ϕH (x1 )) cos x1 ) cos x1 dx1
u = satδū (ues ) + sat(1−δ)ū (upd ), (25) 0
Zπ
+ sat(1−δ)ū (bϕF (x1 )F (x1 , ϕH (x1 )) cos x1 ) cos x1 dx1
with 0 < δ < 1. In this way the energy shaping term x0
is saturated at û = δū (this is the reason why a sym- 1
△
bol different from ū was used for the saturation of ues = Φ(a, b, δ, ū).
As in Sect. 3, the pumping-damping term is chosen of the Theorem 2 Consider system (1) with control law (25)
form (11) but function F has to be redefined since it must with ues and upd defined above. Then, for any a > 0.5
circumscribe about the undesirable wells. We choose such that Φ(a, b, δ, ū) > 0, the origin is asymptotically
function F of the form F (x1 , x2 ) = α2 x22 + α1 cos x1 − 1. stable in S × R except for a set of zero measure.
We will impose that the curve F = 0 intersect with
the curve Hsat = H ∗ at the saddle points and at The applicability of this result is more complicated than
x1 = π. This yields α1 = 2a and α2 = 2a+1 2a
for the one of the unsaturated case since, the corresponding
√ √ 1+α1 function Φ for the last case only depends on a. Never-
2 2
û ≥ 4a − 1 and α1 = 1 + û , α2 = 2(1+α1 )−û2 /(4a)
√ theless, the previous theorem is still useful. For a given
for û < 4a2 − 1. pendulum, parameter ū has a physical value. The control
designer has to find values of parameters a > 0.5, b > 0
5.2 Stability Analysis and 0 < δ < 1 such that Φ(a, b, δ, ū) > 0. For example,
parameter b may be fixed and a graph such as the one of
Fig. 7 can be obtained. In this figure, which correspond
Function Hsat can serve as a basis for the generaliza- to ū = 2, b = 0.1, the marks represent the values of a
tion of the analysis carried out in Sect. 4 and the stabil- and δ that give a positive Φ(a, b, δ, ū) and, thus, give rise
ity proof for the saturation case can be easily obtained. to an almost-globally stable system.
Here, only the main points are presented. The closed-
loop system is In Fig. 8 we present the results of two simulations in or-
der to show the usefulness of the proposed modifications.
ẋ1 = x2 In the first simulation, the original control law is simu-
ẋ2 = sin x1 − satδū (ues ) + sat(1−δ)ū (upd ), lated with saturation in the control action (a = 10, b =
1847
2 Acknowledgements
x2 0
0
−1 References
−2
0 20 40 60 80 100
Time
[1] D. Angeli. Almost global stabilization of the inverted
a) pendulum via continous state feedback. Automatica,
2
37:1103–1108, 2001.
[2] J. Aracil and F. Gordillo. The inverted pendulum: A
x2
0
benchmark in nonlinear control. In Proceedings WAC 2004,
−2 volume 16, pages 468–482, 2004.
0 0.5 1 1.5 2 2.5
x1 /π [3] J. Aracil, F. Gordillo, and K.J. Åström. A family of pumping-
2
damping smooth strategies for swinging up a pendulum. In
1 3rd IFAC Workshop on Lagrangian and Hamiltonian Methods
for Nonlinear Control, 2006.
u
0
−1
−2
[4] K.J. Åström, J. Aracil, and F. Gordillo. A new family of
0 20 40 60 80 100 smooth strategies for swinging up a pendulum. In 16th IFAC
Time
World Congress, Prague, 2005.
b) [5] K.J. Åström and K. Furuta. Swinging up a pendulum by
energy control. Automatica, 36:287–295, 2000.
Fig. 8. Results of two simulations with a = 10, b = 0.1,
and ū = 2: a) with the original controller b) with the new [6] K. Furuta. Control of pendulum: From super mechano-
controller with δ = 0.8. system to human adaptive mechatronics. In Proceedings of
the 42nd IEEE CDC, pages 1498–1507, 2003.
[7] F. Gordillo, J. Aracil, and J.A. Acosta. A control strategy
0.1, ū = 2). It is shown that the controller does not work
for the cart-pendulum system. In Proceedings of the Sixth
properly. In the second simulation the new controller CONTROLO, pages 214–219, 2004.
with δ = 0.9 (which corresponds to the good region in
[8] F. Gordillo, J. Aracil, and K.J. Åström. Analysis of the
Fig. 7) is used showing a good behavior. Better transient control saturation in pumping-damping strategies for the
behavior can be obtained choosing different values for inverted pendulum. In 3rd IFAC Workshop on Lagrangian
the tuning parameters. and Hamiltonian Methods for Nonlinear Control, 2006.
[9] R. Ortega, A. van der Schaft, B. Maschke, and G. Escobar.
Interconnection and damping assignment passivity-based
control of port-controlled Hamiltonian systems. Automatica,
6 Conclusions 38(4):585–596, 2002.
[10] A. Rantzer and F. Ceragioli. Smooth blending of nonlinear
This paper presents a new method to design a single con- controllers using density functions. In Proceedings of
troller for swinging up and stabilizing a pendulum based European Control Conference, 2001.
on energy-shaping. The controller drives the system to [11] A.S. Shiriaev, O. Egeland, H. Ludvigsen, and A.L. Fradkov.
the desired upright position from any initial condition VSS–version of energy based control for swinging up a
pendulum. Syst. & Contr. Lett., 44(1):41–56, 2001.
except for a set of zero measure. The energy shaping is
based on a family of energy functions which provide a [12] B. Srinivasan, P. Huguenin, K. Guemghar, and D. Bonvin.
Hamiltonian structure for the pendulum. A damping- A global stabilization strategy for an inverted pendulum. In
15th IFAC World Congress, 2002.
pumping term is added to provide damping around the
desired equilibrium to change it from being stable to [13] M. Wiklund, A. Kristenson, and K. J. Åström. A new
strategy for swinging up an inverted pendulum. In Proc.
being asymptotically stable. Negative damping (energy IFAC 12th World Congress, volume 9, pages 151–154, 1993.
pumping) is introduced in the region around the un-
desirable equilibria to make them unstable. To accom-
plish this damping and pumping strategy a new concept
of circumscribing ovals has been introduced. A stability
criterion has been stated and proven. The resulting con-
trol law avoids any commutation between different sub-
controllers. An open problem is the performance com-
parison of the different choices for potential energy func-
tions as well as for the circumscribing ovals. Modifica-
tions to the control law for the case of saturated control
signal have also been studied.
1848