You are on page 1of 7

State Estimation of Rotary Inverted Pendulum(RIP)

Vijay M. Marathe (MIS No. 120929009)


Under the guidance of
Prof. S.R.Kurode

Abstract The report talk about, the problem of designing


observers for RIP system. The states of system are estimated
using state observer and sliding mode observer. The model of
RIP is derived using the Euler-Lagrange formulation and using
free body diagram method.The theory and design principles are
presented for the RIP systems. Sliding mode observers has the
ability of generating a sliding motion on the error between the
measured plant output and the output of the observer.Sliding
mode observer produces a set of state estimation which is
more accurate with the actual output of the plant. Also report
discusses about modeling of RIP and simulation of it.

I. INTRODUCTION
In modern control theory designs are based on the
assumption that the state vector of the system to be
controlled is available for measurement. Many times the
states of the system are unavailable, unmeasurable. A
observer is a system that models a real system, in order to
provide an estimate of its system state, with the knowledge
measurements of the input and output of the real system.
If a system is observable, it is possible to fully reconstruct
the system state from its output measurements using the
observer [1].
A. Paper Structure
The brief outline of the paper is as follows:
Overview on Sliding mode observer (SMO).
Motivation.
Rotary Inverted Pendulum Dynamics
(Modeling of RIP).
Sliding mode observer for RIP.
Results.
B. Overview on Sliding Mode Observer (SMO)
Sliding mode techniques has been evolved from 1960 and
is best known for its potential as a robust control method
(Itkis 1996, Utkin 1977, 1992, Edwards and Spurgeon 1998).
Such a sliding mode control is essentially a particular type
of variable structure control system (VSCS) and characterized by a suite of feedback control laws and a switching
function[2]. The earliest readily avail able contributions in
the area of sliding mode observers appear in the mid 1980s.
Slotine et al(1986, 1987) define an observer strategy in
which the output errors are fed back in both a linear and a
discontinuous manner for non-linear systems in companion
form. Slotine demonstrated the role of the magnitude of
the discontinuous element, indicating that increasing the
discontinuous element may enhance robustness but this can

be at the expense of increased sensitivity to measurement


noise. This report highlights the need to exploit these nonlinear effects to provide superior performance in the sliding
mode observer to that seen in the equivalent linear observer
which is obtained by setting the discontinuous gain to zero
in the sliding mode configuration.
A further important work in the evolution of sliding mode
observers is due the work of Walcott et al. (1987), Sangwongwanich et al.(1990),Kao and Moskwa (1995), Djemai et al.
(1999), Chen et al. (2000), Aurora et al. (2001), Bartolini et
al. (2003a,b) [2].
C. Modeling
The RIP modeling is done using two methods,
1) Free body diagram method.
2) Euler-Lagrange formulation method.
The system have Vm as a input, which is given to servo
motor. The pendulum is connected to the servo system using
coupling arm. System have and variation in angle
of coupling arm and pendulum respectively. The detailed
modeling is described in next chapter.
D. Motivation
There are at least four common problems caused by
sensors.
Sensors are expensive. Sensor cost can substantially
raise the total cost of a control system. In many cases,
the sensors and their associated cabling are among the
most expensive components in the system
Sensors and their associated wiring reduce the reliability
of control systems
Some signals are impractical to measure. The objects
being measured may be inaccessible for such reasons
as harsh environments and relative motion between the
controller and the sensor (for example, when trying to
measure the temperature of a motor rotor).
Sensors usually induce significant errors such as
stochastic noise, cyclical errors, and limited responsiveness.
Observers can be used to augment or replace sensors in
a control system. Observers are algorithms that combine
sensed signals with other knowledge of the control system
to produce observed signals. These observed signals can be
more accurate, less expensive to produce, and more reliable
than sensed signals. Observers offer designers an inviting
alternative to adding new sensors or upgrading existing ones.

Here State observer and SMO is to be designed to estimate


the states of pendulum. In SMO the pendulum states and
are estimated with the knowledge of coupling arm states
and .
II. S YSTEM D ESCRIPTION
The inverted pendulum is shown in Fig. (1), and
are employed as the generalized coordinates to describe the
inverted pendulum system. The pendulum is displaced with
a given a while the arm rotates an angle of . We assume
the pendulum to be a lump mass at point B which is located
at the geometric center of the pendulum. The xyz frame is
fixed to the arm at point A [3].

