flexible-collision-library / fcl

Flexible Collision Library
https://flexible-collision-library.github.io/
Other
1.35k stars 415 forks source link

Units for CollisionGeometry<>::computeMomentofInertia #595

Closed Afrobeat closed 1 year ago

Afrobeat commented 1 year ago

Hello,

I couldn't find this anywhere in the documentation. But what's the unit for the Inertia Values that are returned by fcl::BVHModel< BV >::computeMomentofInertia? I know that the results from computeVolume() and computeCOM() are depending on the units used inside the Mesh. E.g. having an obj file that uses Milimeter, the Volume and position of Center of Mass will be in Milimeter if I'm not mistaken. Since Inertia values are usually a combination of a weight and a surface e.g. kgm^2 or kgmm^2. I'm not sure what unit to assume for the weight part.

Is there a weight unit for the computeMomentofInertia method? Or do I have to multiply the result with weight or density value to actually retrieve a unit like kg*m^2?

I would be very happy about any help.

SeanCurtis-TRI commented 1 year ago

Generically, the units of each entry are ML² (masslengthlength). The value reported is for a mesh with a total unit mass (in whatever mass units you have).

If you're using MKS, it would be kg⋅m².

Some further notes:

  1. If your mesh was defined in centimeters (common enough in many modelling packages) but you want to do your simulating in MKS, the simplest thing to do is simply scale the measures of the vertex positions prior to instantiating the BVHModel (possibly when instantiating, or possibly when exporting your mesh). Then you get the right units right out of the gate. Otherwise, you can use resource like this to figure out what your conversion factor is (alternatively, just don't forget the conversion has to incorporate the square of the relationship between your mesh units and your desired units).
  2. Because the value represents the tensor for an object with a total mass of 1 unit, you can adapt it to arbitrary mass by simply multiplying by the known non-unit mass.
    • Obviously, you can use computeVolume() * some known density to figure out what that mass would be if you don't already have a total mass in mind.
  3. Be aware that the algorithm for computing all of these mass properties assumes your mesh is water tight. The validity can be degraded by cracks in the mesh. In the most adversarial cases, the error can be unbounded.