Gazebo | Ignition | Community
Ask Your Question

The inertia matrix explained

asked 2013-09-17 17:04:04 -0500

Arn-O gravatar image


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 flag offensive close merge delete

3 Answers

Sort by » oldest newest most voted

answered 2013-09-18 02:50:21 -0500

Adolfo Rodríguez T gravatar image

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.

edit flag offensive delete link 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.

hsu gravatar imagehsu ( 2013-09-18 12:26:30 -0500 )edit

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

Arn-O gravatar imageArn-O ( 2013-09-18 14:06:36 -0500 )edit

Martin already updated it. The link is in the original question.

Adolfo Rodríguez T gravatar imageAdolfo Rodríguez T ( 2013-09-19 04:04:16 -0500 )edit

answered 2013-09-18 03:38:29 -0500

updated 2013-09-18 03:39:42 -0500

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.

edit flag offensive delete link more


I've updated the tutorial.

Martin Günther gravatar imageMartin Günther ( 2013-09-18 04:08:50 -0500 )edit

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

Adolfo Rodríguez T gravatar imageAdolfo Rodríguez T ( 2013-09-18 04:25:51 -0500 )edit

Thank you for this useful information about the inertia tensor.

Arn-O gravatar imageArn-O ( 2013-09-18 14:07:45 -0500 )edit

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?

Markus Bader gravatar imageMarkus Bader ( 2014-03-31 04:11:18 -0500 )edit

answered 2014-08-29 04:52:33 -0500

peci1 gravatar image

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.

edit flag offensive delete link more


Hi, thanks for the step-by-step tutorial, it has been very helpful. I just have one question regarding the inertia tensor - considering its SI unit is kg.m^2, I wondering if I also have to multiply the produced inertia tensor by twice the ratio of meshlab units to meters (similar to what is done to calculate the center of mass in the previous step)? This would be in addition to multiplying the inertia tensor by 1/s^2 (where s is the reciprocal of the scale used for upscaling)

culletom gravatar imageculletom ( 2015-02-02 13:44:35 -0500 )edit

Question Tools

1 follower


Asked: 2013-09-17 17:04:04 -0500

Seen: 27,695 times

Last updated: Aug 29 '14