Вы находитесь на странице: 1из 6

2009 IEEE/ASME International Conference on Advanced Intelligent Mechatronics Suntec Convention and Exhibition Center Singapore, July 14-17, 2009

Adaptive PID with Sliding Mode Control for the Rotary Inverted Pendulum System

T. C. Kuo, Member, IEEE and, Y. J. Huang, Member, IEEE, and B. W. Hong

Abstract—In this paper, a novel adaptive PID with sliding mode control for the rotary inverted pendulum is proposed. The goal is to achieve system robustness against parameter variations and external disturbances. In this study, the three parameters of PID controller, proportional gain, integral gain, and derivative gain can be systematically obtained according to the adaptive law. Further reduction of the high frequency chattering in the controller is achieved by using the boundary layer technique. The proposed control method is applied to a rotary inverted pendulum control system. By using Lyapunov theorem, the stability and convergence of the proposed scheme is proven. Simulation results show that the chattering and the steady state error are eliminated and trajectory tracking is achieved effectively.

I.

INTRODUCTION

T HE Proportional-Integral-Derivative (PID) controller has been proposed for a few decades. Up to now, PID

controllers are still popular in industrial fields. However, the control systems include nonlinear, time varying, coupling, structure uncertainty, and so on, that are not simple enough for designing the PID controllers. Tuning the proportional gain K P , the integration gain K I , and the differentiation gain

K D becomes a subject worth exploring. In the past, most PID controller parameters were determined as fixed values. When the controlled systems are affected by external interference or influence, the controller would not be able to achieve effective control. In recent years, many robust control theories have been proposed, such as neural network control [1, 2], adaptive control [3], genetic algorithms control [4, 5], fuzzy control [6, 7], and sliding mode control [8, 9]. With the sliding mode control, the control system is robust to external interference and variation parameters. However, the sliding mode control law generates a large control gain and causes the chattering phenomenon. In hardware, the high frequency chattering

Manuscript received January 31, 2009. T. C. Kuo is with the Department of Electrical Engineering, Ching Yun University, 229 Chien-Hsin Rd., Chungli 320, Taiwan (corresponding author to provide phone: +886-34581196; fax: +886-34594937; e-mail:

tck@ mail.cyu.edu.tw). Y. J. Huang and B. W. Hong are with Department of Electrical Engineering, Yuan Ze University, 135 Far-East Road, Chungli 320, Taiwan (e-mail: eeyjh@saturn.yzu.edu.tw, s968505@mail.yzu.edu.tw).

damages the mechanism. To improve the chattering phenomenon, many approaches were proposed, such as

[10-13].

In this paper, we further propose adaptive PID sliding mode controller. We use sliding mode control to handle the nonlinear time varying part, and use adaptive law to tune up the system parameters online. The PID controller is used to achieve the satisfactory system performance. We adjust parameters of PID controller online by adaptive law and simulate with rotary inverted pendulum control system, which is a typical non-linear instable system and possessing control difficulty. The simulation result demonstrates that the proposed control method is indeed effective.

II. ROTARY INVERTED PENDULUM DYNAMICS

As shown in Fig. 1 is the sketch of the considered rotary inverted pendulum [14]. By applying the Lagrange equation

[15-17],

d

T

T

V

+

&

dt

θ

i

θ

i

θ

i

=

τ

i

,

(1)

is kinetic energy; V

where T

included angle of i link; link, one can get

l

T

=

1

2

m

1

(

&

l

c

1

θ

1

sin

is potential energy;

θ

i

is

θ

1

)

2

+

(

τ

i is the moment of force of i

c 1

&

θ

1

cos

θ

1

)

2

+

1

2

m

2

(

&

θ

l

1 1

sin

θ

1

&

θ

1

l

c

2

cos

φ

cos

θ

1

+

&

φ

l

c

2

sin

φ

sin

θ

1

)

2

+

+

V = −

