andytgl
Posts: 3
Joined: Thu Jul 08, 2021 5:54 pm

When trying load an URDF via

Code: Select all

``loadURDF()``
with flag

Code: Select all

``URDF_USE_INERTIA_FROM_FILE``
I have noticed that pybullet will set the inertia to zero if the sum of the inertia on two principal components of the inertia tensor is smaller than the third remaining (for example if i_xx + i_yy < i_zz), throwing the error message
This is caused by the following lines https://github.com/bulletphysics/bullet ... r.cpp#L460.
My questions are:
• Why these checks are in place?
• How can I avoid this check, and correctly load the inertia specified in the URDF?
I have also noticed that if we let pybullet compute the inertia from the geometric properties speified in an URDF (by not setting the URDF_USE_INERTIA_FROM_FILE flag), the obtained inertia may not respect the property that is being enforced by loadURDF()

Thanks!
drleviathan
Posts: 733
Joined: Tue Sep 30, 2014 6:03 pm
Location: San Francisco

### Re: Bad inertia tensor properties, setting inertia to zero for link

I believe those are correct sanity checks for the inertia tensor eigen values: it is impossible for one value to exceed the sum of the other two. After a half hearted search online I couldn't find a mention or proof of that theorem however I offer my own partial proof:

Consider the simplest possible configuration: a point mass M at some vector R. The inertia tensor coefficient about each principal axis is given by I = M * r^2 where r is the perpendicular distance between the mass and the axis. Specifically they are:

Ix = M * (Ry^2 + Rz^2)
Iy = M * (Rz^2 + Rx^2)
Iz = M * (Ry^2 + Rx^2)

Let us assume that for some R it is possible for Ix > Iy + Iz:

M * (Ry^2 + Rz^2) > M * (Rz^2 + Rx^2 + Ry^2 + Rx^2)

Divide both sides by M:

Ry^2 + Rz^2 > Rz^2 + Ry^2 + 2 * Rx^2

Subtract (Ry^2 + Rz^2) from both sides:

0 > 2 * Rx^2

This final statement is impossible for all possible values of Rx. Therefore we must conclude that our assumption above is false for all values of R. In other words: it must be true:

Ii <= Ij + Ik

For the various convolutions of xyz = ijk.

I've proved it is true for a point mass. The inertia tensor of a real object with non-zero volume is the integral of its point masses. I posit but do not prove here (I'm not actually a mathematician): it can be proved that the integral of point elements that obey the property: Ii <= Ij + Ik must also obey that property.

In short: the inertia tensor in your URDF is wrong. You will have to recompute it.