Vous êtes sur la page 1sur 13

Control of Inverted Pendulum

P.C. Yang
1
, K.M. Yeh
2
, B.S. Lee
3
, Y.C. Wei
4
, C.C Chen
5

Team One
Department of Aerospace Engineering
Tamkang University
Tamsui 251, Taiwan, Republic of China

Abstract
The Inverted Pendulum is the classic problem in dynamics and control theory.
Its a good way to test control algorithms. According to the design requirement,
system response settling time and maximum overshoot cannot be over 10 second
and 30 percent. Using the linearization method and PID control method to make
the unstable system turned into stable.


1. Introduction
1.1 Motivation
The Inverted Pendulum is the classic problem in dynamics and control theory. Its a
good way to test control algorithms, such as PID control, fuzzy control and genetic
algorithms. We will be very interested in the control of pendulum. Because of the
technique in these kind of problem can be only apply the S.I.S.O. (Single-input Single
output) system. The applications of the inverted pendulum are widely used in the
vehicle technology, such as the Toyota Winglet (as shown as Fig. 1.1) and two legs
walk able humanlike robot Honda Asimo (as shown as Fig. 1.2), etc. In this report,
we use the state feed-back control algorithms to deal this problem.





______________________________
1
Pin-Chi, Yang ID#497430073; kcy.chinesepower@gmail.com
2
Keng-Ming, Yeh ID#497430917; good790309@kimo.com
3
Bo-Siou,Lee ID#497430511; aeghio1019@hotmail.com
4
Yu-Chen,Wei ID#497430859; forever410303@hotmail.com
5
Chun-Chi,Chen ID#497430636; h410123@hotmail.com

Figure 1.1: Toyota Winglet


Figure 1.2: Honda Asimo
1.2 Literatures Review
The document [3] is application of fuzzy sliding mode controller. Compared with
our system, we found difference about that they are munity input munity output and
our system is single input single output.
Reference [4] is design and implementation of fuzzy controller by using DSP chips
and its application to inverted pendulum car and they have a most difference is use
DSP (Digital Signal Processor) to control system.

1.3 Designing Process
According to the design requirement, step-input system response settling time and
maximum overshoot cannot be over 10 second and 30 percent.
The first thing to do is to modeling the inverted pendulums equation of motion into
state space form by using the linearization method. To make sure if the system is
controllable, we have to seek the controllability matrix. If the system is controllable,
we could do further more.
Set the gained stable system poles to figure out the state feed-back gain value, the
K matrix of the system.
Testing the gained system stability then confirm the disturbance rejection of the
system response. If there exist a constant disturbance, adding the outer control loop to
fix the problem made the system back to the original position. Finally, compare with
the nonlinear system and the linear controlled system.

1.4 Brief Results
The controllability of the system is fully controllable. Such that, we could get gain
K matrix and we use state feed-back control then let the system become a stable
system, but we found only the position could be observed. According to our testing,
we found this system dont have the disturbance rejection. We also compared result of
linear with nonlinear system response. The system would returns to original and
similar. For linear system would returns to original among 5 seconds. For nonlinear
system would returns to original approximation 10 seconds.


2. Linearization
Designing a control system and consider a cart with inverted pendulum as show in
Fig. 2.1. The equation of motion about the position of the cart and the angle of the
pendulum are given as (2.1) and (2.2).
2
( ) cos sin m M x ml ml u u u u u + + = (2.1)
2
( ) cos sin 0 I ml mlx mgl u u u + + = (2.2)

Figure 2.1: cart with inverted pendulum
Because of the equation of motion are nonlinear, so need to be linearity and as
show as following:
Let
1
2
3
4
x x
x
x x
x
u
u
=


1 3
2 4
x x
x x
=


By using the linearization method, we consider 0 u ~ and
2
0 u ~ , so that
cos 1 u ~ and sinu u ~ . Therefore, (2.1) and (2.2) can be simplified as show as (2.3)
and (2.4).
( ) m M x ml u u + + = (2.3)
2
( ) mlx I ml mgl u u + + = (2.4)
Or (2.5) and (2.6).
3 4
( ) m M x mlx u + + = (2.5)
2
3 4 2
( ) mlx I ml x mglx + + = (2.6)

First we take (2.6) multiply ( )
m M
ml
+

2
3 4 2
( ) ( )( ) ( )
m M
m M x I ml x gx m M
ml
+
+ + + = + (2.7)
Then take (2.7) minus (2.5)
2
4 2
( )( ) ( )
m M
I ml ml x gx m M u
ml
+
+ = +


(2.8)
Or
2
4
2
( )
( )( )
gx m M u
x
m M
I ml ml
ml
+
=
+
+
(2.9)
Second we take (2.6) multiply
2
( )
ml
I ml +

