You are on page 1of 4

Fuzzy Control of Double Inverted Pendulum by Using State Varieties Fusion

Function
Zhang Shifeng, Zhang Zhenxing, Jin Ke, Yang Cheng
School of Electrical Engineering & Information Anhui University of Technology Maanshan, Anhui Province, 243002, China
E-mail: zhangsf@ahut.edu.cn

Abstract: The method is introduced to control the double inverted pendulum using the fuzzy controller in this paper.
Model designed based on the linear state-space expression was obtained by approximating the nonlinear model for
inverted pendulum, Dimensions of a fuzzy controller’s input varieties are depressed by designing a fusion function which
the upper pendulum’s angle and angle velocity are chosen as principal components, and it can reduce the rules of fuzzy.
This method can greatly simplify the designing process of fuzzy controller. Simulation and real time control experiment
in the double inverted pendulum prove that this method has the effectively, fast speed, good stability and good
robustness.
Key words: fuzzy control; fusion function; double inverted pendulum; real time control

on the guide way. When the dolly moves left and right, it
1 INTRODUCTION acts on the pendulums to keep the whole system in stability.
The dolly mass is m0, the upper pendulum is m2, and
Inverted pendulum system is a multi-variable, prompt, another pendulum is m1.
non-linear and absolutely unstable system, so it must use a
certain control method to make it stable. The inverted
θ2 m2
pendulum system is usually used to test the effect of the
control policy, and it is also an ideal experimental
instrument in the study of control theory[1, 2]. The inverted
pendulum system is a typical nonlinear and unstable θ1 m1
controlled object. Therefore how to control it effectively is
a typical problem in the control theory[3]. Motor
m0
In this paper, the stability control on the pendulum as the
main target. Design the fusion function of synthetic r
inverted pendulum system state variables, and design of
fuzzy controller stability control a double inverted Fig. 1. Physical model of the double inverted pendulum
pendulum system. Multi-variable system for the state The dynamic equation[4] is:
variable according to the nature and type classification, Can
ª r º ª r º
greatly reduce the dimension of the fuzzy controller input,
M (θ 1 , θ 2 ) «« θ1 »» + F (θ 1 , θ 2 , θ1 , θ2 ) «« θ1 »» = G ( u , θ 1 , θ 2 )
Reduce the number of fuzzy rules, Conducive to the use of
«¬θ2 »¼ «¬θ2 »¼
expert control experience, Reduces the computational
complexity of the control algorithm. Where:
F (θ1 , θ 2 , θ1 , θ2 ) =
2 THE STRUCTURE OF DOUBLE INVERT- ª f0 − ( m1d1 + m 2 d 3 ) sin θ 1 ⋅ θ1 − m 2 d 2 sin θ 2 ⋅ θ2 º
ER DPENDULUM «
«0 f1 + f 2
»
− f 2 − d 3 d 2 sin( θ 2 − θ 1 ) ⋅ m 2 ⋅ θ2 »
MS The physical model of the double inverted pendulum «0
¬ m 2 d 3 d 2 sin( θ 2 − θ 1 ) ⋅ θ1 − f 2 f2 »
¼
system is shown as Fig.1. Schematic diagram shows that M (θ1,θ2 ) =
the double inverted pendulum system is composed of a ª m0 + m1 + m2 (m1d1 + m2d3 ) cosθ1 m2d2 cosθ2 º
dolly moving on guide way and two pendulums which are «(m d + m d ) cosθ J + m d 2 + m d 2 m d d cos(θ −θ )»
fixed on the dolly. There is a shaft between dolly and « 1 1 2 3 1 1 1 1 2 3 2 1 3 2
2
1 »

pendulum and between two pendulums respectively. The ¬« m2d2 cosθ2 m2d3d2 cos(θ2 − θ1 ) J 2 + m2d2 ¼»
G (u , θ 1 , θ 2 ) =
angles of two pendulums can be measured by two coaxial
angle sensors respectively, one install in the bearing which [G 0 u ( m 1 d 1 + m 2 d 3 ) g sin θ 1 m 2 d 2 g sin θ 2 ]
T

articulates the pendulum to the dolly, and the other install in In the equation: r , r , r, θ 1 , θ1 , θ1 , θ 2 , θ2 , θ2 is the dis-
the bearing of two pendulums. The displacement of the placement, the velocity and the acceleration of the dolly,
dolly can be measured by a sensor installed on one side of the angle, the angle velocity and the angle acceleration of
the guide way. There is a motor driving the dolly to move the pendulums.
The equation shows that the double inverted pendulum has
Natural Science Foundation of Education Department of Anhui 6 state variables: dolly displacement r, dolly linear velocity
Province P.R.China. (KJ2008B104)

