Composite Control For Inverted Pendulum System: Yo-Han Kwon, Beom-Soo Kim, Sang-Yup Lee, Myo-Taeg Lim
Composite Control For Inverted Pendulum System: Yo-Han Kwon, Beom-Soo Kim, Sang-Yup Lee, Myo-Taeg Lim
1, March, 2002
Abstract: A new composite control method for a carriage balancing single inverted pendulum system is proposed and applied to
swing up the pendulum and to stabilize it under the state constraint. The target inverted pendulum system has an extremely limited
length of the cart(below 16cm). The proposed swing-up controller comprises a sliding mode control algorithm and an optimal control
algorithm based on two regions: the region near the inverted unstable equilibrium position and the rest of the state space including
the downward stable equilibrium position. The sliding mode controller uses a switching control action to converge along the specied
path(hyperplane) derived from energy equation from a state around the path to desired state(standing position). An optimal control
method is also used to guarantee the stability at unstable equilibrium position. Compared with the reported controllers, it is simpler and
easier to implement. Experimental results are given to show the effectiveness of this controller.
Keywords: inverted pendulum, swing-up control, sliding mode control, optimal control, nonlinear control
where mc is mass of cart, m1 is mass of pendulum, and l is the III. Optimal controller design
length between the center of mass of the pendulum and the axis. In this section, we design an optimal controller to stabilize the
Thus we can obtain the kinetic energy T as follows: pendulum around the zero state by using the linearized model.
2 At the target point (θ = 0) we can obtain the linearized model
1 1 1
T = mc ẋ2 + m1 ẋ + lθ̇ cos θ + l2 θ̇2 sin2 θ + J θ̇2 under the following assumptions.
2 2 2
(3) θ̇ = 0, cos θ ≈ 1, sin θ ≈ θ (9)
Potential energy of the inverted pendulum is given by (4). Ac-
tually the potential energy of the cart is unchanged. We can obtain the linearized model (10) by using (8) and (9)
˙ = AX̄ + Bu (10)
V = Vcart + Vpendulum (4) X̄
Fig. 2. Natural behavior of CBSIP system. pendulum is close to the inverted vertical state(normally within
±10◦ ). Generally, increasing ks leads to decrease swing-up
1. Swing up control
time and to increase the required rail range. The described
The nonlinear system represented by (8) has a stable equilib- swing up control method can achieve the goal within the short-
T
rium at X̄1 = xc π 0 0 , and an unstable equilibrium est time when ks is the maximum of bounds of input.
T To switch between the swing-up control and the optimal con-
at X̄2 = xc 0 0 0 . Both of these equilibrium points
trol described in Section III.
, we consider three important fac-
can be obtained with an arbitrary carriage position xc , therefore
tors[11].
the carriage's position control is possible. Without the control
1. The closed-loop system with the optimal control has a re-
(u = 0), the system's natural behavior
can be observedT
by re-
stricted stable state region around the origin because the con-
leasing it from the initial state X̄1 = 0 θ0 0 0 , where
troller design is based on the linearized system.
θ0 6= 0◦ and θ0 6= 180◦ . At the θ0 = 10◦ the numerical so-
2. The nal state of the swing up control must not force the
lution of (8) is computed and shown in Fig. 2. The natural be-
carriage beyond the available rail range.
havior of the system is damped vibration of both the pendulum
3. During the swing up control the pendulum should not be
and the carriage. Two important factors can be observed from
allowed to go over the top.
the system's natural behavior: (i) due to the translational and
The ideal swing up controller is that θ̇ equals to zero at θ = 0.
the rotational friction, each amplitude of the pendulum and the
But, using an arbitrary value of ks , we can not guarantee θ̇ = 0
carriage decreases with the time; and (ii) by decreasing ampli-
at θ = 0. Therefore we use a sliding mode controller so that for
tudes, the circular frequency of the vibration increases with the
an arbitrary ks an angular velocity ω is close to zero near the
time, which is a nonlinear characteristic. In order to swing-up
target point.
the pendulum toward the inverted vertical position, its kinetic
3. Sliding surface design
energy level must be increased. In this system, it is achieved
Sliding mode control, often referred to as variable struc-
by applying force to the carriage, and this force must be large
ture control, is a high-speed switching feedback control that
enough to overcome the friction. The direction and the ampli-
switches between two values based upon some rules to drive
tude of the input force are controlled to increase the pendulum's
the nonlinear plant's state trajectory onto a specied switching
kinetic energy, despite the difculties that (a) the force u applies
surface in the state space.
to the pendulum indirectly through the carriage, (b) the vibra-
To design an appropriate switching surface, the plant having
tions of the pendulum and the carriage are nonlinear, and (c)
a restricted switching surface must respond in a desired manner
there is a phase-lag between these two vibrations[11].
and the switching control law satises a set of sufcient con-
When the total energy of the pendulum equals to the pendu-
ditions for the existence of sliding mode. The next important
lum's potential energy at the inverted vertical position, the pen-
aspect of sliding mode control is to guarantee the existence of a
dulum will be swung up to its upright position. Applying the
sliding mode.
Fig. 3. Carriage Balancing Single Inverted Pendulum System. The sliding mode exists when the state trajectory x(t) of the
controlled plant satises the sliding surface S(x(t)) = 0 at ev-
force to the cart in the direction of Fig. 3 until l sin θ = 0 ac- ery t ≥ t0 for some t0 .
cording to the nonlinear vibration of the pendulum reduces the The hyperplane for the inverted pendulum system is designed
calculation efforts and increases the pendulum's energy within to execute both swing up and stabilization of the pendulum. It
short movement of the cart. Thus we can obtain the swing up is desirable to design the hyperplane for unstable structure with
control law as follows: small damping from the energy balance. To design the hyper-
plane for the pendulum, we use the energy equation of the pen-
us = −ks sin θ (15) dulum given by [12][14]
The swing up control (15) requires an assumption that the rst E=
1 2
J θ̇ + mgl(cos θ − 1) (17)
initial value of θ is not ±nπ , n = 1, 3, 5, · · · . The efcient 2
swing up way is to apply the force at the frequency of pendu- where E = 0 at the standing position. In [12], the author de-
lum's nonlinear vibration to drive the pendulum into resonance signed a sliding mode controller with an observer by using the
in a controlled manner. To change the energy as fast as possible, energy equation (17) to suppress the chatter of control input. In
the magnitude of control signal should be as large as possible. [14], the authors used a bang-bang strategy based on the the en-
Therefore we can rewrite (15) as follows: ergy equation (17). When E = 0, the pendulum will be stood
without the control input. We can obtain the hyperplane of the
us = −ks sgn(sin θ) (16)
pendulum by letting E = 0 in (17).
where r
J p
( 0= θ̇ + 2(1 − cos θ)sign(sin θ) (18)
1 if x ≥ 0, mgl
sgn(x) =
−1 if x < 0 where
8
By using (16), we can relax the initial condition constraint. >
>
<1 if x > 0,
2. Tuning and switching condition
sign(x) = 0 if x = 0,
The tuning of ks depends on the following two factors: the >
>
:−1 if x < 0.
required rail range and the required swing-up time at which the
Transactions on Control, Automation and Systems Engineering Vol. 4, No. 1, March, 2002 87
(18) represents the relation between θ and θ̇ which makes the V. Simulation and experimental results
pendulum converge to the origin. Fig. 4 shows this relation. In this section, we compare the proposed method with the
If there exists an input which makes the state track the trajec- Takeshi Kawashima's sliding mode control algorithm[12] and
tory in Fig. 4, then the pendulum eventually converges to the Alan Bradshaw's method [11] by numerical simulation. And
origin. Therefore (18) can be directly a hyperplane of sliding then experimental results are described to demonstrate the pro-
posed method.
Fig. 4. State trajectory using energy equation.
In Takeshi Kawashima's sliding mode control algorithm [12],
the control law u and the hyperplane s are as follows:
mode control and we can rewrite hyperplane equation as fol-
lows: f1 p f3 dx f4 dθ
r s= x + 2(1 − cos θ)sign(sin θ) + +
J p f2 f2 dt f2 dt
s= θ̇ + 2(1 − cos θ)sign(sin θ) (19)
mgl (23)
γ·s
4. Sliding mode controller u = − α (|ueq | + ) (24)
Now we consider the sliding mode controller design method |γ · s| + µ
considering the extremely limited rail length. The purpose where
of general sliding mode control is searching for control in-
put which makes all states in the state space converge to the ueq =G
F (X̄, t)
, G=
∂s
, γ = GB(X̄) 6= 0,
hyperplane. The previously described swing up control law γ ∂ X̄
us = −ks sgn(sin θ) makes states approach near to s = 0. α =4, = 0.1, µ = 0.01
We design the sliding mode controller by using the following
Lyapunov function and f = f1 f2 f3 f4 is a feedback gain of the optimal
1 control derived by using the linearized model at the standing
v = sT s position. Alan Bradshaw's method [11] is as follows:
2
∂s ˙ ˙
v̇ =sT ṡ = sT X̄ = sT GX̄ (20) us =ks ω (25)
∂ X̄
h q i
u =f ∗ X̄ (26)
In (20), G = 0 | cos θ2 | 0 J
mgl
, v is a positive
denite matrix, and v̇ is a negative denite matrix. It is difcult Fig. 5 and Fig. 6 show the results when the rail length is re-
to obtain a Lyapunov function which satises (20) by analytic stricted to 80cm.
method. Thus we design a control law by using the following
physical concept. The control law in (16) applies a force to Fig. 5. Time history of CBSIP system (the rail space is restricted
the cart according to the nonlinear movement of the cart, which to 80cm).
increases the angular velocity by repeating the swing up op-
eration and the states reach the designed sliding surface. The
Fig. 6. Phase plane of CBSIP system (the rail space is restricted
reference angular velocity dened on the sliding surface is eas-
to 80cm).
ily calculated by referring to the corresponding angle. If the
angle belongs to a range of 90◦ to 270◦ and exceeds the corre-
sponding reference angular velocity, then the force is applied to Fig. 7. Time history of CBSIP system (the rail space is restricted
the cart from the opposite direction to decrease the angular ve- to 16cm).
locity. When the angular velocity does not reach the reference
angular velocity, the control law (16) is applied to increase the
angular velocity until the angular velocity reaches the reference Fig. 8. Phase plane of CBSIP system (the rail range is restricted
angular velocity. In the range of 270◦ to 90◦ , we use a contrary to 16cm).
control law described in (21).
π 3π In Fig. 5, Takeshi Kawashima's sliding mode controller uses
≤θ< : us = −ks sign θ̇ − θ̇ref sgn (sin θ)
2 2
the full rail length (80cm), but the proposed controller uses only
3π
≤θ< :
π
us = ks sign θ̇ − θ̇ref sgn (sin θ) the half range of rail and the pendulum converges to the target
2 2 point. Moreover, in the proposed control method, the displace-
(21)
ment of the cart rapidly converges to zero. Fig. 7 and Fig. 8
The control laws dened in (21) can be rewritten as follows: show the results when the rail length is restricted to 16cm. In
us = − ks sign θ̇ − θ̇ref sgn (cos θ · sin θ) this case, Takeshi Kawashima's method fails to converge. Alan
p Bradshaw's swing up controller cannot generate energy enough
= − ks sign s − 2 2(1 − cos θ)sign(sin θ) to swing up. On the other hand, using the controller designed
in this paper we can see that the pendulum converges to origin
× sgn (cos θ · sin θ) (22)
within 2.5 second.
where θ̇ and θ̇ref are obtained from (19) and (18) respectively. Actual experiments have been done by TMS320C32 DSP
We veried that the s, especially −0.6 < s < 0.6, around used as the controller with a sampling time of 500 µsec, a ro-
s = 0 converges to the s = 0 and the v in (20) is positive tary encoder with 2000 pulse/rev, and a liner motor used as a
denite and the v̇ in (20) is negative denite by simulation with cart. The linear motor specication is described in Table I. The
the designed control law. physical parameters of the inverted pendulum system are given
88 ICASE: The Institute of Control, Automation and Systems Engineers, KOREA Vol. 4, No. 1, March, 2002
in Table. II. The snapshot picture of this inverted pendulum con- used to stabilize the pendulum around the zero state, where the
trol system is shown in Fig. 9. The pendulum is mounted on the control switching boundary value is θ = ±10◦ . Thus in Fig.
linear motor. It can be observed in Fig. 10 that the pendulum 10 and Fig. 12, the input trajectories around the target point
is maintained at the upright equilibrium position within 3.5sec. θ = 0◦ are obtained by using the optimal control algorithm de-
The corresponding phase plane trajectory is given in Fig. 11. scribed in section III and show weak chattering phenomena
rather than the results of Takeshi Kawashima's sliding mode
Table 1. Linear motor specication control method[12] shown in Fig. 5 and Fig. 7. The experimen-
Parameter Unit Value tal result in Fig. 10 is similar to the simulation result in Fig. 7
Peak Current amp RMS 8.18 including the control input.
Continuous Current amp RMS @ 25 ◦ C 3.7
Resistance ohm 5.2 VI. Conclusion
Force Constant N/amp 26.20 The main purpose of this paper is to design the swing up con-
Back EMF volts RMS/m/s 21.59 troller and stabilizing controller under the environment of ex-
Thermal Resistance ◦
C /W 1.407 tremely limited movable length of cart. To guarantee acceptable
Electrical Time Constant msec @ 25 ◦ C 0.6 performances in spite of the input and state constraint, the whole
control algorithm comprises a sliding mode control based on
the nonlinear model for swing up the pendulum and an optimal
Table 2. Parameters of the system control to stabilize by using the linearized model. The simula-
Parameter Value Unit tion results and the experiment results under the state constraint
showed that the control performance was very good. The pro-
mass of cart mc 2.5 Kg
posed control method is robust to an external disturbance.
maximum cart movable
distance from the center of 80 mm
the rail (xmax )
maximum force (M ) 4 N
length of the pendulum (l) 400 mm
mass of the pendulum (m1 ) 0.088 Kg
diameter of the pendulum 6 mm
moment of the inertia of the
pendulum (J ) 0.00117 Kg · m2
pendulum friction coefcient (C ) 30 N ·m·s
References
[1] Y. H. Kwon, B. S. Kim, S. Y. Lee, and M. T. Lim, Design
of a swing up controller for inverted pendulum system,
Proc. of the 32nd International Symposium on Robotics, Yo-Han Kwon
on Industry Applications, vol. 36, pp. 452458, 2000. He received B.S degree in control and
[5] S. C. Brown and K. M. Passino, Intelligent control for instrumentation engineering from Korea
an acrobot, Journal of Intelligent and Robotic Systems, University in 2000. Currently, he is
vol. 18, pp. 209248, 1997. pursuing the M.S. degree in mechatron-
[6] M. W. Spong, Swing up control of the acrobot, IEEE Int. ics engineering from Korea University.
Conf. on Robotics and Automation, pp. 23562361, 1994. His current research interests include 3D
[7] H. Nishihara, S. Mori, and K. Furuta, Control of unstable motion estimation, and LMI-based con-
mechanical system: Control of pendulum, Int. J. Control, troller and lter design.
vol. 23, pp. 673692, 1976.
[8] K. Furuta, M. Yamakita, and S. Kobayashi, Swing-up
control of inverted pendulum using pseudo-state feed-
back, Journal of Systems and Control Engineering,
vol. 206, pp. 263269, 1992.
[9] N. Dhang and S. Majumdar, Optimal control of inverted
pendulums using nite element method, Computers and
Structures, vol. 65, no. 6, pp. 937947, 1997.
[10] K. Furuta, M. Yamakita, and S. Kobayahi, Swing up con-
trol of inverted pendulum, Proc of IECON'91, pp. 2193
2198, 1991.
[11] A. Bradshaw and J. Shao, Swing-up control of in-
verted pendulum systems, Journal of Robotica, vol. 14,
pp. 397405, 1995.
[12] T. Kawashima, Swing up and stabilization of inverted
pendulum using only one sliding mode controller with
nonlinear model oberver, MOVIC'98, pp. 97102, 1998.
[13] K. Nakayasu, A. Inoue, and S. Masuda, A swingup con-
trol of an inverted pendulum using a sliding mode con-
trol, Third International Conference on Motion and Vi-
bration Control, pp. 449454, 1996.
[14] K. Astrom and K. Furuta, Swinging up a pendulum
by energy control, Proc. of 13th Congress of the IFAC,
pp. 683688, 1996.
90 ICASE: The Institute of Control, Automation and Systems Engineers, KOREA Vol. 4, No. 1, March, 2002
Beom-Soo Kim
Myo-Taeg Lim