(

(

&

θ

l

1 1

&

φ l

c 2

cosθ &

1

&

θ

1

l

c

2

cosφ sinθ

1

) 2

cosφ

⎤ ⎥ ⎦ +

1

J

1

2

θ

+

&

1

1

2

2

J

m gl

2

c 2

(1

sinφ)

.

&

) 2

φ

&

2

2 φ

l

c

2

sinφ sinθ

1

,

(2)

(3)

where

inverted pendulum;

length (m) of inverted pendulum,

mass of rotary arm to the extreme point;

of mass of inverted pendulum to the extreme point;

inertia rotary ( kg × m

is length (m) of rotary arm,

m

1

is mass (kg) of rotary arm,

l

1

2 )

l

c

1

of rotary arm;

m

2

is mass (kg) of

l

2

is

is distance (m) of

l c2

J

2

is distance (m)

is

is inertia rotary

J

1

978-1-4244-2853-3/09/$25.00 ©2009 IEEE

1804

(

kg × m

2

)

of inverted pendulum,

θ

1

is angle

(rad ) of

rotary arm,

θ

2

is angle (rad ) of inverted pendulum; the

symbol φ

is defined as

π

2

θ

2

;

&

θ

1

is angle velocity

is angle velocity (rad / sec) of

inverted pendulum; and g is gravity acceleration

(rad / sec) of rotary arm;

&

θ

2

(

m / sec

2

)

.

=

R

m

m l

1

C

12

k

b

1

21

= −

C

22

G

1

=

0

=

0

,

2

,

2

2

2

c

2

C

m l

2

2

c

2

&

q

1

&

q

1

(

cos 2

G 2

=

m gl

2

c 2

sin q

2

.

(

sin 2

q

1

)

+

m l l

2 1

c

2

q &

2

sin

q

2

,

(13)

q

2

)

,

(14)

 

(15)

(16)

(17)

Rewrite

θ

2

=

π

2

φ , then Eqs. (1)-(3) turn out to be

(

m l

1

2

c

1

2

2

c

sin θ

&&

2

+ m l

+ m l

m l

2 1

2

(

2

2

c

2

sin 2θ

2

2

)

θ θ

1

2

+

2

+ J

m l l

1

2 1

c

)

&&

θ

1

+

(

m l l

2 1

c

2

cosθ

2

2

sinθ θ &

2

2

2

= τ

1

)

&&

θ

2

(4)

(

m l l

2 1

c

2

cosθ

2

)

&&

θ

1

+

(

m l

2

2

c

2

+ J

2

)

&&

θ

2

1

2

m l

2

2

c

2

(

cos 2

θ

2

)

&

2

θ

1

. The input signal is the voltage feeding into the rotary inverted pendulum. A voltage signal is supplied to a PWM driver amplifier which drives the servo-motor to control the pendulum. The relationship of control input τ and voltage

(5)

+

m gl

2

c

2

sin

θ

2

=

0

1

v

is

III. ADAPTIVE PID SLIDING MODE CONTROLLER

Consider a system of rotary inverted pendulum and

dynamic function expressed as (7). First, define the tracking

error of system follow as

(18)

e

=

y

d

y

,

where

joint.

y

d

=

[

y

d

1

y

d

2

]

T are the desired output of each

(19)

In order to set up the error dynamic function, define

y =

y

y

1

2

=

q

q

1

2

.

x

r

R

2

as

τ

1

=

k

b

v

k

2

b

R

m

R

m

&

q

1

.

where

R

m

is

the

armature resistance. Let

q

2

= θ . Eqs. (4)-(6) can be rewritten as

2

q

1

M ()q q&& + C(q, q&)q& + G()q = u

where

G

&&

(

q

q =

)

=

&&

q

&&

q

1

2

(

M q

)

=

M

M

11

21

M

M

12

22

G

G

v

0

1

2

,

u =

. All elements are:

,

q =

(

C q q&

,

q

q

1

2

)