x BA = L cos( )
y BA = L sin( )

We also know that the pendulum is also moving with the


rotating arm at a rate of r . Thus, the absolute velocity of
the point B on the pendulum can be expressed as
x B = r L cos( )
y B = L sin( )

Fig. 2.

Fig. 1.

Simplified Model of RIP

Following are the parameter of the system:


L : Length of Pendulum centre of mass (meters),
m : mass of Pendulum (kg),
h : height from ground in (meters),
: pendulum angle in (rad),
: pendulum velocity (rad/s),
r : length of arm that attaches to SRV02 (meters),
Jcm : moment of inertia of pendulum link about its center of
mass, which is given by ml 2 /3,
Rm : motor armature resistance (Ohm),
: motor shaft position (rad),
Km : motor back emf constant (V.s/rd),
Jm : motor Inertia (kgm2 ),
Tout put : output torque of dc motor(N.m),
g : gearbox efficiency,
Kg : total gear ratio,
Beq : the viscous damping coefficient,
m : motor efficiency,
Kt : motor torque constant(N.m/A).
A. Using Free Body Diagram method
The Free Body Diagram of the inverted pendulum system
is shown in Fig.(2). Note that the arm rotates in the horizontal
plane (xz plane) only and the pendulum rotates in the vertical
plane (xy plane) only, we can draw the forces in these two
planes only to simplify the drawing. Referring back to Fig.
(1), we notice that the velocity of point B on the pendulum
relative to that of point A on the arm is

(1)

(2)

Free body Diagram of RIP [3]

Differentiating (2) with respect to time, we will get the


acceleration of the point B,
x B = r + L sin( ) 2 L cos( )
y B = L cos( ) 2 L sin( )

(3)

Applying Newtons 2nd Law to the pendulum in x direction,


we obtain
mxB = Fx mr + mL sin( ) 2
(4)
mL cos( ) = Ax
Applying Newtons 2nd Law to the pendulum in y direction,
we obtain
myB = Fy

Ay mg = mL cos( ) 2 mL sin( )

(5)

Ay = mg mL cos( ) mL sin( )
2

Applying Eulers Equation to the rotational motion of the


pendulum about point B , we obtain
JB = MB
1
m(2L)2 = Ax L cos( ) + Ay L sin( )
(6)
12
1 2
mL = Ax L cos( ) + Ay L sin( )
3
Applying the Eulers Equation to the rotational motion of
the arm about point O , we obtain
Jo = Mo Jeq = Tout put Beq Ax r

(7)

Substituting (4) and (5) into (6), we are left


d T
T V
(
)
+
=Tout put Beq
dt

d T
T V
(
)
+
=0
dt

1 2
mL = (mr + mL sin( ) 2 mL cos( ) L)
3
L cos( ) + (mg mL cos( ) 2
mL sin( ) )L sin( )
1 2
mL =(mrL cos( ) + mL2 cos( ) sin( ) 2
3
mL2 cos2 ( ) ) + (mgL sin( )

(8)

mL2 sin( ) cos( ) 2 mL2 sin2 ( ) )


4
0 = mLr cos( ) + mL2 mgL sin( )
3

Substituting (11) and (12) into (13), we obtain the motion


of equation of the system (10) as expected.
we have known that the output torque of the driving unit on
the load shaft is [4].

Tout put =

Substituting (4) into (7), we are left

(9)

mLr sin( ) 2
Combining (8) and (9), we obtain the motion of equation
of the system

g m Kt Kg
Vm = (Jeq + mr2 ) mrL cos( )
Rm
g m Kt Km Kg2
+mrL sin( ) 2 + Beq +

Rm
4
0 = mrL cos( ) + mL2 mgL sin( )
3

where
a1 = (Jeq + mr2 )
a2 = mrL

The kinetic energy of the mechanical system arising from


the rotating arm and pendulum is

g m Kt Km Kg2
Rm
g m Kt Kg
a4 =
Rm
4 2
a5 = mL
3
a6 = mgL
a3 = Beq +

(11)

(17)

Solving (16) for the two accelerations and and , we


obtain the solution from the nonlinear model as,

where Jcm = 13 mL2 is the moment of inertia of the pendulum about its center of mass. Taking the horizontal plane
where the arm lies as the datum plane, the only potential
energy in the mechanical system is gravity, i.e.,
V = mgL cos( )

