# The inertia matrix explained Hello.

I'd like to find some documentation about the inertia matrix in Gazebo/ROS (this topic is located in between).

Here is the ROS wiki page:

Basically, what I do not understand, is that the inertia matrix could not be independent from the mass. How a discrepancy between a dummy inertia matrix and the real inertia matrix could impact the simulation?

Thanks in advance for any doc that could help me to understand this part of the robot models.

edit retag close merge delete

Sort by » oldest newest most voted The inertia tensor encodes the mass distribution of a body, so it does depend on the mass, but also on where it is located.

The URDF tutorial you point to states that

"If unsure what to put, the identity matrix is a good default."

I highly disagree with this statement, as there is no one-size-fits-all inertia. In fact, this value will probably be too large for most links used in human-sized robots (or smaller). In my experience, heavier mobile base links (in the 50kg-100kg range) have inertias that fall within this order of magnitude, but almost all other smaller links (belonging to arms, legs, heads) have inertias that are between two and five orders of magnitude smaller.

That being said, this statement is only saying that for a given mass, you're assuming a fictitious mass distribution the yields the identity. Although it may seem unrealistic, it is possible to distribute mass so that a desired matrix results.

more

Adolfo, can you point me to the tutorial (or feel free to update it)? I think more appropriately it should say: "...the identity matrix is unrealistic but a good default for stable dynamics especially when using LCP solvers such as ODE or Bullet.". Thanks.

Thanks for your answer. I've been confused by the way the tutorial was written.

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 (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 an appropriate factor.

more

Very well written. I hope this clarifies the confusion in the tutorial.

Thank you for this useful information about the inertia tensor.

Thanks for that xacos, nice work. But I have a question, because you have two versions with and without origin. The without version has the orgion at <0 0 0> does this mean the centre of mass is not at the centre? e.g. If I like to use your macros for a box with the centre in the centre of the object. So I have to use the boxinertialwith_origin with the origin at (x y z)/2?

I've created a tutorial explaining step-by-step how to estimate the inertia matrix of your robot from 3D models using Meshlab.

It is based on the same ideas @Martin Günther has in the end of his answer.

more