robotology / idyntree

Multibody Dynamics Library designed for Free Floating Robots
BSD 3-Clause "New" or "Revised" License
155 stars 65 forks source link

Automatically compute inertial parameters from link shapes #462

Open traversaro opened 6 years ago

traversaro commented 6 years ago

Inertial parameters (mass, center of masses and inertia matrices) of rigid bodies are a fundamental quantity in model-based control and simulation of robots that can be considered as composed by rigid bodies.

These parameters are typically obtained from CAD models of the robot used for designing and manufacturing the robot (see for example http://wiki.icub.org/wiki/Creo_Mechanism_to_URDF) or identified from sensor measurements on the robot.

However in practice a good-enough method to obtain inertial parameters, if the total mass of the robot is known and some meshes of its links are available, is to assume that the robot has constant density and compute the inertial parameters as a consequence of this (more details will arrive).

traversaro commented 6 years ago

I imagine three main use cases:

In the third case, I do not think there is an easy way to use the center of mass information position to aid the 3D inertia computation, but a nice debug check would be compare the center of mass position computed from shapes + uniform density assumption and the "known" one.

traversaro commented 6 years ago

For the actual implementation, the computation necessary for compute the center of mass and 3D inertia of basic shapes (at this moment: Sphere, Box, Cylinder) are just the basic formulas that you can find in any mechanics textbook (see https://en.wikipedia.org/wiki/List_of_moments_of_inertia#List_of_3D_inertia_tensors for an informal reference).

Regarding meshes, the issue is more complicated. We currently do not support reading meshes in memory (we just supported saving their filesystem location as part of the ExternalMesh class, that was used for the visualizer). Support for that can be added using assimp. Once the meshes are loaded in memory, it should be possible to use the Mirtich's algorithm to compute the inertial parameters of the mesh (note: the C implementation is released as public domain). Note that this is the same algorithm implemented in MeshLab, a tool that is typically used for doing this kind of computation offline ( http://gazebosim.org/tutorials?tut=inertia ).

traversaro commented 4 years ago

A preliminary version of what was proposed in this issue was introduced in https://github.com/robotology/idyntree/pull/580 , even at the moment we only support computing the inertial parameters assuming that the geometry of the link is the axis aligned bounding box of the actual shape.

traversaro commented 4 years ago

Related SDFormat issue: https://bitbucket.org/osrf/sdformat/issues/176/allow-a-subset-of-instead-of .

traversaro commented 4 years ago

Mirtich's algorithm

Paper reference: Brian Mirtich, "Fast and Accurate Computation of Polyhedral Mass Properties," journal of graphics tools, volume 1, number 2, 1996.

traversaro commented 4 years ago

Related Drake issue: https://github.com/RobotLocomotion/drake/issues/13033 .

traversaro commented 3 years ago

Related script by @AndrejOrsula: https://github.com/AndrejOrsula/panda_ign/blob/master/scripts/estimate_inertial_properties.py

traversaro commented 2 years ago

Realted script: https://github.com/vonunwerth/MeshLabInertiaToURDF/blob/master/main.py .