(15)

(10)

B. Using Lagranian Formulation

1
1
1
T = Jeq 2 + m((xB )2 + (yB )2 ) + Jcm 2
2
2
2
1 2 1
2

= Jeq + m[(r L cos( ))


2
2
1
+ (L sin( ) )2 ] + Jcm 2
2
1
2 2 2
2 2
= (Jeq + mr ) + mL mLr cos( )
2
3

(14)

a5Vm = a1 a2 cos( ) + a2 sin( ) 2 + a3 + a4


(16)
0 = a2 cos( ) + a6 a7 sin( )

Tout put Beq = (Jeq + mr2 ) mLr cos( ) )


mLr sin( ) 2
4
0 = mrL cos( ) + mL2 mgL sin( )
3

m g Kt Km Kg2
m g Kt Kg
Vm

Rm
Rm

Substituting (14) into (10), we obtain the nonlinear model


of the system as follows:

Jeq =Tout put Beq (mr


+ mL sin( ) 2 mL cos( ) )r
Jeq =Tout put Beq (mr2 + mLr sin( ) 2
mLr cos( ) )
Tout put Beq =(Jeq + mr2 ) mLr cos( ) )

(13)

[a3 a5 a2 a5 sin( ) 2

[a2 a3 a5 cos( ) a22 a5 cos( ) sin( ) 2

(12)

Since we have two generalized coordinates, and ,


we therefore have two equations according to Lagrangian
Formulation,

+a2 a6 sin( ) cos( ) + a4 a5Vm ]


a1 a5 a22 cos2 ( )

+a22 a6 sin( ) cos2 ( ) + a2 a4 a5 cos( )Vm ]


a5 (a1 a6 a22 cos2 ( ))
a6
+ sin( )
a5

(18)

C. Linear system
For designing the State observer the linearized model is
given as follows. There are two equilibrium points, =
(pendulum down, stable) and = 0 (pendulum up, unstable).
Focusing on small variations and linearizing about unstable
point by considering cos = 1 and sin = The state space
representation of the above system is

0
1
0
0
0
0
0
1

a2 a6
a5 a3

0
0


a1 a5 a22
a1 a5 a22

a1 a6
a2 a3

0
0

a1 a5 a22
a1 a5 a22

(19)

0

K
K
a
Vm

m
g
t
g
5
+

2
aRma1a5KaK2

If the state observer estimates all state variables of the system, regardless of whether some state variables are available
for direct measurement, it is called a full-order state observer.
Sometime it is not necessary, we need observation of only the
unmeasurable state variables, but not those that are directly
measurable. An observer that estimates fewer than n state
variables, where n is the dimension of the state vector, is
called a reduced-order state observer. State observers can be
designed if and only if the observability condition is satisfied
[5].
Consider a nominal system
x = Ax + Bu
y = Cx

(22)
(23)

Consider a system with an observer as shown in Fig.3 [6].

2 m g t g

Rm a1 a5 a22

Substituting the constant values of the

0
1
0
0
0
0

0
33.29
16.73


0 67.48 11.83

= 0
0

+
29.28 Vm
20.56

parameters,

1

0
0

(20)

Eigenvalue are at 0 , -18.0993, 7.1140, and -5.6447. One


pole of the system is in right hand side therefore open-loop
system is unstable. The state matrices are

0
1
0
0
0
0
0
1

A=
0 33.29 16.73 0
0 67.48 11.83 0

0
0

B=
29.28
(21)
20.56

1 0 0 0
0 1 0 1

C=
0 0 1 0
0 0 0 1
D = [0]
III. O BSERVER D ESIGN
1) State Observer: In modern control theory designs are
based on the assumption that the state vector of the system to
be controlled is available for measurement. Many times the
states of the system are unavailable, unmeasurable. A state
observer is a system that models a real system, in order to
provide an estimate of its system state, with the knowledge
measurements of the input and output of the real system. If
a system is observable, it is possible to fully reconstruct the
system state from its output measurements using the state
observer [1].

Fig. 3.

closed loop observer

The design of the observer is the design of evaluating


