Copyright © IFAC Nonlinear Control Systems, Stuttgart, Germany, 2004
ELSEVIER
IFAC PUBLICATIONS www.elsevier.comllocarelifac
KINETIC ENERGY SHAPING IN THE INVERTED PENDULUM J. Aracil' J .A. Acosta' F. Gordillo'
• Escuela Superior de Ingenieros Universidad de Sevilla Camino de los Descubrimientos sin 41092 - Sevilla, Spain email:{aracil.jaar.gordillo}@esi.us.es
Abstract: In this paper, a new control law for the pendulum on a cart is proposed. The novelty of the new control law is in the combination of methods that is used to obtain it. First, a control law for transforming the pendulum subsystem in a Hamiltonian system is obtained. The resulting Hamiltonian function has a maximum at the desired position. The objective of the second step is to inject energy (so the pendulum subsystem tends to the maximum of the Hamiltonian) at the same time that the cart is stopped. It is shown that both objectives can be solved using forwarding, which in this case yields solvable partial differential equations. Copyright © 2004 lFAC Keywords: Energy shaping, forwarding, inverted pendulum.
1. INTRODUCTION
can be accomplished by means of a variant of forwarding (Sepulchre et al., 1997; Mazenc and Praly, 1996; Praly et al., 2001), which with the previous choices yields solvable partial differential equations (PDEs). Nevertheless, due to the fact that the first subsystem is not GAS, the usual forwarding stability result does not apply and a proof of asymptotical stability has been included. The resultant control law has strong similarities with the one proposed in (Bloch et al., 2000) but it shows some differences. Among them, it has different tuning parameters that allows us to improve the performance of the closed-loop system as is shown by means of simulations.
In this paper, the problem of stabilization of the inverted pendulum on a cart is addressed. This problem has been solved by means of several methods in the literature.The novelty of the new control law is the combination of methods that is used to obtain it. In a first stage, an energy shaping law (van der Schaft, 1989) is obtained for the pendulum subsystem. The only consideration of this subsystem greatly simplifies this step. An interesting feature of the approach presented here is that the kinetic energy is shaped instead of the potential energy. This approach yields the consideration of negative masses and the use of the Lyapunov criteria with opposite sign as usual. The subsequent benefits of this choice justify this weak nuisance.
2. SYSTEM DESCRIPTION AND STATEMENT OF THE PROBLEM
In the second stage, two objectives are pursued: damping injection (that in our case is actually energy injection) and extension of the control law to the cart subsystem in such a way that the cart is also stopped. It is shown that both objectives
Consider the pendulum on a cart, which is one of the most widely-studied cases of underactuated control systems. This system is well-known and it is shown in Fig. 1, where the main physical
1063
parameters are identified. The Lagrangian of the pendulum on a cart is L =
~(aIF + 2,8 cos 808 + "'(82) 2
The approach proposed here consists of acting on the zero dynamics to change the saddle point at the origin to a center, that is, to have a maximum of the energy at the equilibrium point. Only the dynamics of the pendulum (Eq. (7)) are considered in the next section, while Section 4 deals with the whole system.
w5(cos8 -1) (1)
where a = ml 2 , {3 = ml, 'Y = M
+ m,
and
w~ = mgl. This notation is very similar to the
one in (Bloch et al., 20(0) in order to facilitate the comparison. Based on Eq. (1), the Euler-Lagrange equations become
aO + {3 cos (Js - w~ sin (J = 0
(2)
+ 'Ys + {3 sin (J02 = u.
(3)
{3 cos (JO
3. CONSERVATIVE LAW First, we focus in the pendulum system (Eq. (7)) aiming to convert it in a Hamiltonian system (van der Schaft, 1989) (without damping) with a desired Hamiltonian function. Later we will consider the problem of damping injection and extension to the cart subsystem. As it is wellknown the energy of the pendulum subsystem (Eq. (7)) has a minimum at ((J,O) = (11",0) and a saddle point in ((J,O) = (0,0). In order to stabilize the pendulum in the upright position using energy shaping one possibility is to shape the potential energy in order to have a minimum of the whole energy in the upright position. Here we use a different approach: we look for a maximum of the energy at the desired position and, thus, the desired kinetic energy should have a maximum at this upright position. To this end we propose the desired energy as
Fig. 1. Pendulum on a cart. As is well known (see, for instance, (Spong, 1998)), Eqs. (2) and (3) can be partially linearized (and, thus, partially decoupled). From (2),
O=-~({3cos(Js-w~sin(J) a
is obtained; which with (3), leads to ,82 cos 2 8) ,8w • a +~sin8cos8-,8sin882=u.(5) 2
ij"'Y-
(
By making s = v in this last equation we obtain
which defines an inner feedback law that partially linearizes the system. This controller converts Eqs. (2) and (3) into
aO - w~ sin (J = - {3 cos (Jv
s=v,
~(a + f((J))02 + w~(cos(J -
Hd =
1),
(9)
(4) where the kinetic energy has been changed adding a function f((J) to the original mass a in such a way that a + f((J) < 0 in the domain of interest. In this way H d has a maximum at the desired point. Thus, in closed loop we look for a system with negative kinetic energy. It should be realized that the same happens in (Bloch et al., 2(00). The condition a + f < 0 limits the domain of attraction of the desired equilibrium in the closedloop system 1 . In order to fulfill the matching conditions (Ortega et al., 2001), the corresponding Hamiltonian system has to be
(7)
(8)
which is the partially linearized fonn of the equations of the pendulum on a cart. From (7) and (8) it is clear that v = 0 defines an invariant manifold in the state space. The dynamics of (J in this manifold represents the zero dynamics of the system with respect to v and (J.
From Eq. (10)
.. (J = -
~ f' ((J)02 - w~ sin (J
a
+ f((J)
,
(11)
1 With the choice of f(8) that it is considered below, 181 < 1r /2 in the domain of attraction (the pendulum is above the horirontal) and thus, this law is not suitable for swinging up the pendulum, neither is the one proposed in (Bloch et al., 2(00).
The goal is to stabilize the pendulum at the upright position and to stop the cart. Notice that the zero dynamics have a saddle at the desired equilibrium point, and not a stable point.
1064
is obtained, which is the desired closed-loop behavior. On the other hand, remembering Eq. (7), the open loop is given by .. w~ {} = -
a
{3
(12)
sin {} - - cos {}V C ,
a
where VC has been used instead of v because for the moment we are interested in the conservative behavior of the closed-loop system. Matching openloop (12) and closed-loop (11) equations yields -
t1'({})iP - w~ sin{} a
+ f({})
the Hamiltonian, energy must be injected instead of damping) as well as to deal with the cart dynamics. We can cope simultaneously with both objectives by means of forwarding as it is shown in this section. The idea is to modify the previous control law by using forwarding in order to have a GAS system in closed loop for the whole system. Introducing in system (7)-(8) v = VC + vd with VC given by (13) and vd to be determined, results:
8=sinB-cosOvC(B,B) -cosBv d s=vC(B,B)+v d.
w~. (3 C =-sm{}--cos{}v. a a
After some algebraic manipulations we obtain
(a + f({}))v = k sin {}(w~ cos B-
a0
2
Consider a Lyapunov function candidate of the form: Al 2 V=Hd--v 2 with (a + f(B)) < 0, Al > 0 and v(B, B, s) a function to be determined. The time derivative of V is
),
which leads to
VC =
ksinB(w5 cos{} a + f(B)
a0 2 )
(13)
It is worth noting that control law (13) is the same as the one obtained in (Bloch et al., 2000) by the method of the controlled Lagrangians. This can be easily checked by substituting Eq. (13) into Eq. (6), yielding
C
u =
(k'Y
+ (3) sinB(w~ cosB- a( 2 ) a + f({}) ,
(16)
The pendulum subsystem is not GAS and, thus, usual stability forwarding results (Sepulchre et al., 1997; Mazenc and Praly, 1996) do not apply. Nevertheless, a procedure quite close to the usual one can be applied provided the stability of the resultant system is checked at the end.
1· w2 (a + f({})) - cos {}V C = -2 l' ({}){}2 - f -2.. sin {}. a a By making in this equation f({}) = k{3 cos 2 {}, with k < 0 (other elections are possible, this choice has a great advantage as it is shown below), and assuming -1r /2 < {} < 1r /2, we obtain {3
C
(15)
with
dVl = (a + f({}))
2
(
f'(B) '2 +-{} 2
(14)
dV2 which is the same as (1.18) of (Bloch et al., 2(00), because it is easy to show that -(k'Y + (3) = /{,{3, where /{, is a parameter introduced in (Bloch et al., 2000).
= -A1V
w: sin{} - ;(3 2
cos{}V C)
.
(17)
Wo sin O{}
av. + -:av (w5 . - smB-(3 cos{}v ( -{} aB aB a a
v c) +-av as
dV3 = vd
The pendulum will oscillate in a non-structurally stable way under control law (13) or (14). Figure 2 shows the simulation results for a value of k < 0 such that a + f({}) < 0 and, therefore, the kinetic energy is negative. The equilibrium point at the upright position becomes a center. It is easy to see that, in this case, Bd = 0, i.e., function H d is a conserved quantity. In the absence of damping the pendulum evolves as the natural hanging pendulum, but now oscillating around the upper vertical line.
c) (18)
(-(a + J)~BCOSB
-A1V
av av)) : -(3 - cosB + --;( - -aB a as
.
(19)
The term dVl is equal to Bd when v = VC and, thus, it is equal to zero due to the choice of vc. The method consists in looking for a function v such that the term dV2 is equal to zero and looking for vd such that the term dV3 is non-negative. The condition dV2 = 0 leads to the following PDE
av· av·· av aB {} + aB {} + as s
=
o.
This is the PDE found when forwarding is applied. Usually, it is cumbersome to solve it. However, in our case the solution is greatly simplified. As the time derivatives of B, Band s depend only on B and B, the solution of this PDE is of the form v = s - M(B, B) and the equation reads
4. DAMPING INJECTION AND EXTENSION TO THE CART Once the conservative law has been obtained, the next steps are to introduce energy injection (notice that, as the desired point is a maximum of
1065
20
0
0.5
~
., -20 .
o.
~
-40 . -60
0
~-o.5
5
10
15
-1
20
Time [sI
10r---~--~:"":""_----,
.
.
00
--.-.
-1
15
0.5
-0.5
-20'---~~----'--~-------'
-2'---~~-~~-~----'
10
...... /
."'-. .
10 r---~--:""-=':;"=------,
2r---~--~--~---,
5
20
-2'-----~--~-~~---'
20
s
o
15
.~
~O
o
-20
10
Time [sI
r·
l
.~-1
.
-2O'-----~--~--~---'
-60
5
0
2
~,: .• ~.• • a)
.
o
20
Time [SI
5
10
15
20
Time [SI
Fig. 2. Simulation of the pendulum on a cart with control law (14).
ao °+ ao 0= VC(O, 0),
aM·
aM··
.
With this control law, stability in the sense of Lyapunov is guaranteed since V ~ 0 but the strict inequality has not been achieved. In order to proof asymptotical stability LaSalle invariance principle can be used resulting the following proposition:
that is (20)
Proposition 1. The origin of system (2)-(3) with control law given by (6), and v = VC + vd using (13) and (21) is locally asymptotically stable. Its domain of attraction includes the set in the interior of the largest level surface of V that does not cross the value of 0 fulfilling et + f(O) = o.
But it can be easily checked that 2 . d . VC(O,O) = dt (kO cos 0), and, thus,
M(O,O) = kOcosO. Now, vd will be chosen so that the term dVa is nonnegative. Looking at (19) this can be achieved by choosing
Proof First, let us formulate the system with the coordinate transformation l/ = 05 - kO cos 0, resulting ..
w~
0= -
et
V=
et
{3 . {3 sin 0 - - cos OVc(O, 0) - - cos OVd (22) et
+ f(O) Vd.
et
(23)
et
From the definition of V, it qualifies as a Lyaet+f ( . .) v d = ->'2{30 cos 0 + >'1(05 - kOcosO) (21) punov function candidate in the domain defined et in the statement of the proposition a . From the Remark 1. Using v = vc+v d with VC and vd given previous choice of vd, V ~ O. Let us determine respectively by (13) and (21) and substituting in the invariant set for which V = O. From the choice (6) a controller with a structure similar to the one of VC and vd it is clear that V = 0 if and only if of (Bloch et al., 2000) is obtained. Nevertheless, vd = O. From (23), v = O. Thus, v is constant the controllers are different. Notice that our tuning parameters are >'1 and >'2 (apart from k).
v = Vo.
As we are using negative masses, we have to use Lyapunov criteria in the opposite way as usual: V is negative definite and V has to be positive definite. 3
It should be realized that this property is associated with the choice of /(8) above.
2
1066
Moreover, vd = 0 implies 1/ = -{3cosOO/)..t (from (21)), but as 1/ is constant so is cos 00. This fact and (20) yield VC = O. Therefore, the residual dynamics for V = 0 are
.. wo 2 0= -sinO
(24)
1/=0
(25)
o
Equation (24) represents the dynamics of a simple pendulum without friction, with energy function E = ~002 + wo 2 cos 0, which is a constant of motion, as it is well-known. But we have another constant of motion in this residual dynamics, namely cos 00 = Ct. Substituting 0 from the latter constant of motion in the energy function yields the following equation Ct)2 E = -21 0 ( --0 +wo 2 cos 0, cos
resultant control law has been compared with the one obtained in (Bloch et al., 2(00) showing an interesting similarity. Simulations results show the good performance that it is achieved with the new law. Acknowledgments This work has been supported under MCyT-FEDER grants DPI200300429 and DPI2oo1-2424-C02-01.
6. REFERENCES Bloch, A., N. Leonard and J. Marsden (2000). Controlled lagrangians and the stabilization of mechanical systems I: The first matching theorem. In: IEEE Trans. on Automatic Control. Vol. 45, No. 12. pp. 2253-2270. Academic Press. San Francisco, USA. Mazenc, F. and L. Praly (1996). Adding integrations, saturated controls and stabilization for feedforward systems. IEEE Transactions on Automatic Control 41(11), 1559-1578. Ortega, R., A.J. Van Der Schaft, I. Mareels and B. Maschke (2001). Putting energy back in control. IEEE Control Systems Magazine 21(1), 18-33. Praly, Laurent, Romeo Ortega and Georgia Kaliora (2001). Stabilization of nonlinear systems via forwarding modL g V. IEEE Transactions on Automatic Control 46(1), 14611466. Sepulchre, R., M. Jartkovic and P. Kokotovic (1997). Constructive Nonlinear Control. Springer-Verlag. Spong, M.W. (1998). Control problems in robotics and automation. Chap. Underactuated mechanical systems, pp. 135-150. Springer. Berlin. van der Schaft, A. (1989). L 2 -Gain and Passivity Techniques in Nonlinear Control. SpringerVerlag.
(26)
where E and Ct are constants. This equation has, at most, three isolated solutions for 0 and, therefore, 0 = O. In a single pendulum this can only happen in the domain of interest for 0 = o. <1
The resultant closed-loop system has been simulated using the same system parameters as in (Bloch et al., 20(0) (corresponding to 0 = 0.0065, {3 = 0.03, w~ = 0.295 in our model). Figure 3 shows similar results to the ones of (Bloch et al.,2oo0) (the tuning parameters are k = -7.06, )..t = 0.01 and )..2 = 1). Nevertheless, the performance can be improved using other values of )..t and )..2. Figure 4 shows the results for the same value of k, At = 0.001 and )..2 = 0.2 (notice the difference in the time scales).
5. CONCLUSIONS In this paper the possibilities of energy shaping have been explored through its application to the pendulum on a cart. The methodology is applied to a well-known example of an underactuated system: the inverted pendulum on a cart. In this problem, energy shaping has been combined with forwarding to achieve the goal. Energy shaping has beeR applied to the pendulum subsystem. Forwarding has been used for two purposes: on the one hand, the usual one for extending the control law from a low-dimensional system to the whole system and on the other hand for introducing damping (energy injection in our case), which is necessary since the proposed control law for the low-dimensional system is conservative. Due to the fact •that the standard forwarding procedure has not been used, it has been necessary to include a proof of asymptotical stability. The
1067