You are on page 1of 8

Chapter 11

Dynamics: Inverted pendulum on a cart


The gure to the right shows a rigid inverted pendulum
B attached by a frictionless revolute joint to a cart A
(modeled as a particle). The cart A slides on a horizon-
tal frictionless track that is xed in a Newtonian reference
frame N. Right-handed sets of unit vectors n
x
, n
y
, n
z
and
b
x
, b
y
, b
z
are xed in N and B respectively, with:
n
x
horizontal and to the right
n
y
vertically upward
n
z
=b
z
parallel to the axis of rotation of B in N
b
y
directed from A to the distal end of B
b
x
= b
y
b
z
The identiers in the following table are useful while form-
ing equations of motion for this system. Complete the
gure to the right by adding the identiers N, A, B, B
cm
,
L, F
c
, x, , n
x
, n
y
, n
z
, b
x
, b
y
, b
z
.
Quantity Symbol Value
Mass of A m
A
10.0 kg
Mass of B m
B
1.0 kg
Distance from A to B
cm
(the mass center of B) L 0.5 m
Central moment of inertia of B for b
z
I
zz
0.08333 kgm
2
Earths sea-level gravitational constant g 9.81 m/sec
2
Feedback-control force applied to A in n
x
direction F
c
specied
Distance from N
o
(a point xed in N) to A x variable
Angle between the local vertical and the long axis of B variable
11.1 Kinematics (space and time)
Kinematics is the study of the relationship between space and time, and is independent of the inuence of
mass or forces. The kinematic quantities normally needed for dynamic analysis are listed below. In most
circumstances, it is ecient to form rotation matrices, angular velocities, and angular accelerations before
position vectors, velocities, and accelerations.
Kinematic Quantity Quantities needed for analyzing the inverted pendulum on a cart
Rotation matrix
b
R
n
, the rotation matrix relating b
x
, b
y
, b
z
and n
x
, n
y
, n
z
Angular velocity
N

B
, the angular velocity of B in N
Angular acceleration
N

B
, the angular acceleration of B in N
Position vectors r
A/No
and r
Bcm/A
, the position vector of A from N
o
and of B
cm
from A
Velocity
N
v
A
and
N
v
Bcm
, the velocity of A in N and the velocity of B
cm
in N
Acceleration
N
a
A
and
N
a
Bcm
, the acceleration of A in N and the acceleration of B
cm
in N
75
11.2 Rotation matrices
The orientation of a set of mutually-perpendicular right-handed unit vectors b
x
, b
y
, b
z
in a second set
of mutually-perpendicular right-handed unit vectors n
x
, n
y
, n
z
is frequently stored in a 33 rotation
matrix denoted
b
R
n
. The elements of
b
R
n
are dened as
b
R
n
ij

= b
i
n
j
(i, j =x, y, z)
All rotation matrices are orthogonal, which means
that its inverse is equal to its transpose and it can be
written as a table read horizontally or vertically.
b
R
n
n
x
n
y
n
z
b
x
b
R
n
xx
b
R
n
xy
b
R
n
xz
b
y
b
R
n
yx
b
R
n
yy
b
R
n
yz
b
z
b
R
n
zx
b
R
n
zy
b
R
n
zz
Rotation matrix example
The system has two sets of mutually-perpendicular right-handed unit vectors, namely b
x
, b
y
, b
z
and
n
x
, n
y
, n
z
. These two sets of vectors are drawn in a geometrically suggestive way below. One way to
calculate the rst row of the
b
R
n
rotation matrix is by expressing b
x
in terms of n
x
, n
y
, n
z
, and then
lling in the rst row of
b
R
n
as shown below. Similarly, the second and third rows of
b
R
n
are calculated
by expressing b
y
and b
z
in terms of n
x
, n
y
, n
z
, and lling in the second and third rows of
b
R
n
.

b
x
= cos() n
x
sin() n
y
b
y
= sin() n
x
+ cos() n
y
b
z
= n
z
b
R
n
n
x
n
y
n
z
b
x
cos()
-
sin() 0
b
y
sin() cos() 0
b
z
0 0 1
11.3 Angular velocity
As shown in equation (1), the angular velocity of a
reference frame B in a reference frame N can be cal-
culated directly from the rotation matrix that relates
b
x
, b
y
, b
z
to n
x
, n
y
, n
z
and its time-derivative.
Since equation (1) contains

R
ij
(i, j=x, y, z) it is clear
that angular velocity is a measure of the time-rate of
change of orientation.
R
ij

= b
i
n
j
(i, j =x, y, z)
N

B
=

R
xz

R
xy
+ R
yz

