El péndulo invertido: un banco de pruebas para el control no lineal Javier Aracil and Francisco Gordillo Escuela Superior de Ingenieros Universidad de Sevilla XXV Jornadas de Automática Ciudad Real, 8-1 septiembre 24
Outline 1. Introduction to the inverted pendulum. 2. Potential energy shaping. 3. A damping-pumping strategy. 4. A control law stopping the car for the swing up problem. 5. Periodic oscillations in the inverted pendulum. 6. Conclusions.
Introduction Pendulum on a cart Furuta pendulum
The swing-up problem
Solutions for the inverted pendulum Many Problems Hybrid Control Balancing Swing-up Commuting Single Law Smooth...?
Energy injection Single pendulum model J θ = mgl sinθ + u cos θ. Single pendulum energy E = 1 2 J θ 2 + mgl(cos θ 1), then and the controller is Ė = u θ cos θ, u = k(e ref E) θ cos θ.
Shape of the Energy for the simple pendulum
Full system model Full system model (J p + ml 2 )( θ ϕ 2 sinθ cos θ) + mrl ϕ cos θ mglsin θ = mrl θ cos θ mrl θ 2 sinθ + 2(J p + ml 2 ) θ ϕ sinθ cos θ +(J + mr 2 + (J p + ml 2 ) sin 2 θ) ϕ = F. Partially linearized model ẋ 1 = x 2 ẋ 2 = sinx 1 cos x 1 u ẋ 3 = u The best-known swing-up law (M. Wiklund et al., 1993; Åström and Furuta, 2) is based on a dimension 2 model. Dimension two model neglects the reaction torques from the pendulum to the arm.
Potential energy shaping Normalized equations of the pendulum subsystem ẋ 1 = x 2 ẋ 2 = sinx 1 cos x 1 u Potential energy shaping with Hamiltonian function H d (x 1, x 2 ) = V d (x 1 ) + x2 2 2, Closed-loop system in generalized Hamiltonian form is ẋ1 = 1 D x 1 H d ẋ 2 1 k D x2 H d, Target system (conservative case) for k =. ẋ 1 = x 2 ẋ 2 = V d (x 1) kx 2.
Simplest V d V d = cos x 1 but it leads to the control law u = 2 tanx 1 which is unbounded for x 1 = π 2.
V d should be such that Solving the matching problem and, for the conservative case u = β(x 1 ). Good choice for β(x 1 ) = sinx 1 β(cos x1 ). V d = sinx 1 cos x 1 β(x 1 ), Further conditions V d (x 1 ) = V d ( x 1 ) and V d (x 1) = V d ( x 1). V d = a + cos x 1 a 2 cos 2 x 1 a 3 cos 3 x 1, and then V d = D x1 V d = sinx 1 + 2a 2 sinx 1 cos x 1 + 3a 3 sinx 1 cos 2 x 1 +... = sinx 1 + sinx 1 cos x 1 (2a 2 cos x 1 + 3a 3 cos 2 x 1 +...),
Shape of H d for different V d H d =x 2 2 /2 + cosx1 2cos 2 x 1 H d =x 2 2 /2 + cosx1 2cos 2 x 1 2cos 3 x 1 5 5 H d 5 H d 5 1 1 x 1 /π 1 1 x 2 /π 1 1 1 x 1 /π 1 1 x 2 /π 1 H d =x 2 2 /2 + cosx1 2cos 2 x 1 2cos 3 x 1 2cos 4 x 1 H d =x 2 2 /2 + cosx1 2cos 2 x 1 2cos 3 x 1 2cos 4 x 1 2cos 5 x 1 1 1 H d 1 H d 1 2 1 x 1 /π 1 1 x 2 /π 1 2 1 x 1 /π 1 1 x 2 /π 1
Simple solution Case a 2 = a and a = a 2k+1 =, k V d (x 1 ) = cos x 1 acos 2 x 1 V d = sinx 1 + 2acos x 1 sinx 1. Shape of V d for a = 5 1 u = 2asin x 1 1 2 V d (x 1 ) 3 4 5 6 1.8.6.4.2.2.4.6.8 1 x /π 1
Shape of H d Shape of H d showing the good well for the upright position and the bad well for the hanging position.
Shape of H d Cut of H d showing the non-desired well for the hanging position.
Shape of H d Cut of H d showing the shape of the kinetic energy.
Adding damping ẋ1 ẋ 2 = 1 1 k cos x 1 D x 1 H d D x2 H d, Target system ẋ 1 = x 2 ẋ 2 = V d (x 1) kx 2 cos x 1. ẋ 1 = x 2 ẋ 2 = sinx 1 2acos x 1 sin x 1 kx 2 cos x 1, Feedback law However... u = 2asin x 1 + kx 2.
Curve V d.5.5 V d 1 1.5 2 6 4 2 2 4 6 x /π 1 Curve V d (x 1 ) = cos x 1 cos 2 x 1
Curve H d = 1 4a 2.5 2 1.5 1.5 x 2.5 1 1.5 2 2.5 2 1.5 1.5.5 1 1.5 2 x /π 1 Curve H d (x 1, x 2 ) = cos x 1 cos 2 x 1 + 1 2 x2 2 = 1 4a
A damping-pumping commuting strategy Hamiltonian H d (x 1, x 2 ) = cos x 1 acos 2 x 1 + 1 2 x2 2. Define ϕ(x 1, x 2 ) = k if H d (x 1, x 2 ) 1 4a and cos x 1 < 1 2a k elsewhere, with k > as a tuning parameter. ϕ(x 1, x 2 ) is negative inside the undesirable regions and positive elsewhere. Target system ẋ 1 = x 2 ẋ 2 = sinx 1 2acos x 1 sin x 1 ϕ(x 1, x 2 )x 2 cos 2 x 1.
A commuting control law u = 2asin x }{{} 1 + ϕ(x 1, x 2 )x 2 cos x 1 }{{} u c u d, H d = ϕ(x 1, x 2 )x 2 2 cos 2 x 1. Lyapunov function candidate: V = ϕ = ϕ(x 1, x 2 ) ( cos x 1 acos 2 x 1 + 1 2 x2 2 1 ). 4a V is not differentiable at the switching curve. Outside this curve, V = ϕ 2 x 2 2 cos 2 x 1 V is a Lyapunov function except in the closed level curve V =. The switching curve is attractive. In fact a sliding motion is produced along the switching line.
Achieving almost-global stability To avoid the undesirable equilibria at the saddles, the switching curve is changed from H d = 1/4a to H d = 1/4a + ε with < ε 1. Substituting the switching function ϕ by ϕ ε (x 1, x 2 ) = k ( (H d (x 1, x 2 ) 1 4a ε)) if H d ( 1 4a + ε) and cos x 1 <.5 k elsewhere The control law is now: u = 2asin x }{{} 1 + ϕ ε (x 1, x 2 )x 2 cos x 1 }{{} u c u d Lyapunov function V = ϕ ε (x 1, x 2 )(H d 1 4a ε)
Level curves 2.5 2 1.5 1.5 x 2.5 1 1.5 2 2.5 2 1.5 1.5.5 1 1.5 2 x /π 1 Level curves H d = 1 4a (blue) and H d = 1 4a + ε (red)
Avoiding the sliding mode Sliding motions due to the discontinuity along the level curve H d = 1 4a + ε. Modify the switching function in such a way that it is equal to zero at both sides of the switching curve. Multiplying function ϕ ε by abs(h d (x 1, x 2 ) 1 4a ε), u d will be equal to zero at the level curve H d = 1 4a + ε avoiding the sliding motion. New switching function: ϕ ε (x 1, x 2 ) = k(h d (x 1, x 2 ) 1 4a ε) if cos x 1 <.5 k elsewhere
Simulations 2 x 2 2 1.5 1.5.5 1 1.5 5 x /π 1 x 1 5 1 2 3 4 5 5 Time [s] u 5 1 2 3 4 5 Time [s] Results of a simulation with a = 1, ε =.25 and k =.2. Initial conditions: hanging position at rest. Animation
Simulations 2 x 2 2 1.5 1.5.5 1 1.5 6 x 1 /π 4 x 1 2 2 2 4 6 8 1 12 14 16 18 2 Time [s] 4 2 u 2 2 4 6 8 1 12 14 16 18 2 Time [s] Results of a simulation with a = 1, ε =.25 and k =.6. Initial conditions: hanging position at rest.
Trajectory leaving the well 8 7 6 5 Time [s] 4 3 2 1 4 2 x 2 2 4.5.5 x 1 /π 1 1.5 2 Trajectory leaving the well and reaching the up-right position, for k =.2.
Stopping the cart To cope with the cart, we add a new term v to the control u = 2asin x 1 + ϕ ε x 2 cos x 1 + v. Without v, once the pendulum has reached the inverted position, then x 1 = x 2 =, but x 3 = (2asin x 1 + ϕ ε x 2 cos x 1 )dt. So the system becomes ẋ 1 = x 2 ẋ 2 = sinx 1 2asin x 1 cos x 1 ϕ ε x 2 cos 2 x 1 cos x 1 v ẋ 3 = 2asinx 1 + ϕ ε x 2 cos x 1 + v.
Feedforward control Making [x 1 x 2 ] T = ξ and x 3 = z, the system equations can be written in the standard feedforward form ż = h(ξ) + g 1 (ξ)v ξ = f(ξ) + g 2 (ξ)v. Following Astolfi and Kaliora s suggestion, we adopt the control law ( ) λx3 v = ε 2 σ, where σ is the saturating function σ(y) = sgn(y) min{ y,1}. ε 2 Therefore, ( ) λx3 u = 2asin x 1 + ϕ ε x 2 cos x 1 ε 2 σ. ε 2
Simulations a=1 k=.5 λ=.1 ε=.25 ε 2 =.1 2 x 2 2 1.5 1.5.5 1 1.5 5 x /π 1 x 1 5 2 4 6 8 1 1 Time [s] x 3 5 5 2 4 6 8 1 Time [s] Animation
Periodic oscillations Target system ẋ1 ẋ 2 = 1 Γ 1 Γ k Γ Γ x 1 Γ Γ x 2 where Γ = is a curve that represents the limit cycle., Γ = x 2 1+x 2 2 µ, where µ is the square of the radius of the limit cycle circumference. In this case above equations lead to ẋ 1 = x 2 ẋ 2 = x 1 kγx 2. This system is an oscillator with a nonlinear damping.
Lyapunov function for an oscillating system The system of the previous slide has as Lyapunov function V = Γ 2 /4
Feedback law Matching open and closed loop we obtain u = x 1 + kγx 2 + sinx 1 cos x 1, which renders the pendulum periodically oscillatory with a limit cycle given by x 2 1 + x 2 2 = µ. Due to cos x 1 in the denominator, feedback law is restricted to the domain x 1 < π/2.
Simulations 1 x 2 1.4.3.2.1.1.2.3 1 x /π 1 x 1 1 5 1 15 2 25 3 35 4 2 Time [s] u 2 5 1 15 2 25 3 35 4 Time [s]
Add a new term v to the control Closed loop system Taking the cart into account u = x 1 + kγx 2 + sinx 1 cos x 1 + v. ẋ 1 = x 2 ẋ 2 = x 1 kx 2 Γ cos x 1 v ẋ 3 = x 1+kΓx 2 +sin x 1 cos x 1 + v. Proceeding in a similar way as for the swing up problem we shoyld adopt the control law u = x ( ) 1 + kγx 2 + sinx 1 λx3 εσ. cos x 1 ε Animation