Revision history [back]

I agree 100% with Adolfo's answer, especially that the identity matrix is a particularly bad choice. That tutorial really should be fixed. Some things to add:

You must give links an inertia matrix in the URDF, otherwise they (and their child links) won't be simulated.

It's important to give links an inertia matrix that is at least close to the correct order of magnitude. Otherwise, the simulation will be highly unrealistic. Imagine you used the identity matrix for the "head" link of your robot. This tells the simulation that the head has about the inertia of a large arm chair. So if you drive around in simulation and suddenly stop, your robot will (naturally) topple over.

If you use geometric primitives (box, cylinder, sphere) to model a link, and you assume equal distribution of mass, you can use wikipedia's list of moment of inertia tensors to compute the correct matrix. I've created a couple of xacro macros that do this automatically: common.xacro.

If you use CAD models to model a link, you can use Meshlab to compute the inertia tensor:

• View -> Show Layer Dialog
• Filters -> Quality Measures and Computations -> Compute Geometric Measures

Unfortunately, this usually gives a matrix that is rounded to all zeroes, so you might have to scale up your model, compute the inertia tensor, and divide the result by the appropriate factor.

I agree 100% with Adolfo's answer, especially that the identity matrix is a particularly bad choice. That tutorial really should be fixed. Some things to add:

You must give links an inertia matrix in the URDF, otherwise they (and their child links) won't be simulated.

It's important to give links an inertia matrix that is at least close to the correct order of magnitude. Otherwise, the simulation will be highly unrealistic. Imagine you used the identity matrix for the "head" link of your robot. This tells the simulation that the head has about the inertia of a large arm chair. So if you drive around in simulation and suddenly stop, your robot will (naturally) topple over.

If you use geometric primitives (box, cylinder, sphere) to model a link, and you assume equal distribution of mass, you can use wikipedia's list of moment of inertia tensors to compute the correct matrix. I've created a couple of xacro macros that do this automatically: common.xacro.

If you use CAD models to model a link, you can use Meshlab to compute the inertia tensor:tensor (again, assuming equal distribution of mass):

• View -> Show Layer Dialog
• Filters -> Quality Measures and Computations -> Compute Geometric Measures

Unfortunately, this usually gives a matrix that is rounded to all zeroes, so you might have to scale up your model, compute the inertia tensor, and divide the result by the an appropriate factor.