R
yy
+ R
zz

R
zy

b
x
+

R
yx

R
yz
+ R
zx

R
zz
+ R
xx

R
xz

b
y
+

R
zy

R
zx
+ R
xy

R
xx
+ R
yy

R
yx

b
z
(1)
11.3.1 Simple angular velocity
Although equation (1) is a general relationship between the rotation matrix and angular velocity, it is
non-intuitive.
1
Since angular velocity is complicated, most textbooks dene simple angular velocity,
which is useful for two-dimensional analysis. The simple angular velocity of B in N is calculated as
N

B
=
(simple)


(2)
where is a vector xed
2
in both N and B. The sign of

is determined by the right-hand rule. If
increasing causes a right-hand rotation of B in N about
+
, the sign is positive, otherwise it is negative.
1
One of the major obstacles in three-dimensional kinematics is properly calculating angular velocity.
2
A vector is said to be xed in reference frame B if its magnitude is constant and its direction does not change in B.
Copyright c 1992-2009 by Paul Mitiguy 76 Chapter 11: Dynamics: Inverted pendulum on a cart
The following is a step-by-step process for calculating a simple angular velocity
N

B
:
Identify a unit vector that is xed in both N and B
Identify a vector n

that is xed in N and perpendicular to


Identify a vector b

that is xed in B and perpendicular to


Identify the angle between n

and b

and calculate its time-derivative


Use the right-hand rule to determine the sign of . In other words, point the four ngers of your
right hand in the direction of n

, and then curl them in the direction of b

. If you thumb points in


the direction of , the sign of is positive, otherwise it is negative.
11.3.2 Simple angular velocity example
The gure to the right has two reference frames, B and N. Since b
z
is xed in
both B and N, the angular velocity of B in N is a simple angular velocity that
can be written as
N

B
=
-

b
z
The following step-by-step process was used to calculate
N

B
:
b
z
is a unit vector that is xed in both N and B
n
y
is xed in N and perpendicular to b
z
b
y
is xed in B and perpendicular to b
z
is the angle between n
y
and b
y
, and

is its time-derivative
After pointing the four ngers of your right hand in the direction of n
y
and
curling them in the direction of b
y
, your thumb points in the
-
b
z
direction.
Hence, the sign of b
z
is negative.

B
11.3.3 Angular velocity and vector dierentiation
The golden rule for vector dierentiation calculates
N
dv
dt
, the ordinary-derivative of v with respect
to t in N, in terms of the following:
Two reference frames N and B

N

B
, the angular velocity of B in N
v, any vector that is a function of a single scalar variable t

B
dv
dt
, the ordinary-derivative of v with respect to t in B
N
dv
dt
=
B
dv
dt
+
N

B
v (3)
Equation (3) is one of the most important formulas in kinematics because v can be any vector, e.g.,
a unit vector, a position vector, a velocity vector, a linear/angular acceleration vector, a linear/angular
momentum vector, or a force or torque vector.
11.3.4 Angular velocity and vector dierentiation example
An ecient way to calculate the time-derivative in N of Lb
y
is as follows:
N
d (Lb
y
)
dt
=
(3)
B
d (Lb
y
)
dt
+
N

B
Lb
y
= 0 +

b
z

Lb
y
=

Lb
x

L
B
N
Copyright c 1992-2009 by Paul Mitiguy 77 Chapter 11: Dynamics: Inverted pendulum on a cart
11.4 Angular acceleration
As shown in equation (4), the angular acceleration of a reference frame B
in a reference frame N is dened as the time-derivative in N of
N

B
.
N

B
also happens to be equal to the time-derivative in B of
N

B
.
Note: Employ this useful property of angular acceleration when it is easier to compute
B
d
N

B
dt
than it is to compute
N
d
N

B
dt
.
N

B

=
N
d
N

B
dt
=
B
d
N

B
dt
(4)
Angular acceleration example
The gure to the right has two reference frames, B and N. Although the
angular acceleration of B in N is dened as
N

B

=
N
d
N

B
dt
, it is more
easily calculated with the alternate denition, i.e.,
N

B
=
B
d
N

B
dt
=
B
d (
-

b
z
)
dt
=
-

b
z

B
11.5 Position vectors
A points position vector characterizes its location from another point.
3
The gure on the right shows three points N
o
, A, and B
cm
.
By inspection, one can determine:
r
A/No
= xn
x
(As position vector from No)
r
Bcm/A
= Lb
y
(Bcms position vector from A)
B
cm
s position vector from N
o
is computed with vector addition, i.e.,
r
Bcm/No
= r
Bcm/A
+ r
A/No
= Lb
y
+ xn
x
L
A
B
N
x
11.6 Velocity
The velocity of a point B
cm
in a reference frame N is denoted
N
v
Bcm
and
is dened as the time-derivative in N of r
Bcm/No
(B
cm
s position vector from
N
o
). Note: Point N
o
is any point xed in N.
N
v
Bcm