M

M

11

12

=

=

R

m

k

R

b

m

k

b

(

m l

1

2

c

1

(

m

l l

2 1

+

c 2

m l

2 1

2 +

cos q

2

)

m l

2

2

c

1

,

m l l

2 1

c

2

M

M

cos q

C

21

22

11

=

R

2

m

2

2

=

= m l

+ J

1

2

,

m l

2

k

b

2

2

2

c

2

,

&

q

2

(

sin 2

q

2

)

sin

2

q

+

k

2

b

R

m

=

C

C

11

21

&

q =

q

&

q

&

1

2

2

+

J

1

)

,

,

(6)

where

x &

r

=

&& y

d

+

&

K e

1

+

K

0

e

,

(20)

= θ

1

C

C

12

22

and

(7)

K

1

[

= diag k

, k

11 12

, k

]

02

]

k

1

i

k

=

0

i

ζ ω

2

=

i

2

ω

ni

ni

,

,

i =

i =

(21)

(22)

is the natural

1,2

1,2

.

.

K

0

[

= diag k

11

The symbol ζ is the damping ratio and ω frequency, i = 1,2 .

i

ni

Generally, designing sliding mode controller has two

steps. First, define the sliding function. Second, derive the

and

control law. Define sliding function as

σ

= x

2

x

r

,

(23)

where

x

2

=

[

&

q

1

&

q

2

] T

.

When the sliding mode is met, σ& = 0 , and

(8)

(9)

(10)

(11)

(12)

x&

2

= x&

r

.

Substituting (20) to (24) yields

=

Rewrite (25) to obtain e&& +

k 0

If

&

x

2

y

d

+

K e

1

K e& + K

1

0

+

K

0

e =

0

e

.

.

&&

&

k

1

i

and

i are positive, the control system is stable.

(24)

(25)

(26)

Next, choose the control law u as

where

u = u

S

+ u

PID

,

(27)

1805

⎡ ⎡ v ⎤ ⎥ K e + K ∫ edt + K e &
v
K
e
+
K
edt
+
K
e
&
PID
P
I
D
=
= ⎢
,
u PID
0
0
⎣ ⎢
v
(
)
⎡ ⎡ −
v
+ K
sgn
(
σ
)
S
PID
2
1
=
=
u S
0
0
⎣ ⎦
,
σ T (
G
+
Mx
&
+
Cx
)
r
r
K
,
2
σ
1
where
K
=
[
k
k
]
,
K
[
k
k
P
P1
P2
I =
I1
=
[
k
k
]
, and the function sgn(⋅) is
K D
D1
D2
1,
σ >
0
sgn
( σ
)
= ⎧ +
.
1,
σ <
0
The proposed adaptive law to online tuning
K
P ,

(28)

I 2

]

(29)

,

K

(30)

I and

K

D to obtain better effect of control are

&

&

k

k Pi

= −η

Pi

Ii

&

= −η σ

Ii

i

σ e

i

i

, i = 1,2 ,

e dt

i

, i = 1,2 ,

(31)

(32)

(33)

where

Theorem 1. Consider the dynamic equation of rotary inverted pendulum (7) and use the control input (27)-(29) and adaptive control law equation (31)-(33). The control system is stable. Proof. Choose a Lyapunov function as

(34)

k

Pi

= −η

Di

σ

i

e&

i

,

i = 1,2 ,

η

Pi

,

η

Ii

and η

Di

, i = 1,2 , are tuning constants.

1

V = σ 2 Differentiating (34) obtains & ( V ≤ − + σ 1
V =
σ
2
Differentiating (34) obtains
&
(
V
+
σ 1
σ 1
v PID
v PID

K

2

T

Mσ

.

) +

σ T (

G

+

&

Mx

r

+

Cx

r

)

,

(35)

Base on Lyapunov stability theorem, if V > 0 and V 0 , the stability of the control system will be improved. The Lyapunov function will decrease to zero so that tracking error decrease to zero.

0 .

&

IV. FURTHER IMPROVEMENT OF THE ADAPTIVE PID SLIDING MODE CONTROLLER

In previous section, Equation (29) implies

     

&

 

&

 
 

K

σ 1 G

1

+

M

11

x

r

1

+

M

12

x

r

2

+

C

11

x

r

1

+

C

12

x

r

2

 
 

2

σ

1

   

G

2

+ M

 

&

1

+ M

 

&

+ C

21

     

+

σ

2

21

x

r

22

x

r

2

x

r

1

+ C

22

x

r

2

.

σ

1

(36)

If converge velocity σ

2

is more slower than σ , the

1

σ 2 σ 1
σ
2
σ
1

may be a larger and cause system instability. Therefore,

define the sliding function as

where

Λ

1

[

= 1

λ

11

]

σ ~ = Λ

and

Λ

2

1

Choose control law u as =

u

~

u

S

& + Λ

e

=

2

[ λ

22

e

+

~

u

PID

,

,

λ

33

]

.

(37)

(38)

where

~

u PID

=


~

v PID

0



= ⎢

⎢ ⎣

K

P

~

u

S

= ⎢

⎢ ⎣

(

M

' '

11 +

λ 11

M

21

e

+

K

I

)

1

( k

+

∫ edt + K e & D ⎤ ⎥ , 0 ⎥ ⎦ ' '
∫ edt
+
K
e
&
D
,
0
⎥ ⎦
'
'
M
+
λ
M
11
11
21
τ PID

0

)

sgn

(

σ

)

(39)

,(40)

k

21 τ PID 0 ) sgn ( σ ⎤ ⎥ ⎥ ⎦ ) (39) ,(40) k

Λ

1

&&

q

d

+ Λ

1

M

1

&

Cq

+ Λ

1

M

1

G

+ Λ

2

&

q

d

− Λ

2

&

q

In the equation (39),

K

P

=

[

k

P1

k

P2

]

,

K

I

=

.

[

k

I1

(41)

k

I 2

]

and

by adaptive laws to achieve better result

of control. The adaptive laws obtained by chain rule is as following,

(42)

. Here we modify the tuning rules of

K D

=

[

k

]

D1

K

D

&

k

D2

k

K

P

,

K

I

and

(

(

'

'

)

)

&

k

P

1

=

η

P

1

σ

M

11

'

11

M

+

+

c

11

c

M

11

M

21

'

21

e

1

,

M

'

21

)

)

