QUBE-Servo Inverted Pendulum Modeling
QUBE-Servo Inverted Pendulum Modeling
QUBE-Servo Inverted Pendulum Modeling
v 1.0
The pendulum link is connected to the end of the rotary arm. It has a total length of Lp and it center of mass is 2p .
The moment of inertia about its center of mass is Jp . The inverted pendulum angle, , is zero when it is perfectly
upright in the vertical position and increases positively when rotated CCW.
= Qi
t qi
qi
The variables qi are called generalized coordinates. For this system let
q(t) = [(t) (t)]
(1.1)
where, as shown in Figure 1.1, (t) is the rotary arm angle and (t) is the inverted pendulum angle. The corresponding velocities are
[
]
(t) (t)
q(t)
=
t
t
Note: The dot convention for the time derivative will be used throughout this document, i.e., =
variable t will also be dropped from and , i.e., = (t) and = (t).
d
dt .
The time
With the generalized coordinates defined, the Euler-Lagrange equations for the rotary pendulum system are
L
2L
t
L
2L
= Q1
= Q2
See the QUBE-Servo User Manual for a description of the corresponding QUBE parameters (e.g. such as the backemf constant, km ). Our control variable is the input servo motor voltage, Vm . Opposing the applied torque is the
viscous friction torque, or viscous damping, corresponding to the term Br . Since the pendulum is not actuated, the
only force acting on the link is the damping. The viscous damping coefficient of the pendulum is denoted by Bp .
The Euler-Lagrange equations is a systematic method of finding the equations of motion, i.e., EOMs, of a system.
Once the kinetic and potential energy are obtained and the Lagrangian is found, then the task is to compute various
derivatives to get the EOMs. After going through this process, the nonlinear equations of motion for the QUBE-Servo
rotary inverted pendulum are:
(
)
(
)
1
1
1
2
2
2
2
mp Lr + mp Lp mp Lp cos() + Jr
mp Lp Lr cos()
4
4
2
)
(
)
(
1
1
mp L2p sin() cos() +
mp Lp Lr sin() 2 = Br
(1.2)
+
2
2
(
)
1
1
1
mp L2p cos() sin()2
mp Lp Lr cos() + Jp + mp L2p
2
4
4
1
mp Lp g sin() = Bp .
(1.3)
2
The torque applied at the base of the rotary arm (i.e., at the load gear) is generated by the servo motor as described
by the equation
g Kg m kt (Vm Kg km )
=
.
(1.4)
Rm
QUBE-SERVO INVERTED PENDULUM MODELING
v 1.0
Both the equations match the typical form of an EOM for a single body:
Jx
+ bx + g(x) = 1
where x is an angular position, J is the moment of inertia, b is the damping, g(x) is the gravitational function, and 1
is the applied torque (scalar value).
For a generalized coordinate vector q, this can be generalized into the matrix form
(1.5)
D(q)
q + C(q, q)
q + g(q) =
where D is the inertial matrix, C is the damping matrix, g(q) is the gravitational vector, and is the applied torque
vector.
The nonlinear equations of motion given in 1.2 and 1.3 can be placed into this matrix format.
1.3 Linearizing
Here is an example of how to linearize a two-variable nonlinear function called f (z). Variable z is defined
z = [z1 z2 ]
and f (z) is to be linearized about the operating point
z0 = [a b]
The linearized function is
(
flin = f (z0 ) +
f (z)
z1
(
(z1 a) +
z=z0
f (z)
z2
(z2 b)
z=z0
(1.6)
y = Cx + Du
(1.7)
and
where x is the state, u is the control input, A, B, C, and D are state-space matrices. For the rotary pendulum system,
the state and output are defined
x = [ ]
(1.8)
and
y = [x1 x2 ].
(1.9)
In the output equation, only the position of the servo and link angles are being measured. Based on this, the C and
D matrices in the output equation are
[
]
1 0 0 0
C=
(1.10)
0 1 0 0
and
[ ]
0
D=
.
0
(1.11)
The velocities of the servo and pendulum angles can be computed in the digital controller, e.g., by taking the derivative and filtering the result though a high-pass filter.
QUBE-SERVO INVERTED PENDULUM MODELING