=
N
d r
Bcm/No
dt
(5)
3
Since a position vector locates a point from another point and because a body contains an innite number of points, a
body cannot be uniquely located with a position vector. In short, a body does not have a position vector.
Copyright c 1992-2009 by Paul Mitiguy 78 Chapter 11: Dynamics: Inverted pendulum on a cart
Velocity example
The gure to the right shows a point B
cm
moving in reference frame N.
Dierentiating B
cm
s position vector from N
o
yields B
cm
s velocity in N.
N
v
Bcm

=
N
d r
Bcm/No
dt
=
N
d (xn
x
+ Lb
y
)
dt
=
N
d (xn
x
)
dt
+
N
d (Lb
y
)
dt
= xn
x
+
B
d (Lb
y
)
dt
+
N

B
Lb
y
= xn
x
+ 0 +
-

b
z
Lb
y
= xn
x
+

Lb
x

L
A
B
N
x
11.7 Acceleration
The acceleration of a point B
cm
in a reference frame N is denoted
N
a
Bcm
and
is dened as the time-derivative in N of
N
v
Bcm
(B
cm
s velocity in N).
N
a
Bcm

=
N
d
N
v
Bcm
dt
(6)
Acceleration example
The gure to the right shows a point B
cm
moving in reference frame N.
Dierentiating B
cm
s velocity in N yields B
cm
s acceleration in N.
a
N
a
Bcm

=
N
d
N
v
Bcm
dt
=
N
d ( xn
x
+

Lb
x
)
dt
=
N
d ( x n
x
)
dt
+
N
d (

Lb
x
)
dt
= xn
x
+
B
d (

Lb
x
)
dt
+
N

B
(

Lb
x
)
= xn
x
+

L b
x
+ (
-

b
z
) (

Lb
x
)
= xn
x
+

Lb
x
+
-

2
Lb
y
a
There are certain acceleration terms that have special names, e.g., Coriolis, cen-
tripetal, and tangential. Knowing the names of acceleration terms is signicantly less
important than knowing how to correctly form the acceleration.

L
A
B
N
x
11.8 Mass distribution
Mass distribution is the study of mass, center of mass, and inertia properties of systems components.
One way to experimentally determine an objects mass distribution properties is to measure mass with
a scale, measure center of mass by hanging the object and drawing vertical lines, and measure moments
of inertia by timing periods of oscillation. Alternately, by knowing the geometry and material type, it is
Copyright c 1992-2009 by Paul Mitiguy 79 Chapter 11: Dynamics: Inverted pendulum on a cart
possible to calculate the mass, center of mass, and inertia properties. These calculations are automatically
performed in CAD and motion programs such as SolidWorks, Solid Edge, Inventor, Pro/E, Working Model,
MSC.visualNastran 4D, MSC.Adams, etc. In general, the quantities needed for dynamic analysis are:
the mass of each particle, e.g., the mass of particle A is m
A
the mass of each body, e.g., the mass of body B is m
B
the central inertia dyadic of each body. Since B has a simple angular velocity in N, I
zz
(the moment
of inertia of B about B
cm
for the b
z
axis) is sucient for this analyses.
11.9 Contact and distance forces
One way to analyze forces is to use a free-body diagram to isolate a single body
and draw all the forces that act on it. Use the gure on the right to draw all the
contact and distance forces on the cart A and pendulum B.
a
Quantity Description
F
c
n
x
measure of control force applied to A
m
A
g
-
n
y
measure of local gravitational force on A
N n
y
measure of the resultant normal force on A
R
x
n
x
measure of the force on B from A
R
y
n
y
measure of the force on B from A
m
B
g
-
n
y
measure of local gravitational force on B
The resultant forces on A and B are
F
A
= (F
c
R
x
) n
x
+ (N m
A
g R
y
) n
y
F
B
= R
x
n
x
+ (R
y
m
B
g) n
y
a
When a force on a point is applied by another point that is part of the system being considered,
it is conventional to use action/reaction to minimize the number of unknowns. Notice that the
force on A from B is treated using action/reaction, whereas the force on A from N is not.
A
B
A
11.10 Moments
The moment of all forces on B about B
cm
is
4
M
B/Bcm
= r
A/Bcm
(R
x
n
x
+ R
y
n
y
) + r
Bcm/Bcm

-
m
B
g n
y