2
3 4 2 2 2
( )
( )
ml ml
x mlx mglx
I ml I ml
+ =
+ +
(2.10)
Then take (2.10) minus (2.5)
2
3 2 2 2
( )
( ) ( )
ml ml
m M x mglx u
I ml I ml

+ =

+ +

(2.11)
Or
2 2
3 2
2
( )
( )
( )
ml
mglx u
I ml
x
ml
m M
I ml

+
=
+
+
(2.12)
Therefore, we can get all derivative terms as show as following:
1 3
2 4
2 2
3 2
2
2
4
2
( )
( )
( )
( )
( )( )
x x
x x
ml
mglx u
I ml
x
ml
m M
I ml
gx m M u
x
m M
I ml ml
ml
=

+
=

+
+


Then, we can get A matrix and B matrix as show as (2.13) and (2.14).
2
2
2
2
0 0 1 0
0 0 0 1
( )
0 0 0
( )
( )
( )
0 0 0
( )( )
ml
mgl
I ml
A
ml
m M
I ml
g m M
m M
I ml ml
ml





+

=

+

+

+

+

+


(2.13)

2
2
2
0
0
1
( )
( )
1
( )( )
ml
B
m M
I ml
m M
I ml ml
ml




=

+
+


+

+


(2.14)
We also can write as state space form as below:
x Ax Bu
y cx
= +


So,
1 1
2
2
2 2
2
2
3 3
2
4 4
2
2
0 0 1 0
0
0 0 0 1
0
1 ( )
0 0 0
( )
( ) ( )
( )
1
( )
0 0 0
( )( )
( )( )
ml x u
mgl
I ml
x u
ml
x
ml m M
x u
m M
I ml
I ml
x u
g m M
m M
m M I ml ml
I ml ml
ml
ml










+



= +

+


+
+

+


+

+

+ +

+




Or
| | | |
2
2
2
2
2
2
2
0 0 1 0
0
0 0 0 1
0
1 ( )
0 0 0
( )
( ) ( )
( )
1
( )
0 0 0
( )( )
( )( )
ml
mgl
I ml
ml
x x u
ml m M
m M
I ml
I ml
g m M
m M
m M I ml ml
I ml ml
ml
ml










+


= +

+

+
+

+


+

+

+ +

+




In our designing, the cart mass 10 M = and pendulum mass 1 m = , pendulum
half-length 1 l = and moment of the inertia of the pendulum
2
4
(2 ) / 3
3
I m l = = so
that, we can get A matrix and B matrix as show as (2.15) and (2.16).
0 0 1 0
0 0 0 1
0 0.3853 0 0
0 8.7495 0 0
A



=



(2.15)

0
0
0.0916
0.0811
B



=


(2.16)

3. Stability, Controllability and Observability Analysis
3.1 Original system stability analysis
Analyzed the original systems poles locations, the poles are at 0, 0, 2.9579 and
-2.9579. There is one pole at the right half plane at s-plane, so we can know that the
system is an unstable system. Using Matlab program to show the step input
response as the Fig. 3.1. Confirm its an unstable system.

Figure3.1: Original system step input response

3.2 Controllability analysis
To know if the system is fully controllable, we must need to define a controllability
matrix U.
2 3
[ ] U B AB A B A B =
(3.1)
In our designing, we find U matrix and if rank(U)=4 ,the system is controllable.
0 0.0916 0 0.0312
0 0.0811 0 0.7094
0.0916 0 0.0312 0
0.0811 0 0.7094 0
U




=




(3.2)

3.2 Observablility Analysis
To know if the system observable, must need to define an observability matrix V.
By definition
2
3
C
CA
V
CA
CA



=




To seek x , when
| | 1 0 0 0 C = , we find V matrix and if rank(V)=4,the system is
observability.
1 0 0 0
0 0 1 0
0 0.3853 0 0
0 0 0 0.3853
V



=


(3.3)
To seek u , when
| | 0 1 0 0 C = , we find V matrix as shown and if rank(V)=2,
the system is unobservability.
0 1 0 0
0 0 0 1
0 8.7495 0 0
0 0 0 8.7495
V



=



(3.4)

To seek x , when
| | 0 0 1 0 C = , we find V matrix as shown and if rank(V)=3,the
system is unobservability.
0 0 1 0
0 0.3853 0 0
0 0 0 0.3853
0 3.3712 0 0
V


(3.5)
To seek u , when
| | 0 0 0 1 C = , we find V the matrix as shown and the
rank(V)=2,the system is unobservability.
0 0 0 1
0 8.7495 0 0
0 0 0 8.7495
0 76.5530 0 0
V



=



(3.6)

4. Control Law Design
4.1 System Specification
The desire unit step percentage maximum overshoot cant be larger than 30% and
settling times less than 10 second.