the constant vector L, so that the transient response of the
observer is faster than the response of the controlled loop in
order to yield a rapidly updated estimate of the state vector.
To increase the speed of convergence between the actual
and estimated states, we use feedback. The error between
the outputs of the plant and the observer is feedback to
the derivatives of the observers states. The system corrects
to drive this error to zero. With feedback we can design
a desired transient response into the observer that is much
quicker than that of the plant or controlled closed-loop
system [6].
Writing the dynamic equations of the observer from fig.3,
to get
x
y

= Ax + Bu + L(y y )
= Cx

(24)
(25)

Subtracting Eqn. (24) from (22) and (Eqn. 25) from (23), to
obtain
x x = A(x x ) L(y y )
y y = C(x x )

(26)
(27)

where (x x ) is the error between the actual state vector


and the estimated state vector, and (y y ) is the error between
the actual output and the estimated out-put. Substituting the
output equation into the state equation, we obtain the state

equation for the error between the estimated state vector and
the actual state vector [7].
x x
y y

= (A LC)(x x )
= C(x x )

(28)
(29)

Letting ex = (x x ), to get
eX
y y

= (A LC)eX

(30)

= CeX

(31)

If Eqn. (30) is stable then dynamics behavior of error


vector is stable and error vector converge to zero for any
initial error vector. If the eigenvalues are all negative, the
estimated state vector error, ex , will decay to zero. The design
then consists of solving for the values of L to yield a desired
characteristic equation or response for Eqns. (30) and (31).
The characteristic equation is found from Eqs (30) and
(31) to be,
det[ I (A LC)] = 0
(32)
Now we select the eigenvalues of the observer to yield
stability and a desired transient response that is faster than
the controlled closed-loop response. These eigenvalues determine a characteristic equation that we set equal to Eqn.
(32) to solve for L.
The problem with Luenberger observer is when we increase the observer gain L to converge system states as earlier
as, it leads to peaking phenomena. In peaking phenomena the
first estimation error is very high and also it is applicable to
LTI systems [8].
2) Sliding Mode Observer: In traditional sliding mode
design, an appropriate sliding variable s(t), is selected such
that it has relative degree one with respect to the designed
injection signal. This selection of sliding variable must be
made to ensure that the dynamics of the system in the sliding
mode, i.e. when s=0, are desirable. The injection signal then
acts on the first derivative (with respect to time) of the sliding
variable (s)
to keep the system trajectories in the sliding set
s=0 [9].
SMO with high-gain approach is developed to estimate
system states. The states available for measurement are
and and pendulum states and are to be estimated.
The system in (18) can be written as,
xa
xr

= fa (x) + ba u

(33a)

= fr (x) + br u

(33b)

where

[a22 a6 sin( ) cos2 ( )

fr =
a22 a5 cos( ) sin( ) 2

a2 a3 a5 cos( ) ]
a5 (a1 a5 a22 cos2 ( ))

[
ba

br

fr1
fr2

+ aa65 sin( )

]T

a4 a5Vm
a1 a5 a22 cos2 ( )

a2 a4 a5 cos( )Vm
a5 (a1 a6 a22 cos2 ( ))

]T

As discussed in [10], SMO dynamics are governed by


xba
xbr

= fa (b
x) + ba u + Kmsign(s)
= fr (b
x) + br u + Lr Kmsign(s)

(34a)
(34b)

where xbr and xba are the estimates of the unmeasurable and
measurable state vectors xr and xa respectively. Lr 22 ,K
22 , and m = [|s1 | |s2 | ] with 0 < < 1.
The switching function is defined as
s = xa xba xea

(35)

Subtracting (33a) from (34a) and (33b) from (34b) gives


the observer error dynamics,
xea
xer

= fa Kmsign(s)

(36a)

= fr Lr Kmsign(s)

(36b)

where fa fa (x)fa (b
x), fr fr (x)fr (b
x), and e
xr x b
x.
From (35) and (36a)
s = fa Kmsign(s)

(37)

K is a diagonal matrix and is designed to ensure sliding.


During sliding xea = 0 from 36a and 36b, the error for the
reduced subsystem by the equivalent control is,
xer = fr Lr fa

(38)

