Chapter 2
Double Inverted Pendulum (A pre-robotic problem)
PP. 20-44
Mahesh A. Yeolekar 21
2.1 Introduction
At least from last five decades, the inverted pendulums have been the
most basic benchmark for researches in robotics. Balancing an
inverted pendulum in upright position is a problem of sensitive control
which is an important subset of problems in the field of robotics. The
balancing a stick on the fingertip is the simple example of invited
pendulum as shown in the Fig 2.1.
http://people.kth.se/~crro Fig 2.1 Balancing a stick
The inverted pendulum is a pendulum which has its centre of mass
above its fixed end as shown in Fig 2.2.
www.dofware.com (a) (b)
Fig 2.2(a) A inverted pendulum with pivot point set up on a cart (b) A inverted pendulum with pivot point set up on a fixed base
Modeling and Stability of Robotic Motions
22
The main objective of this problem is to stable the link of inverted
pendulum in vertically straight direction using the feedback control by
computing gain matrix. The stability of inverted pendulum can be
applicable to the following problems:
The problem of robotic arm where the centre of gravity lies
above the centre of pressure as shown in Fig 2.3(a).
The problem of missile or rocket guidance where the centre of
gravity situated above the centre of drag which indicating the
aerodynamic instability as shown in Fig 2.3(b).
The problem of self-balancing unicycle and segway where the
device keeps upright automatically by the controller as shown in
Fig 2.3(c) and (d).
http://iq.intel.com http://spaceref. com/onorbit/ (a) Robotic Arm (b) Rocket Guidance
http://www.orthoconcept.ch/de http://www.focus.de/auto/motorrad
(c) Unicycle (d) Segway Fig 2.3 Applications of inverted problem
Mahesh A. Yeolekar 23
The problem can be varied by changing the number of links of the
pendulum. The inverted pendulum with more than one link is called
multilink inverted pendulum. If the human body is separated by the
joints, then it can be considered as the multilink inverted pendulum
when it is in the standing position. The humans are capable to stand
straight which distinguish them from other animals. Moreover, it is an
important part of human bipedal locomotion, but to stand stable is not
an easy mechanism as it looks. In humans, the central nervous system
and muscles are maintaining balance, but it is not same for the
artificial human. So, the study of multilink inverted pendulum is
important to understand the biped locomotion.
In this chapter, we will consider the human body as the double
inverted pendulum (2-link inverted pendulum) where a link of fixed
end is considered as a lower part (below the hip) of body and a free
movable link is considered as an upper of body (above the hip) as
shown in Fig 2.4.
http://swaggercise.weebly.com
Fig 2.4 Human body considered as Double inverted pendulum
Modeling and Stability of Robotic Motions
24
The double inverted pendulum (DIP) has two links, one above another
as shown in Fig 2.4. The inverted pendulum is a multivariable
nonlinear, highly unstable, uncontrolled system. There are two
standard ways to controlled it:
1. by moving the base
2. by applying the torque at the fixed end.
In the first method, the double inverted pendulum is placed on a
moving cart. This mechanism is inspired by the idea of balancing a
stick on a fingertip where we are balancing a stick in the upright state
by moving over hand. In the same way, the cart is moving linearly to
make stable the double inverted in the upright state as shown in Fig
2.5.
http://www.imath-asia.com/assets/index.php/quanser
Fig 2.5 Double inverted pendulum on a cart
In the second method, the base of the double inverted pendulum is
fixed at a point. To stabilize this system, the external torque is giving
by the motor joint at the fixed point. It is similar to Human posture in
Mahesh A. Yeolekar 25
quiet standing because in standing, human body is fixed at ankle and
mussels give the additional force to stand stable as shown in Fig 2.6.
http://clinicalgate.com/
(a) (b) Fig 2.6 (a) Human posture in quite standing (b) Relative positions of double inverted pendulum
In this chapter, we will discuss about the second approach to control
the double inverted pendulum because it is appropriate for
understanding of human locomotion. Various researches have been
done in this area, so a brief literature review is given in the next
section.
2.2 Literature review
The literature survey is about the existing methods to control and
stabilize the double inverted pendulum in upright unstable equilibrium
position. The system of a double inverted pendulum is a typically
nonlinear and natural characteristic of instabilities. So it is an ideal
model to test methods of advanced control theory. Kailath (1950) used
Modeling and Stability of Robotic Motions
26
the inverted pendulum for educating stability of open-loop unstable
systems by linear feedback control theory. But the credit of finding
first solution of this problem goes to Roberge (1960) and then
Schaefer and Cannon (1966) got success for controlling the inverted
pendulum. Mori et. al. (1976) designed the PD controller by using
state space model for controlling the inverted pendulum. The neural
network was used to stabilize the inverted pendulum by Anderson
(1989) and fuzzy-logic used by Yamakawa in the same year. The
problem of double inverted pendulum has also got considerable
attention. The controller for the double inverted pendulum was
designed by Furuta et. al. (1980). It controlled the position of the
supporting cart on a sloping bar. Maletinsky (1981) made controller
which can work without direct measurement of upper arm angle of the
double inverted pendulum. Spong (1995) applied partial
feedback linearization techniques for controlling a double pendulum
without a cart. We noticed that the following three most popular
under-actuated mechanisms for controlling and stabilization of the
double inverted pendulum are available in the literature:
The double inverted pendulum on a cart with actuator joint with
cart explained in detail by Zhong et. al. (2001) as shown in Fig
2.6.
Mahesh A. Yeolekar 27
Pendubot, a double inverted pendulum with an actuator at the
first joint only, was described in depth by Spong (1996) and
Graichen et. al. (2005) which displayed in Fig 2.7.
http://coecsl.ece.illinois.edu/pages/pendubot.html
Fig 2.7 Pendubot
Acrobot, the double inverted pendulum with an actuator at the
second joint only, was illustrated as nonlinear controllers by
Hauser (1990), as shown fig 2.8.
http://www.thegadgetshop.co.za/products_list.php?main_cat_id=21
Fig 2.8 Acrobot
In this chapter, we have focused on the problem of controllability and
stability of double inverted pendulum in the upright unstable position
using the pole placement method. We considered the double inverted
pendulum which is pivoted at the lower end of inner arm as shown Fig
2.4. We organised this chapter in the following three sections:
Modeling and Stability of Robotic Motions
28
First section contains the mathematical modelling which
described the dynamics of the system of double inverted
pendulum. The equation of motion of the double inverted
pendulum is obtained by the Euler-Lagrange formulation.
Second section includes the linearized state space model of the
nonlinear system of the double inverted pendulum. The
linearization is the key issue for controlling the nonlinear system
which is discussed by Wang et. al. (2000), Conga et. al.(2005)
and Jordan (2006).
Third section discusses about the stability and controllability
criteria which helps to control the system of the double inverted
pendulum. Considering these criteria, we used pole placement
method to control the system. In this method, the eigen-values
of the state space model are considered to be the poles for the
system in s-space. The gain matrix will be used to place the
poles at the desired position to stable a system. The numerical
and graphical illustrations are given to check the impact of
proposed pole placement method.
2.3 Mathematical Modeling
In this section, we will describe the mathematical model for the motion
of double inverted pendulum. The schematic diagram of the double
inverted pendulum is sketched in the Fig 2.9.
Mahesh A. Yeolekar 29
Fig 2.9: Schematic diagram of double inverted pendulum model
The required assumptions for modelling are listed below:
The system contains two identical rods whose masses are
concentred at the centres of their rods. So, it is considered as
two points mass system.
The lower end of a lower arm is fixed at a point which is called
pivot point of the system and its upper end is jointed with lower
end of upper arm as shown in the Fig 2.9.
It motions under the gravitational force and the actuator is
available at a pivot point to control its motion.
It is a 2D model that means the pendulum motions only in the
vertical plane.
m1g
m2g
2
1
Modeling and Stability of Robotic Motions
30
We concentrated here on the simplicity of the model than its physical
realizability which is done by the above assumptions.
2.3.1 Governing Equations
Before generating the motion equation, we set up some notations: In
this model, the configuration of double inverted pendulum is described
by 1 2
T where 1 and 2 are the angles made by the lower and
upper arms with vertical line respectively as shown in Fig 2.9 and
1 2 1 2
Tx
stands for the state space vector. T and V
represent the kinetic and potential energy respectively, 1 2
T
denotes the external torque vector.
The mathematical model of DIP can be derived using the Euler-
Lagrange equation. Considering the following form of the Euler-
Lagrangian equation
d L Ldt
(2.1)
where L T V is a Lagrangian, T is kinetic energy, V is potential
energy, 1 2
T is the input generalized force vector produced by
two actuators at the lower joint (ankle) and second at joint between to
arm (knee), 1 2
T is generalized coordinate vector where 1 and
2 are angular positions of first arm, and second arm of the double
Mahesh A. Yeolekar 31
pendulum. The kinetic and potential energies in terms of generalized
coordinates can be determined as:
2 2
1 1 1 1
2 2 2 2 2
2 1 1 1 2 2 1 2 2 2
12
14 4 cos
2
m l I
m l l l l IT
(2.2)
1 1 1
2 1 1 2
cos
2 cos cos
m glV
m g l l
(2.3)
Differentiating the Lagrangian L T V by vectors of generalized
coordinate system yields Euler-Lagrange equation (2.1) as:
2 2 2 21 1 1 2 1 2 1 2 2 2 2 1 2 1 2 2 2 2 2
22 1 2 2 2 2 1 2 2 1 2
1 2 1 1 2 2 1 2 1
4 4 cos 2 cos
2 sin 4 sin2 sin sin
m l I m l m l l m l m l l m l
m l l m l lm m gl m gl
2 2 22 1 2 2 2 2 1 2 2 2 2 2 1 2 2 1
2 2 1 2 2
2 cos 2 sin
sin
m l l m l m l I m l l
m gl
The matrix form of the system is given by the following equation:
,M N G
where M is the inertia matrix, the matrix ,N contains terms of
centrifugal and coriolis forces, G includes terms of gravity as given
below:
Modeling and Stability of Robotic Motions
32
2 2 2 2
1 1 1 2 1 2 1 2 2 2 2 2 1 2 2 2 22 2
2 1 2 2 2 2 2 2 2
4 4 cos 2 cos2 cos
m l I m l m l l m l m l l m lM
m l l m l m l I
2 1 2 2
2 1 2 2
2 1 2 2 1 2 1 2 1 1 2 2 1 2
2 2 1 2
0 2 sin,
2 sin 0
4 sin 2 sin sinsin
m l lN
m l l
m l l m m gl m glG
m gl
2.3.2 Linearized state space equation
In this chapter, we have used the gain scheduling method to design
the track controller of DIP. This method requires the linearized state
space system. So by considering the vertically straight position of DIP
as an equilibrium point, the system can be linearized at the equilibrium
point by taking
1 2
1 2
1 1 2 2
1 2 1 2 1 2 1 2
2 21 2
0,cos cos 1sin ; sin ;
0; cos 1; sin
0
With respect to the above values, the equations of linear system are:
2 2 2 21 1 1 2 1 2 1 2 2 2 2 1 2 2 2 2
1 2 1 1 2 2 1 2 1
2 22 1 2 2 2 1 2 2 2 2 2 2 1 2 2
4 4 212
2
m l I m l m l l m l m l l m l
m m gl m gl
m l l m l m l I m gl
Mahesh A. Yeolekar 33
The matrix form of the linear system
2 2 2 21 1 1 2 1 2 1 2 2 2 2 1 2 2 2 1
2 22 1 2 2 2 2 2 2 2
1 12 2 1 2 2 2 2
2 22 2 2 2
4 4 22
2
m l I m l m l l m l m l l m lm l l m l m l I
m m gl m gl m glm gl m gl
The state space model equation for the system is
x Ax Buy Cx Du
(2.4)
4 4 4 41 1where , , , 0A M N B M T C I D
2 21 1 1 2 1 2
2 1 2 2 222 1 2 2 2
2 22 1 2 2 2 2 2 2
1 0 0 00 1 0 0
40 0 2
40 0 2
m l I m lMm l l m l
m l l m lm l l m l m l I
1 2 1 2 2 2 2
2 2 2 2
0 0 1 00 0 0 1
2 0 00 0
Nm m gl m gl m gl
m gl m gl
0 0
0 0
1 0
0 1
T
;
1
2
1
2
x
; 1
2
u
.
Modeling and Stability of Robotic Motions
34
2.4 Stability and Controllability of the system
The state space model (2.4) can also be written in the following form
x t Ax t Bu t
y t Cx t Du t
(2.5)
where , ,A B C and D are time invariant. Therefore, the system of
double inverted pendulum can be considered as continuous time
invariant linear system. Moreover, it is capable to balance itself by
calculating gain matrix without human assistant so it can be thought
as an autonomous system. However, all such continuous linear time
invariant systems are not controllable and stable. Next we discuss
criteria required for stability and controllability of the system.
2.4.1. Stability
The double inverted pendulum is said to be stable if it is stay vertically
straight and capable to manage its balance during the small
perturbation. The stability of the system can be analyzed by the
following to different approaches:
first, by the poles of the system which are the eigenvalues of a
matrix A in (2.5),
second, the system’s Lyapunov stability which does not require
the eigenvalues.
Mahesh A. Yeolekar 35
In this chapter, we have used first method for analyzing the stability of
the system of double inverted pendulum.
Stability criterion A continuous time invariant linear system (2.5) is
stable if and only if all the eigenvalues of the matrix A are inside the
unit circle.
2.4.2 Controllability
The study of controllability is an important part of any control system.
It plays a key role in various control problems, such as a problem of
optimal control or a problem of stabilization of unstable systems by
feedback control method. Although, there is no exact definition of
controllability because it varies with respect to the class of models
applied. In broader sense, we can consider that the controllability
represents the moving capability of the system in the region of its
configuration space by using only certain allowable manipulations. The
unstable system can be controlled if it satisfies the following criterion:
Controllability criterion A continuous time invariant linear system (2.5)
is controllable if and only if the controllable matrix
2 1nP B AB A B A B has rank n where n is the number of
degrees of freedom of the system.
Modeling and Stability of Robotic Motions
36
The above condition of controllability shows that the initial value ( x t
in (2.5)) of a state vector can be reached to the final desired output
value ( y t in (2.5)) within some finite time interval. In other words, it
explains the capacity of an external input ( u t in (2.5)) to place the
internal state of a system from an initial state ( x t in (2.5)) to a
desired final state ( y t in (2.5)) within some finite time interval. Note
that the system is controllable, it does not mean that once it reached
the desired state place and maintained there, but it means that it can
be reached.
2.4.3 Pole placement Method
The objective of the pole placement method is to set the closed-loop
poles of linear continuous time invariant system at the desired
locations in s-plane by using feedback control. The poles of the system
are directly associated to the eigenvalues of the system and so the
placing of poles is desirable as the eigenvalues of the system must be
inside the unit circle for the stable system, in other words, the
characteristics of the response of the system are controlled by
eigenvalues. The pole placement method is applicable to the system if
it has the following properties:
The system should be state controllable.
Mahesh A. Yeolekar 37
The state variables should be measurable and accessible for
feedback.
The input for controller should be unconstrained.
The algorithm for the pole placement method is given below:
i. The output feedback control vector u t in equation (2.5) can be
constructed in the form u t Kx t where K is called the gain
matrix of the system. Note that the gain matrix K is calculated
in such a manner that poles will be located on the desired place.
ii. The state space system (2.5) is reduced to the following system
x A KB x which is called closed loop system.
iii. Gain matrix scheduling Consider the poles assigned with output
feedback as 1 2 3, , , , .n Now the problem is finding gain
matrix K for transferring the poles at the desired places. The
controllability matrix 2 1nP B AB A B A B which is an
n pn order matrix and the system is controllable, so
rank P n . That means, it has only n-linearly independent
columns among the pn-columns. Therefore, there are many ways
to construct an n n -similarity matrix which will give a multi-
input controllable canonical form. In this chapter, we use the
following technique:
Modeling and Stability of Robotic Motions
38
Consider, controllable matrix in n block as follows:
1 1
1 1 1
0 1 1
n n
p p pP b b Ab Ab A b A b
Block Block Block n
Starting from the left of this matrix, check each column, keeping
count of the number of linearly independent columns we
encounter. We may stop counting when it reaches to n-linearly
independent columns. Denote this last block of nth-linearly
independent column by 1 th block. Then, the first block in
which there are no more independent columns will be the th
block. This is controllability index. Rearranging this selected n-
linearly independent column 1 11 2 1 2 1 2, , , , , , , ,pb b b Ab Ab A b A b
we will get the invertible matrix M as:
1 21 1 2 2
11 1 p
p pM b A b b A b b A b
where 1i i p are the controllability indices of ,A B .
The inverse of M is
Mahesh A. Yeolekar 39
11
1 1
21
12 2
1
m
m
m
M m
mp
mp p
such that 1 ,MM I where 11 1 10, 0,1, , 2km A b k ,
1
1
11 1 1m A b
, 11 2 10, 0,1, , 2km A b k ,
11 3 10, 0,1, , ,km A b k .
Using this inverse matrix of M , calculate transformation matrix T
as follows:
Modeling and Stability of Robotic Motions
40
1 1
111 1
2 2
122 2
1
m
m A
m
Tm A
mp p
pm Ap p
Using desired poles {λ1, λ2, λ3,…, λn}, the transferred canonical
form of the system is
1 ,A T AT B TB
Using desired poles {λ1, λ2, λ3,…, λn}, the transferred canonical
form of the system is
0 1 2 1
0 1 0 0
0 0 1 0
0 0 0 1
n
A BK
or
Mahesh A. Yeolekar 41
1
2
1 2 3
1 2 3
0 1 0 0 0 0 0 0 0 0 0 00 0 1 0 0 0 0 0 0 0 0 0
0 0 0 1 0 0 0 0 0 0 0 00 0 0 0 0 0 0 0
0 1 0 00 0 0 0 0 0 0 00 0 1 00 0 0 0 0 0 0 0
0 0 0 10 0 0 0 0 0 0 00 0 0 0 0 0 0 0
0 0 0 00 0 0 0
0 0 0 00
A BK
1 2 3
0 1 0 00 0 0 00 0 1 00 0 0 0
0 0 0 10 0 0 00 0 0 0 0 0 0 p
Solving the above matrix equation we will get gain matrix.
Block diagram of pole placement is displayed in Fig. 2.10.
Fig 2.10: Block diagram of pole placement
+ r u x y Linearized system
x Ax Bu
C
Gain matrix K
Modeling and Stability of Robotic Motions
42
2.5 Simulation Results
Assumed values of parameters of the given double inverted pendulum
for the simulation are given below:
1m = mass of inner arm = 0.4 kg
2m = mass of outer arm = 0.5 kg
1l = length of inner arm = 5m
2l = length of outer arm =5m
g = gravitational acceleration = 29.8m s
So the corresponding values of state space matrices are as follows:
0 0 1 0
0 0 0 1
0.8276 1.4206 0 0
4.1012 2.1247 0 0
A
;
0 0
0 0
0.0328 0.0908
0.0908 0.1775
B
.
2.5.1 Stability of the system in absence of any external force
The eigenvalue of A of our system are: 0.0000 1.9939 ,i
0.0000 1.9939i , 1.0115 , 1.0115 which are outside the unit circle so
the system is unstable in absence any input force 1 20, . . 0, 0u i e
as shown in Fig 2.11.
Mahesh A. Yeolekar 43
Fig 2.11: Unstable system
2.5.2 Controllability of the system
With the above values of parameters, the controllable matrix
2 3P B AB A B A B has rank 4which is the degree of freedom of
the system, so the system is controllable
.
Modeling and Stability of Robotic Motions
44
2.5.3 Results of pole placement method
The system is controllable so we can apply pole placement method to
control it. For the desired poles0.1, 0.1, 0.1 , 0.1i i , the calculated gain
matrix is
93.8377 24.8771 0 0
24.1188 24.3614 0 0K
By giving input force with measurement of gain matrix, the angles and
their velocities will be slow down which makes the system stable at
the desired equilibrium position as shown in Fig 2.12.
Fig 2.12 Controlled system