978-1-4577-2074-1/12/$26.00 2012
c IEEE 2696
r , pendulum angle θ1 and θ 2 , pendulum angle velocity where:
~ ~ p
ki N kj
θ1 and θ2 .When the system can linearised , assume: k1 = k1 k 2 = k p +1 ~x 1 = ¦ xi ~
x2 = ¦ xj
i =1 k1 j = p +1 k p +1

x = r, x = θ , x = θ −θ , x = r, x = θ , x = θ −θ ~ ~ ~
1 2 1 3 2 1 4 5 1 6 2 1 then: u = k1 ⋅ ~
x1 + k 2 ⋅ ~
x 2 = f 2 ( X ) = f 2 ( f1 ( X )) (3)
The system state function is:
In Eq.(3), f 2 is the fuzzy control arithmetic. The primary
X = AX + BU
control target is to stabilize the upper pendulum and the
Y = CX
other pendulum is the next one, the dolly is the last one. So
The system matrix is:
ª 0 º
the θ 2 − θ1 and θ2 − θ1 are chosen as principal
ª0 0 0 1 0 0º
«0 « 0 » components, the displacement of dolly r , the angle of
0 0 0 1 0»» « »
under pendulum θ1 and the linear velocity of dolly r , the
«
«0 0 0 0 0 1» « 0 »
A=« » B= « »
« 1 »
«0 angle velocity of under pendulum θ1 are combined to the
0 0 0 0 0»
«0 86.69 − 21.62 0 0 0» « 6.64 »
« » « »
¬«0 − 40.31 39.45 0 0 0¼» ¬«−0.088¼» two principal components. In this way, the sub-state
Eigenvalues of The system are obtained from the state information is combined into the principal components in
matrix: the given proportion, then the fusion functions are obtained
by the linear feedback coefficient. And then the fuzzy
λ1 = λ2 = 0, λ3 = −5.0262, λ4 = 5.0262, λ5 = −10.0438, λ6 = 10.0438
The positive eigenvalues result in the system unstable, so control logic performs the f 2 .In the double inverted
the eigenvalues should be rearranged by the state feedback pendulum system, assume:
controller. The state feedback controller can be obtained θ = θ 2 −,θ1 θ = θ2 − θ1
using the optimization control theory.
K = kr [ kθ1 kθ 2 −θ1 k r kθ1 kθ2 −θ1 ]
3 THE DESIGN OF FUZZY CONTROLLER
[
X = r θ1 θ 2 − θ1 r θ1 θ2 − θ1 ]
T

3. 1 General Fuzzy Control So, Eq.(1) can be written as:


There are 6 state variables in the double inverted pendulum u= K⋅X
system. Using fuzzy controller, if 7 parameters are given to kr kθ k kθ
= kθ ( r + 1 θ1 + θ ) + kθ ( r r + 1 θ1 + θ)
each of the state variables, then 117649 pieces of the kθ kθ kθ kθ
~ ~
control rules are needed. Therefore, it is difficult to design = kθ ⋅ θ + k θθ
the controller. So the fusion function method can greatly
where:
simplify the designing process of fuzzy controller. In this
k θ = k θ 2 −θ1, k θ = k θ2 − θ1
way, only 2 state variables are chosen as principal
assume:
components according to the physical meaning, then the ~ ~ ~ T
dimensions of input varieties of a fuzzy controller are X = ª«θ θ º»
¬ ¼
depressed.
The fusion function can be designed as:
3. 2 Fusion function ªk r k θ1 º
« 1 0 0 0»
~ k kθ
The linear controller can be designed to control a object X = f1 ( X ) = « θ »X
« k r k θ1 »
using pole assignment or the optimization control theory[5]. « 0 0 0
k θ k θ

¬ ¼
It can be formulated as:
u = K⋅X (1) 3. 3 Fuzzy Controller Design
Where: X = [ x1 , x 2 , ", x N ] is controller input vector,
T

Fuzzy controller has 2 input variables and 1 output variable.


K = [k1 , k 2 ," , k N ] is feedback control coefficient, and These variables have also 7 fuzzy sets. And there are 49
then Eq. (1) can be written as: fuzzy rules in the fuzzy controller. So it will be true to real
N time control the double inverted pendulum experiment.
u = ¦ ki xi (2)
1) Determine the fuzzy controller structure, Design
i =1
combines function, the variables of the six states of the
Considering the physical meaning in actual system, we
double inverted pendulum system together as two:
choose the x1 and x p +1 as principal components, Comprehensive error E and error change EC , namely:
(k1 ≠ 0, k p +1 ≠ 0) , and that ( x2 , x3 ,", x p ) and [E [
EC ] = f 1 ( X ) X T = f 1 ( X ) x θ 1 θ 2
T
x θ1 θ2 ]T

Then two input and one output fuzzy controller can be