'

21

'

21

e

2

,

e dt

1

,

e dt

2

)

)

e &

1

2

,

,

,

+ c

11

'

21

M

+ c

'

11

'

11

11

+

+

c

c

11

11

M

M

is determined as

P

2

= −η

P

2

σ

&

k

&

(

(

'

11

I I

k

I

2

η

= −

I

2

σ

&

k

&

D

1

k

D

2

= −η

= −η

D

D

η

Ii

M

ij

and

of

η

Di

M

1

,

1

2

M

'

11

σ

σ

(

M

(

M

1

= −

η

1

σ

M

(43)

(44)

(45)

e &

(46)

(47)

i = 1,2 , are the learning rate. The

where

component

,

η

Pi

M

 

M

1

=

M

11

 

M

12

.

(48)

 

21

22

 

Choose a Lyapunov function as

 
 

~

1

 

)

V =

 

(

~2

σ

.

(49)

 

2

~ ' ' ~ ~ & ' ' ~ σ M + λ M v
~
'
'
~
~ &
'
'
~
σ
M
+
λ
M
v
σ
M
+
c
M
v
11
11
21
PID
11
11
21
PID
 
~ ~ − 1 − 1 σ k + σ Λ q && + Λ
~
~
1
1
σ
k +
σ
Λ
q
&&
+ Λ
M
Cq &
+ Λ
M
G
+ Λ
q &
− Λ
q &
1
d
1
1
2
d
2

,

0 .

(50)

 

on

Lyapunov

stability

theorem,

the

Lyapunov

Differentiating (49) yields

V ~ &

Based

M

1806

function will decrease to zero so that the tracking error decreases to zero. The tracking command is

(51)

The parameters of the sliding function and the control are

, and k = 5 . In order to reduce

the input chattering, the saturation function is used to replace the sign function in (40). The function sat() is

defined as

,

Λ

2

y

d

=

[8

1 =

0.5cos 1.25

1]

(

t)

.

Λ

1

=

[1

0.5]

sat

σ + 1, ≥ 1 ⎪ δ ⎪ σ σ ⎞ ⎪ , σ ⎟
σ
+ 1,
≥ 1
δ
σ σ
,
σ
⎟ =
1
<
<
δ δ
δ
σ
1,
≤ −
1
δ

1

.

(52)

where δ is the boundary layer. In this simulation, δ is equal to 0.1. The results of simulation are shown in Figs. 2 to 11. Figs. 2 and 3 are the tracking performance of rotary arm and inverted pendulum respectively. The performance of the control input v is shown in Fig. 4. The performance of the sliding function σ is shown in Fig. 5. Figs. 6 and 7 are the

respectively. Figs. 8 and 9

show the integration gains

respectively. Figs.

proportional gains

k

P1

and

k

k

P2

I1

and

k

I 2

10 and 11 are the differential gains

k

D1

and

k

D2

respectively. It is clearly that the proposed adaptive PID sliding mode controller makes the system stable and robust effectively. The tracking performance is satisfactory. Most of all, the control gains K P , K I , and K D are determined online and converge very fast.

V.

CONCLUSION

This paper proposes a novel adaptive PID sliding mode controller. This control method improves defect of traditional PID controllers. The controller involves adaptive laws to tune up the control gains K P , K I , and K D . Sliding mode control is applied. The rotary inverted pendulum control system is controlled effectively. The main advantage of the proposed control method is that PID controller gains can be obtained online and converge efficiently. Tracking performance can be guaranteed.

ACKNOWLEDGEMENT

The authors would like to thank National Science Council, Taiwan, for supporting this work under Contract NSC 97-2221-E-231-005 and NSC97-2221-E-155 -020 -MY2.

REFERENCES

[1] S. Akhyar and S. Omatu, “Self-tuning PID control by neural-networks,” IEEE on Proceedings of 1993 International Joint Conference on Neural Networks, Vol. 3, pp. 2749-2752, 1993. [2] S. Omatu and M. Yoshioka, “Stability of inverted pendulum by

[3]

neuro-PID control with genetic algorithm,” IEEE World Congress on Computational Intelligence, Vol. 3, pp. 2142-2145, 1998. W. D. Chang and J. J. Yan, “Adaptive robust PID controller design

polymerization reactor,” Chemical Engineering Communications,

[4]

based on a sliding mode for uncertain chaotic systems,” Chaos, Solitons & Fractals, Vol. 26, pp. 167-175, 2005. A. Altinten, S. Erdogan, F. Alioglu, H. Hapoglu, and M. Alpbaz,

“Application of adaptive PID control with genetic algorithm to a

Vol. 191, pp.1158-1172, 2004.

[5]

Y. Mitsukura, T. Yamamoto, and M. Kaneda, “A design of self-tuning

PID controllers using a genetic algorithm,” Proceeding of the

American Control Conference, Vol. 2, pp. 1361-1365, 1999.

[6]

H. S Choi, Y. H. Park, Y. S. Cho, and M. Lee, “Global sliding-mode

control improved design for a brushless DC motor,” IEEE Control

Systems Magazine, vol. 21, pp. 27-35, 2001.

[7]

S. Chiu, “Using fuzzy logic in control applications: beyond fuzzy PID control,” IEEE Control Systems Magazine, Vol. 18, pp. 100-104,

1998.

[8]

U. Itkis, Control System of Variable Structure, John Wiley & Sons,

New York, 1976. [9] V. I. Utkin, Sliding Mode in Control And Optimization, Springer-Verlag, New York, 1992. [10] Q. D. Zhang and S. K. Panda, “Chattering-free and fast-response sliding mode controller,” IEE Proceeding-Control Theory and

Applications, Vol. 146, pp. 171-177, 1999.

[11] A. Ishigame, T. Furukawa, S. Kawamoto, and T. Taniguchi, “Sliding mode controller design based on fuzzy inference for nonlinear

Systems,” IEEE Transactions on Industrial Electronics, Vol. 40, pp.

64-70, 1993. [12] T. C. Kuo, Y. J. Huang, W. C. Huang, Y. R. Wu, and B. W. Hung, “Fuzzy sliding mode control of a rotary inverted pendulum,” 2006 The 14th National Conference on Fuzzy Theory and Its Applications, pp. B1-5-1-B1-5-5, 2006. [13] T. F. Wu, P. S. Tsai, F. R. Chang, and L. S. Wang, “Adaptive fuzzy CMAC control for a class of nonlinear systems with smooth compensation,” IEE Proceedings-Control Theory and Applications, Vol. 153, pp.647-657, 2006 [14] TeraSoft, Electro-Mechanical Engineering Control System User’s Manual, 2005. [15] J. J. Craig, Introduction to Robotics Mechanics and Control, Addison-Wesley, New York, 1989.

[16]

M. W. Spong and M. Vidyasagar, Robot Dynamics and control, Wiley, New York, 1989.

[17] S. Awtar, N. King, T. Allen, I. Bang, M. Hagan, D. Skidmore, and K. Craig, “Inverted pendulum systems – rotary and arm driven – a mechatronic system design case study,” Mechatronics, pp. 357-370,

2002.

1807

g θ 2 J 2 m 2 l c1 l 1 l 2 l θ
g
θ
2
J
2
m
2
l
c1
l
1
l
2
l
θ
c2
1
m
1
J
1
τ

Fig.1 Sketch of the rotary inverted pendulum

0.8 q 1 0.6 y d1 0.4 0.2 0 -0.2 -0.4 -0.6 -0.8 0 5
0.8
q
1
0.6
y
d1
0.4
0.2
0
-0.2
-0.4
-0.6
-0.8
0
5
10
15
20
25
q 1 (Rad)

time (sec)

Fig. 2 Tracking performance of the rotary arm.

time (sec) Fig. 2 Tracking performance of the rotary arm. Fig. 3 Tracking performance of the

Fig. 3 Tracking performance of the inverted pendulum.

arm. Fig. 3 Tracking performance of the inverted pendulum. Fig. 4 Control input v of the

Fig. 4 Control input v of the rotary inverted pendulum.

Fig. 4 Control input v of the rotary inverted pendulum. Fig. 5 Performance of the sliding

Fig. 5 Performance of the sliding function σ.

pendulum. Fig. 5 Performance of the sliding function σ . Fig. 6 Performance of the ratio

Fig. 6 Performance of the ratio gain K P1 .

1808

Fig. 7 Performance of the ratio gain K P 2 . Fig. 8 Performance of

Fig. 7 Performance of the ratio gain K P2 .

Fig. 7 Performance of the ratio gain K P 2 . Fig. 8 Performance of the

Fig. 8 Performance of the ratio gain K I1 .

P 2 . Fig. 8 Performance of the ratio gain K I 1 . Fig. 9

Fig. 9 Performance of the ratio gain K I2 .

I 1 . Fig. 9 Performance of the ratio gain K I 2 . Fig. 10

Fig. 10 Performance of the ratio gain K D1 .

K I 2 . Fig. 10 Performance of the ratio gain K D 1 . Fig.

Fig. 11 Performance of the ratio gain K D2 .

1809