Академический Документы
Профессиональный Документы
Культура Документы
Questions
h m
f M
The cart is a one dimensional horizontally moving base; the mass of the pendulum is
evenly distributed. The following variables are specified:
Variable Definition
M Mass of the cart (kg)
L Length of the pendulums centre of mass (m)
F Force applied to cart (N)
m Mass of the pendulum(kg)
x Cart horizontal displacement from origin
( )
The goal is to stabilize the pendulum at the upward (and downward) position.
1
2. Derivation of the dynamical model
(M m) x mL cos mL 2 sin f
mLx cos mL2 mgL sin 0
Use the result above, get the state space model for the linearized systems (Hint: An
option is to take [ ] as state variable).
Convert the state space model above into modal and canonical forms
(hint: try the matlab commands: canon, modreal)
6. Check controllability
Check controllability for both conditions (hint :ctrb) and design LQR controller to
stabilize pendulum at the equilibriums for upward position and downward position.
(hint: Matlab function lqr may be useful for this design(or function place may be
used if you want to place the close loop system poles arbitrarily) and lsim may be
used to test the close loop response after adding in the controller)
2
More Hints
(Please try to earnestly do this first without looking at the solution)
Derivation of inverted pendulum dynamic equations
h m
f M
Using Lagrangian method, T V where T is the kinematic energy and V the potential energy of
the system.
T Tc Tp where the first term is the kinematic energy of the cart and the second term is that of the
x x L sin
pole. As the coordinate of the cart and pole can be written as and , the kinematic
0 L cos
1 1 2 2
energy can be written as: Tc Mx 2 and Tp m ( x L sin ) ( L cos )
2 2
1 1 2 2
Thus the total energy T V Mx 2 m ( x L sin ) ( L cos ) mgL cos
2 2
3
x
The generalized coordinates are selected as X so the Lagrangian equations are:
d
f
dt x x
d
0
dt
f m sin ( L 2 g cos )
x
M m sin 2
f cos mL 2 sin cos ( M m) g sin
L( M m sin 2 )
x
x
Define X
x
x
f m sin ( L g cos )
2
x
M m sin 2
X ..(1)
f cos mL 2
sin cos ( M m ) g sin
L( M m sin ) 2
x 0
x 0
Linearizing at upward position, the equilibrium is X
0
0
By ignoring second order terms,
x x 0 1 0 0 0
1
x f m sin ( L g cos )
2
f m g mg x
x 0 0 0
M m sin 2
M M x M f
X
0 0 0 1 0
f cos mL sin cos ( M m) g sin f ( M m) g 0 ( M m) g 1
2
0 0
LM
L( M m sin 2 ) LM LM
4
x
x 1 0 0 0 x
y
0 0 1 0
x 0
x 0
Linearizing at downward position, X
0
Define , since , 0 . so and .
And sin sin( ) sin , cos cos( ) 1.
Substitute above equations into (1) and write as for simplicity:
x 0 1 0 0 0
x f m g mg x 1
x 0 0 0
X M M x M f
0 0 0 1 0
f ( M m) g 0 0
( M m) g
0 1
LM LM LM
x
x 1 0 0 0 x
And y
0 0 1 0
Controllability:
find the optimal control law for a linear system, xT Qx is for regulation effort and term uT Ru
is to constrain the actuator input. The feedback control law that can minimize the cost
function will be in the form of u Kx where K R1BT P and term P is the solution of
Riccati equation AT P PA PBR 1BT P Q 0 . Q is a positive-semi definite matrix and R
is positive definite. The controller can be found by using Matlab function lqr.