Closed giotherobot closed 5 months ago
I guess the most interesting one are the one in the finger. The header is almost a ball, so its principal axis are indeed quite sensitive to small mass distribution discrepancies. Instead, the one in the fingers seems to be actually wrong.
As mentioned by @giotherobot, probably there is something wrong either in creo --> iDynTree::Model conversion contained in https://github.com/icub-tech-iit/creo2urdf, or in the iDynTree:Model --> URDF conversion contained in https://github.com/robotology/idyntree/blob/master/src/model_io/codecs/src/URDFModelExport.cpp .
iDynTree:Model --> URDF conversion contained in https://github.com/robotology/idyntree/blob/master/src/model_io/codecs/src/URDFModelExport.cpp .
Looking into this, I guess the probability of those being wrong seems low, mainly as the orientation of the inertia is hardcoded to the identity in https://github.com/robotology/idyntree/blob/master/src/model_io/codecs/src/URDFModelExport.cpp#L89, as in iDynTree the inertia is always oriented like the link frame.
Looking at creo2urdf, the relevant code is:
In particular, it seems that the mass_prop->GetGravityCenter()
returns the COM expressed w.r.t. to root link of the model, and that is handled in https://github.com/icub-tech-iit/creo2urdf/blob/e4419a69217f384bb793fa6ae11c84009ac17723/src/creo2urdf/src/Creo2Urdf.cpp#L393 . However, for the same reason perhaps the inertia is expressed with the orientation of the root link? If that is the case, the inertia should be rotated to be expressed in the link frame before being passed to iDynTree's fromRotationalInertiaWrtCenterOfMass
method, and that is currently not done.
Looking at creo2urdf, the relevant code is:
* https://github.com/icub-tech-iit/creo2urdf/blob/e4419a69217f384bb793fa6ae11c84009ac17723/src/creo2urdf/src/Creo2Urdf.cpp#L150 * https://github.com/icub-tech-iit/creo2urdf/blob/e4419a69217f384bb793fa6ae11c84009ac17723/src/creo2urdf/src/Creo2Urdf.cpp#L375-L402
In particular, it seems that the
mass_prop->GetGravityCenter()
returns the COM expressed w.r.t. to root link of the model, and that is handled in https://github.com/icub-tech-iit/creo2urdf/blob/e4419a69217f384bb793fa6ae11c84009ac17723/src/creo2urdf/src/Creo2Urdf.cpp#L393 . However, for the same reason perhaps the inertia is expressed with the orientation of the root link? If that is the case, the inertia should be rotated to be expressed in the link frame before being passed to iDynTree'sfromRotationalInertiaWrtCenterOfMass
method, and that is currently not done.
To clarify what I was suggesting, I wrote it down the fix I have in mind in https://github.com/icub-tech-iit/creo2urdf/pull/83 .
Hi @Nicogene @traversaro and @giotherobot, I also checked the legs and the problem seems to be also there
While trying to import the model in mujoco I discovered a problem in the inertia orientation of the ergoCubSN001 model.
Then with @traversaro we checked also in Gazebo the original model without modification and indeed the inertias have an incorrect orientation wrt the links:
This might be a problem of the creo to urdf conversion?