( x p + 2 , x p +3 ,", x N ) combine into the two principal
designed.
components respectively, and then Eq.(2) can be rewritten 2) Define the input and output fuzzy setsˈ The range
as:
of E 㧘 EC and output [-1.0,1.0], and are divided into
p N p
k N kj
u = ¦ k i x i + ¦ k j x j = k 1 ¦ i x i + k p +1 ¦ xj seven fuzzy subsets NB, NM , NS , ZO, PS , PM , PB .
i =1 j = p +1 i =1 k 1 j = p +1 k p +1
3) Define the membership function and determine the
fuzzy control rules.

2012 24th Chinese Control and Decision Conference (CCDC) 2697


4) The center of gravity method as the solving
ambiguity method. Take the membership function curves
with the abscissa of center of gravity of the enclosed area as
the final output value of the fuzzy inference.
5) to build a fuzzy control system in SIMULINK and the
simulation, the introduction of the fusion function, the
choice of a conventional two-dimensional fuzzy controller
to control the structure of the model in the SIMULINK
environment is shown in Figure 2:
simout1 To workspace
To workspace1 simout

+
K *u
Fig. 5 The curve of θ2
Gain1 x = Ax + Bu
¡¡¡¡ K *u K *u

disturbance −Matrix y = Cx + Du
K *u Gain2 Scope
Gain *
Fuzzy Logic State − space
Gain1
controller

Fig. 2 The structure of the model in the SIMULINK

4. SIMULATION EXPERIMENT
Simulation analysis for the double inverted pendulum
system, Will be based on the fusion function method to
determine the membership function for fuzzy controller Fig. 6 Tracking curve of The settings
design. The results of simulation are shown in Fig.3 –Fig.
6. The simulation curve shows that the double inverted
pendulum system can be recovered to stand straight in 3-4
seconds and the dolly can track very well in the initial
position of 0.01m.

5. REAL TIME CONTROL EXPERIMENT

5.1 Experimental device


The experimental device in this paper is the linear inverted
pendulum of GLIP2003 series produced by Google
(Shenzhen) company of technology. It can be combined
into single, double, triple inverted pendulum system.
Fig. 3 The curve of r Except for the inverted pendulum device and the electric
cabinet which have a motor driver and different kinds of
interface circuit, a piece of motion control calorie must be
installed in the computer. This calorie supplies function
library of different kinds of mandatory ran off with c
language. The real time control software in the SIMULINK
environment developed by Google company expansions the
MATLAB kit, it gives library function of board calorie a
S-Function crust. The control system can be composed of
kinds of modules compiled with S-Function and
M-Function.
5. 2 Results of real time control
Fig. 4 The curve of θ1 The results of real time control are shown in Fig. 7-Fig. 12.
Fig. 7-Fig. 9 show the real time curves of the displacement
of the dolly, the angle of two pendulums respectively. It
should be stated that the initial position of the dolly is 0 m,
the angles of the pendulums are compared to vertical
downward direction and shown as radian.

2698 2012 24th Chinese Control and Decision Conference (CCDC)


Fig. 7 The curve of r
Fig. 11 The curve of θ1

Fig. 8 The curve of θ1


Fig. 12 The curve of θ2
Fig. 10-Fig. 12 show the real time curves of the dolly
displace and the angles of two pendulums when the upper
pendulum is knocked gently in the course of control.
6. CONCLUSION
The fuzzy rules can be reduced by designing a fusion
function which the angle and angle velocity of the upper
pendulum are chosen as principal components. This method
can greatly simplify the designing process of fuzzy
Fig. 9 The curve of θ2 controller. Simulation and real time control experiment in
the double inverted pendulum prove that this method has
Fig. 7-Fig. 9 show the real time curves of the the effectively, fast speed, good stability and good
displacement of the dolly, the angle of two pendulums robustness.
respectively. It should be stated that the initial position of
the dolly is 0 m, the angles of the pendulums are REFERENCES
compared to vertical downward direction and shown as [1] X. L. Yan, H. H. Jiang, Control Method on a Single Inverted
radian. Pendulum in Simulation Environment, Measure and Control
Technology, Vol.24, No.7, 37-39, 2005.
[2] H. L. Zhang, Simulation of Virtual Inverted Pendulum
Based on MATLAB, Mechanic Building and Automation,
Vol.33, No.6, 103-105, 2004.
[3] R. Q. Guo, X. Hong, W. W. Su, The control arithmetic for
the double inverted pendulum based on the fuzzy control
theory, Journal  Of  Xidian  University, Vol.33, No.1,
111-115, 2006.
[4] J. L. Song, J. Xiao, X. H. Xu, Modeling and Control Method
of the Inverted Pendulum System, Journal of Northeastern
University(Natural Science), Vol.23, No.4, 333-337, 2002.
[5] H. Liu, F. Y. Duan, Y. Gao, H. D. Yu, J. K. Xu, Study on
Fuzzy Control of Inverted Pendulum System in the
Fig. 10 The curve of r
Simulink Environment, IEEE International Conference on
Mechatronics and Automation, 937-942, 2007.

2012 24th Chinese Control and Decision Conference (CCDC) 2699

You might also like