=
-
Lb
y
(R
x
n
x
+ R
y
n
y
)
=
-
LR
x
(b
y
n
x
) +
-
LR
y
(b
y
n
y
)
= [Lcos()R
x
Lsin()R
y
] b
z
4
Use the rotation table to calculate the cross-products (by nx) and (by ny).
Copyright c 1992-2009 by Paul Mitiguy 80 Chapter 11: Dynamics: Inverted pendulum on a cart
11.11 Newtons law of motion
Newtons law of motion for particle A is F
A
= m
A

N
a
A
, where: F
A
is the resultant of all forces on A; m
A
is the mass of A; and
N
a
A
is the acceleration of A in N. Substituting into Newtons law produces
(F
c
R
x
) n
x
+ (N m
A
g R
y
) n
y
= m
A
xn
x
Dot-multiplication with n
x
gives:
F
c
R
x
= m
A
x
Dot-multiplication with n
y
gives:
N m
A
g R
y
= 0
Similarly, Newtons law of motion for body B is F
B
= m
B

N
a
Bcm
, where: F
B
is the resultant of all forces
on B; m
B
is the mass of B; and
N
a
Bcm
is the acceleration of Bs mass center in N. This produces
R
x
n
x
+ (R
y
m
B
g) n
y
= m
B

xn
x
+

Lb
x

2
Lb
y

Dot-multiplication with n
x
gives:
a
R
x
= m
B

x +

L(b
x
n
x
)

2
L (b
y
n
x
)

= m
B

x +

L cos()

2
L sin()

a
Use the rotation table to calculate dot-products.
Dot-multiplication with n
y
gives:
a
(R
y
m
B
g) = m
B

L(b
x
n
y
)

2
L (b
y
n
y
)

= m
B

L
-
sin()

2
L cos()

a
Use the rotation table to calculate dot-products.
11.12 Eulers planar rigid body equation
Eulers planar rigid body equation for a rigid body B in a Newtonian reference frame N is
M
B/Bcm
z
=
(10.3)
I
zz
N

B
where M
B/Bcm
z
is the n
z
component of the moment of all forces on B about B
cm
, I
zz
is the mass moment
of inertia of B about the line passing through B
cm
and parallel to b
z
, and
N

B
is the angular acceleration
of B in N. Assembling the terms and subsequent dot-multiplication with b
z
produces
L cos() R
x
L sin() R
y
=
-
I
zz

11.13 Summary of Newton/Euler equations of motion


Combining the results from Sections 11.11 and 11.12 gives
F
c
R
x
= m
A
x
N m
A
g R
y
= 0
R
x
= m
B

x +

L cos()

2
L sin()

(R
y
m
B
g) = m
B

L sin()

2
L cos()

L cos() R
x
L sin() R
y
=
-
I
zz

L
F
c
A
B
N
x
The unknown variables
5
in the previous set of equations
6
are R
x
, R
y
, N, x, and .
5
Once (t) is known,

(t) and

(t) are known. Similarly, once x(t) is known, x(t) and x(t) are known.
6
The methods of DAlembert, Gibbs, Lagrange, and Kane, are more ecient than free-body diagrams for forming equations
of motion in that the unknown constraint forces Rx, Ry, and N are automatically eliminated.
Copyright c 1992-2009 by Paul Mitiguy 81 Chapter 11: Dynamics: Inverted pendulum on a cart
11.14 Summary of kinematics
This chapter presented a detailed analysis for forming equations of motion for an inverted pendulum on
a cart. Although some of the analysis is specic to this problem, many of the kinematic denitions and
equations are widely applicable. The important concepts are summarized in the following table.
Quantity How determined Specic to this problem
Rotation matrix SohCahToa
b
R
n
n
x
n
y
n
z
b
x
cos()
-
sin() 0
b
y
sin() cos() 0
b
z
0 0 1
Simple angular velocity
N

B
=


N

B
=
-

b
z
Angular acceleration
N

B

=
N
d
N

B
dt
N

B
=
-

b
z
Position vector Inspection or r
A/No
= xn
x
vector addition r
Bcm/No
= xn
x
+ Lb
y
Velocity
N
v
Bcm

=
N
d r
Bcm/No
dt
N
v
A
= xn
x
N
v
Bcm
= xn
x
+ L

b
x
Acceleration
N
a
Bcm

=
N
d
N
v
Bcm
dt
N
a
A
= xn
x
N
a
Bcm
= xn
x
+ L

b
x
L

2
b
y
Copyright c 1992-2009 by Paul Mitiguy 82 Chapter 11: Dynamics: Inverted pendulum on a cart

You might also like