# inertia

## inertia

Compute inertia matrix in robot dynamics

### Syntax

• M = inertia(robot, q)

### Input Arguments

• q — 1 x n joint position

### Output Arguments

• M — n x n joint inertia matrix

### Description

M = inertia(robot, q) computes an n x n symmatric joint inertia matrix relating joint torque to joint acceleration of the robot at joint configuration q. The diagonal elements M(i,i) are inertias seen by joint actuator i, including motor inertias reflected through the gear ratios. The off-diagonal element M(i, j) are coupling inertias relating acceleration on joint i to force/torque on joint j.

### Examples

```-->exec('./models/mdl_puma560.sce',-1); -->M = inertia(p560, q_n) M = 3.6593754 - 0.4043612 0.1006136 - 0.0025170 0. 0. - 0.4043612 4.4137419 0.3508907 0. 0.0023595 0. 0.1006136 0.3508907 0.9378416 0. 0.0014802 0. - 0.0025170 0. 0. 0.1925317 0. 0.0000283 0. 0.0023595 0.0014802 0. 0.1713485 0. 0. 0. 0. 0.0000283 0. 0.1941045```

The following code plots the figures below (Corke, p 195). You may have to wait quite a while!

```stepsize = 0.1; [Q2,Q3] = meshgrid(-pi:stepsize:pi, -pi:stepsize:pi); nloops = numcols(Q2)*numcols(Q3); g2 = _zeros(size(Q2)); g3 = _zeros(size(Q3)); for i=1:numcols(Q2), for j=1:numcols(Q3), M = inertia(p560,[0 Q2(i,j) Q3(i,j) 0 0 0]); M11(i,j) = M(1,1); M12(i,j) = M(1,2); end end figure; surf(Q2, Q3, M11); figure; surf(Q2, Q3, M12);```

Variation of inertia matrix elements as a function of manipulator pose

(a) Joint 1 inertia as a function of joint 2 and 3 angles M11(q2, q3)

(b) Product of inertia M12(q2, q3)