4.2 Gained System Poles Selection
To reach the goal, known that the maximum overshoot and the settling time
s
t are
the function of damping ratio . and function of time constant t as the (4.1) and
(4.2) shows.
2
1
. ( ) Max Overshoot f e
.t
.
.

= = (4.1)
4
s
t t ~ (4.2)
The maximum overshoot usually occurs at short period mode of the system
response. To reach the P.O.(Percentage Overshoot) < 30%,
s
. at least larger than
0.358. The settling time usually occurs at phugoid mode of the system response.
The
s
t requirement is less than 10 second. So we can know that the time constant
must be smaller than 2.5s. By the equation (4.3), can see that time constant is
( , )
n
f e . .
1
n
t
.e
= (4.3)
Knowing that
p n
. e > 4 and
s
. >0.358, we select the poles location at -3+j, -3-j,
-1+j and -1-j. By using state feedback method, the gain K matrix could be found like
(4.4).
| |
25.9539 433.2451 41.5263 145.6029 K = (4.4)
Than the system matrix A now comes to ( ) A BK , the step input response as
shown as the Figure 4.1. We could clearly see the system comes stable.

Figure 4.1: new system step input response
5. Observer Building
According to observer designing idea, observer system response need to converge
faster than linear system, so we put the pole at 4 i , 1 i so we could get a L
matrix
0.01
0.3569
0.0437
1.0817
L




6. Simulation
6.1 Linear System response
The purpose of simulation is to confirm linear and nonlinear system response is
similar and confirm the control law is correct. Such that, we found the linear system
response would returns to original among 1 to 2 seconds as show as Fig.6.1.

Figure 6.1: linear system response

6.2 Nonlinear System response
The nonlinear system response would returns to original approximation 10 seconds
as show as Fig.6.2.Because this system converges is similar to linear system.

Figure 6.2: nonlinear system response

We can compare linear with nonlinear system response as show as Fig.6.3.

Figure 6.3: nonlinear & linear system response

6.3 Observer & Linear & Nonlinear System response
By the observerbility analysis, we know that only position (x) could be observed.
The observer & linear & nonlinear system response as shown as Fig 6.4.The
observer starting at the original position at 1

Fig 6.4: observer & linear & nonlinear system response

7. Conclusion
By this project, we could obtain that the linear system and nonlinear system
response are a little bit different. But the settling time and the maximum overshoot are
very close and likely. The observer we built could successfully follow the linear
system response.

8. Problem & Discussion
When we doing step input, we found a problem in Why the system response goes
to zero but not 1? We make the system to be a transfer function by using (8.1)
| |
1
. T F C SI A B

= (8.1)
We can get 4 transfer functions by applying 4 different C matrixes. When
| |
1 0 0 0 C = , we could get (8.2).

2 16
1 4 3 2
0.09164 2.442 10 0.7706
.
8 24 32 20
s s
T F
s s s s

+
=
+ + + +
(8.2)
When | |
0 1 0 0 C = , we could get (8.3).

2 17 17
2 4 3 2
0.08108 6.751 10 5.452 10
.
8 24 32 20
s s
T F
s s s s

+
=
+ + + +
(8.3)
When | |
0 0 1 0 C = , we could get (8.4).
3 18 2 17
3 4 3 2
0.09164 9.178 10 0.7706 7.717 10
.
8 24 32 20
s s s
T F
s s s s

+ +
=
+ + + +
(8.4)
When
| |
0 0 0 1 C = , we could get (8.5).
3 17 2 17
4 4 3 2
0.09108 8.383 10 6.684 10
.
8 24 32 20
s s s
T F
s s s s


=
+ + + +
(8.5)
By applying a step input to each transfer functions we could finally get the final
value (8.6).
0.0385
0
0
0
t
t
t
t
x
x
u
u




=



(8.6)
So we can know that our step input response is correct.

9. Acknowledgement
In this project, first we thanks for Dr. Fu-yuen Hsiao offer advice in the simulation
of the system; Gratitude Dr. Der-Ming Ma and Dr.Chao-Kang Feng guiding for
linearization.

10. References
[1],MATLAB ,,1997 8
[2],,,80 8
[3]Sheng-Hsiung Lin & Tzuu-Hseng S.Li, Design and Implementation of Fuzzy
Controller by Using DSP Chips and Its Application to Inverted Pendulum Car ,
National Cheng Kung University,Department of Electrical Engineering,p7-P8,June
2002
[4], Application of Fuzzy Sliding Mode Controller Via
Adaptive Method in Inverted Pendulum Systems,National Central University,
Department of Electrical Engineering,P5-P6,June 2005
[5],,,01/2003

Vous aimerez peut-être aussi