The equations of motion of a manipulator can be written as:
M(q)q¨+q˙⊤C(q)q˙=τ+τg(q)where, denoting by n=dim(q) the degree of freedom of the robot,
- M(q) is the n×n inertia matrix,
- C(q) is the n×n×n Coriolis tensor,
- τ is the n-dimensional vector of actuated joint torques,
- τg(q) is the n-dimensional vector of gravity torques.
We will see in this post one way to compute the inertia matrix
M(q) with OpenRAVE.
Inverse dynamics with OpenRAVE
The matrices and tensors of the formula above can be computed by inverse
dynamics. For instance, in OpenRAVE one can use
Robot.ComputeInverseDynamics
to compute each of the three terms:
m:=M(q)q¨c:=q˙⊤C(q)q˙g:=−τg(q).By setting q¨ to the vector ei of the canonical basis of
Rn, one can then compute the ith line of
the inertia matrix M(q). This is known as the unit vector method,
which was proposed by Walker and Orin (1982). Here is a sample Python implementation:
def compute_inertia_matrix(robot, q, external_torque=None):
n = len(q)
M = zeros((n, n))
with robot:
robot.SetDOFValues(q)
for (i, e_i) in enumerate(eye(n)):
m, c, g = robot.ComputeInverseDynamics(
e_i, external_torque, returncomponents=True)
M[:, i] = m
return M
Note how there is no need to set the robot's velocity in the function above, as
ComputeInverseDynamics
computes separately the three terms m
,
c
and g
.
To go further
The unit vector method is not considered efficient any more, as it has now been
superseded by the composite rigid-body algorithm (CRBA) described in Chapter
6 of Roy Featherstone's Rigid Body Dynamics Algorithms. This algorithm is implemented in
most common rigid-body dynamics libraries such as RBDL, RigidBodyDynamics.jl and Pinocchio.
Discussion
Feel free to post a comment by e-mail using the form below. Your e-mail address will not be disclosed.