Linearizing about xer = 0


]
[

f r Lr
fa xer
xer =
xr
xr

(39)

which can be rewritten as,


xer = [xr fr Lr xr fa ] xer

xa = [ ]T , xr = [ ]T

fa

a2 a6 sin( ) cos( )
=

a2 a sin( ) 2 a a
3 5
2 5
a1 a5 a22 cos2 ( )

[
]

fa1

fa2

where xr = ( xr ), using fa and fr from (33a)and (33b)


[
x r fr =
[
xr fa =

fr2

fr2

fa2

fa2

]
]

(40)

, error, hat (in degree)

0
0
[
0
xr fa =
0
xr fr =

1
+
0
] [
0
+
0

0
1
0
3

0
Ar + i
2
]
0
Cr + i
4

error
hat

4
3

(41)

, error, hat (in degree)

where i for i = 1 - 4 represents uncertainties and nonlinearities, and here


[ (Ar ,Cr]) pair is unobservable.
0 0
Taking Cr =
so the (Ar ,Cr ) pair is observable. Lr
1 0
is to be designed using the high-gain approach to ensure
[Ar LrCr ] to be Hurwitz along with the requirements of
fast convergence and robustness of the estimates.

2
1
0
1
2
3
4
5

0.2

IV. S IMULATION R ESULTS

0.4
0.6
time (in sec)

Fig. 6.

0.8

, error in ,

The mathematical model is developed in MATLAB using


m-file and simulink. The model shows linear as well as
nonlinear model of system as discussed in system modeling.
A. State Observer

d/dt, error, d hat/dt (in degree)


80

Observer poles are at Op1 = 10; Op2 = 20;


Op3 = 20; Op4 = 40;
The observer gain is calculated as follows by using pole
placement method,
L = place(A ,C , [Op1 Op2 Op3 Op4 ])

d/dt, error, d hat/dt (in degree)

, error, hat
200

error
hat

, error, hat

d/dt
error
d/dt hat

60
40
20
0
20
40

200

60

400

80

0.2

0.4
0.6
time (in sec)

600
800

Fig. 7.

0.8

, error in ,

1000
1200

B. Sliding mode observer

1400
1600

0.2

0.4
0.6
time (in sec)

Fig. 4.

0.8

, error in ,

Observer pole is at po = [7 6]
Gains are k1 = 50; k2 = 1.2 and = 0.5
, error, hat (in degree)
500

error
hat

d/dt, error, d/dt hat


100

400

d/dt
error
d/dt hat

300
, error, hat (in degree)

d/dt, error, d/dt hat

100
200
300
400

200
100
0

500

100

600

200

700

300

800

time (in sec)


0

0.2

0.4
0.6
time (in sec)

Fig. 5.

, error in ,

0.8

Fig. 8.

, error in ,

d/dt, error, d/dt hat (in degree)

R EFERENCES

1500
d/dt
error
d/dt hat

d/dt, error, d/dt hat (in degree)

1000

500

500

1000

1500

time (in sec)

Fig. 9.

, error in ,

, error, hat (in degree)


15

error
hat

, error, hat (in degree)

10

10

15

20

time (in sec)

Fig. 10.

, error in ,

d/dt, error, d/dt hat (in degree)


150
d/dt
error
d/dt hat

d/dt, error, d/dt hat (in degree)

100

50

50

100

150

200

time (in sec)

Fig. 11.

, error in ,

V. F UTURE WORK

Implementation of Sliding mode observer for RIP.

[1] D.G.Luenberger, An introduction to observer, IEEE transaction on


automatic control, vol. AC-16, no. 6, pp. 596602, 1971.
[2] S. K. Spurgeon, Sliding mode observers: a survey, International
Journal of Systems Science, vol. 39, no. 8, pp. 752764, Aug 2007.
[3] Wikipedia, Pendulum.
[4] Quanser, SRV 02RotaryPendulumStudentManual, Quanser.
[5] D.G.Luenberger, Observering the state of a linear system, IEEE
transaction on automatic control, pp. 7480, 1963.
[6] N. Nice, Control System Engineering. Wiley, 2004.
[7] K. Ogata, Modern Control Engineering. Prentice Hall, 2008.
[8] H. Khalil, Nonlinear Systems. Prentice Hall, 2006.
[9] S. K. B. Bandyopadhyay, P. S. Gandhi, Sliding mode observer based
sliding mode controller for slosh-free motion through pid scheme,
International Journal of Systems Science, vol. 56, no. 9, pp. 3432
3442, Sep 2009.
[10] V. I. U. S. Drakunov, Sliding-mode observers: Tutorial, IEEE Conf.
Decision Control, vol. 34, pp. 33763378, 1995.

You might also like