Gazebo: Q&A Forum - RSS feedhttp://answers.gazebosim.org/questions/Open source question and answer forum for GazeboenCopyright Askbot, 2010-2011.Tue, 11 Oct 2022 18:50:02 -0500A link has invalid inertiahttp://answers.gazebosim.org/question/27489/a-link-has-invalid-inertia/What (and where) are the constraints that are checked when loading a model to decide if a link's inertia matrix is valid or not?
In my specific example, I am trying to model a 50 kg cylinder that is 1.5 m long with a 0.2 m radius. According to this [online moment of inertia calculator](https://amesweb.info/inertia/mass-moment-of-inertia-cylinder.aspx), I come up with Ixx=10, Iyy=10, Izz=1, which loads and runs fine. However, when I slightly change Ixx and Iyy to model a somewhat squashed (elliptical) cylinder, I receive the following error.
`[Err] [Server.cc:183] Error Code 18: Msg: A link named hull has invalid inertia.`
The snipped from my .sdf file is below.
<inertial>
<mass>50.24</mass>
<inertia>
<ixx>12.0</ixx>
<ixy>0</ixy>
<ixz>0</ixz>
<iyy>8.0</iyy>
<iyz>0</iyz>
<izz>1.0</izz>
</inertia>
</inertial>Tue, 19 Oct 2021 15:31:25 -0500http://answers.gazebosim.org/question/27489/a-link-has-invalid-inertia/Answer by MoffKalast for <p>What (and where) are the constraints that are checked when loading a model to decide if a link's inertia matrix is valid or not?</p>
<p>In my specific example, I am trying to model a 50 kg cylinder that is 1.5 m long with a 0.2 m radius. According to this <a href="https://amesweb.info/inertia/mass-moment-of-inertia-cylinder.aspx">online moment of inertia calculator</a>, I come up with Ixx=10, Iyy=10, Izz=1, which loads and runs fine. However, when I slightly change Ixx and Iyy to model a somewhat squashed (elliptical) cylinder, I receive the following error.</p>
<p><code>[Err] [Server.cc:183] Error Code 18: Msg: A link named hull has invalid inertia.</code></p>
<p>The snipped from my .sdf file is below.</p>
<pre><code> <inertial>
<mass>50.24</mass>
<inertia>
<ixx>12.0</ixx>
<ixy>0</ixy>
<ixz>0</ixz>
<iyy>8.0</iyy>
<iyz>0</iyz>
<izz>1.0</izz>
</inertia>
</inertial>
</code></pre>
http://answers.gazebosim.org/question/27489/a-link-has-invalid-inertia/?answer=28479#post-id-28479Those calculators don't seem to be correct, or at least they don't give the type of values that Gazebo expects.
What seems to work better is this, as found in some demos (for a bounding box):
> ixx = mass *(y*y+z*z)/12
> iyy = mass *(x*x+z*z)/12
> izz = mass *(x*x+y*y)/12Sat, 01 Oct 2022 15:39:12 -0500http://answers.gazebosim.org/question/27489/a-link-has-invalid-inertia/?answer=28479#post-id-28479Comment by azeey for <p>Those calculators don't seem to be correct, or at least they don't give the type of values that Gazebo expects.</p>
<p>What seems to work better is this, as found in some demos (for a bounding box):</p>
<blockquote>
<pre><code>ixx = mass *(y*y+z*z)/12
iyy = mass *(x*x+z*z)/12
izz = mass *(x*x+y*y)/12
</code></pre>
</blockquote>
http://answers.gazebosim.org/question/27489/a-link-has-invalid-inertia/?comment=28506#post-id-28506> So according to that list, the inertia values depend heavily upon the pivot point of the object?
In our case, we only need the moment of inertia about the center of mass. The physics engine will calculate the MOI about other axes if it needs to.Tue, 11 Oct 2022 18:50:02 -0500http://answers.gazebosim.org/question/27489/a-link-has-invalid-inertia/?comment=28506#post-id-28506Comment by MoffKalast for <p>Those calculators don't seem to be correct, or at least they don't give the type of values that Gazebo expects.</p>
<p>What seems to work better is this, as found in some demos (for a bounding box):</p>
<blockquote>
<pre><code>ixx = mass *(y*y+z*z)/12
iyy = mass *(x*x+z*z)/12
izz = mass *(x*x+y*y)/12
</code></pre>
</blockquote>
http://answers.gazebosim.org/question/27489/a-link-has-invalid-inertia/?comment=28492#post-id-28492Looking a bit futher, apparently the real intended way to generate these values is through meshlab... https://classic.gazebosim.org/tutorials?cat=build_robot&tut=inertiaThu, 06 Oct 2022 17:13:34 -0500http://answers.gazebosim.org/question/27489/a-link-has-invalid-inertia/?comment=28492#post-id-28492Comment by MoffKalast for <p>Those calculators don't seem to be correct, or at least they don't give the type of values that Gazebo expects.</p>
<p>What seems to work better is this, as found in some demos (for a bounding box):</p>
<blockquote>
<pre><code>ixx = mass *(y*y+z*z)/12
iyy = mass *(x*x+z*z)/12
izz = mass *(x*x+y*y)/12
</code></pre>
</blockquote>
http://answers.gazebosim.org/question/27489/a-link-has-invalid-inertia/?comment=28491#post-id-28491Ah yeah my bad, seems like I made an error when copying. Edited.
So according to that list, the inertia values depend heavily upon the pivot point of the object? That seems a bit odd, since the object itself doesn't exactly physically change when the pivot does and I would expect the sim to take account of the pivot movement internally when it changes depending on obstacles. Are we supposed to calculate for the joint origin or the center of mass?Thu, 06 Oct 2022 15:13:30 -0500http://answers.gazebosim.org/question/27489/a-link-has-invalid-inertia/?comment=28491#post-id-28491Comment by azeey for <p>Those calculators don't seem to be correct, or at least they don't give the type of values that Gazebo expects.</p>
<p>What seems to work better is this, as found in some demos (for a bounding box):</p>
<blockquote>
<pre><code>ixx = mass *(y*y+z*z)/12
iyy = mass *(x*x+z*z)/12
izz = mass *(x*x+y*y)/12
</code></pre>
</blockquote>
http://answers.gazebosim.org/question/27489/a-link-has-invalid-inertia/?comment=28481#post-id-28481This calculation is only correct for a cuboid. Other geometries have different formulae. See https://en.wikipedia.org/wiki/List_of_moments_of_inertia
Also `izz` should be `mass * (x*x + y*y)/12`Mon, 03 Oct 2022 11:56:16 -0500http://answers.gazebosim.org/question/27489/a-link-has-invalid-inertia/?comment=28481#post-id-28481Answer by azeey for <p>What (and where) are the constraints that are checked when loading a model to decide if a link's inertia matrix is valid or not?</p>
<p>In my specific example, I am trying to model a 50 kg cylinder that is 1.5 m long with a 0.2 m radius. According to this <a href="https://amesweb.info/inertia/mass-moment-of-inertia-cylinder.aspx">online moment of inertia calculator</a>, I come up with Ixx=10, Iyy=10, Izz=1, which loads and runs fine. However, when I slightly change Ixx and Iyy to model a somewhat squashed (elliptical) cylinder, I receive the following error.</p>
<p><code>[Err] [Server.cc:183] Error Code 18: Msg: A link named hull has invalid inertia.</code></p>
<p>The snipped from my .sdf file is below.</p>
<pre><code> <inertial>
<mass>50.24</mass>
<inertia>
<ixx>12.0</ixx>
<ixy>0</ixy>
<ixz>0</ixz>
<iyy>8.0</iyy>
<iyz>0</iyz>
<izz>1.0</izz>
</inertia>
</inertial>
</code></pre>
http://answers.gazebosim.org/question/27489/a-link-has-invalid-inertia/?answer=27569#post-id-27569The principal moments of the inertia must satisfy the [triangle inequality](https://physics.stackexchange.com/questions/48266/can-any-physical-rigid-body-be-represented-by-an-ellipsoid-with-the-same-angular/48273#48273). In your case ` iyy + izz < ixx`, which is invalid. Thu, 11 Nov 2021 23:34:36 -0600http://answers.gazebosim.org/question/27489/a-link-has-invalid-inertia/?answer=27569#post-id-27569