Gazebo: Q&A Forum - RSS feedhttp://answers.gazebosim.org/questions/Open source question and answer forum for GazeboenCopyright Askbot, 2010-2011.Thu, 18 Oct 2018 21:30:51 -0500Inertia matrices and double precision ODEhttp://answers.gazebosim.org/question/12327/inertia-matrices-and-double-precision-ode/ Hi All,
I have a problem with the precision of ODE.
The environment that I'm trying to use is:
- Ubuntu trusty
- ROS Indigo
- Gazebo 6
The model of my robot (about 0.4 metre tall) has links as small as this and mass of 0.025kg:
<geometry>
<box size="0.045 0.022 0.0325"/> // Units in metre
</geometry>
And this is the inertial element, with the real values, for the same link:
<inertial>
<pose frame=''>0 0 0 0 -0 0</pose>
<mass>0.0243577</mass>
<inertia>
<ixx>3.12641e-06</ixx>
<ixy>0</ixy>
<ixz>0</ixz>
<iyy>6.25435e-06</iyy>
<iyz>0</iyz>
<izz>5.09279e-06</izz>
</inertia>
</inertial>
So the problem that I have is that the moments of inertia are too small and the model becomes unstable.
I have tried scaling the values for the inertia matrix, but no the geometry, collisions, mass, etc. This had some reasonable behaviour with Gazebo 2.2, but with Gazebo 6 the inertial values are too big and the robot bounces with any slight movement.
I also was thinking in increasing the precision on ODE to double, but I haven't find any tutorial to do this.
I know that converting the measurement units to millimetres consistently across the model and ROS could fix the problem, but I'd prefer some more transparent solution rather than converting units back and forth and managing different units for the physical robot and the simulation.
Do you have any recommendation to deal with this?
**EDIT:**
After applying *debz* and *hsu* recommendations, I also realised that my joint controller was using incorrect method to control the joint position. With all the corrections the model works without problems.
Thanks,
GermánWed, 13 Jan 2016 00:14:03 -0600http://answers.gazebosim.org/question/12327/inertia-matrices-and-double-precision-ode/Answer by handingqiang for <p>Hi All,</p>
<p>I have a problem with the precision of ODE.</p>
<p>The environment that I'm trying to use is:</p>
<ul>
<li>Ubuntu trusty</li>
<li>ROS Indigo</li>
<li>Gazebo 6</li>
</ul>
<p>The model of my robot (about 0.4 metre tall) has links as small as this and mass of 0.025kg:</p>
<pre><code> <geometry>
<box size="0.045 0.022 0.0325"/> // Units in metre
</geometry>
</code></pre>
<p>And this is the inertial element, with the real values, for the same link:</p>
<pre><code> <inertial>
<pose frame=''>0 0 0 0 -0 0</pose>
<mass>0.0243577</mass>
<inertia>
<ixx>3.12641e-06</ixx>
<ixy>0</ixy>
<ixz>0</ixz>
<iyy>6.25435e-06</iyy>
<iyz>0</iyz>
<izz>5.09279e-06</izz>
</inertia>
</inertial>
</code></pre>
<p>So the problem that I have is that the moments of inertia are too small and the model becomes unstable.</p>
<p>I have tried scaling the values for the inertia matrix, but no the geometry, collisions, mass, etc. This had some reasonable behaviour with Gazebo 2.2, but with Gazebo 6 the inertial values are too big and the robot bounces with any slight movement.</p>
<p>I also was thinking in increasing the precision on ODE to double, but I haven't find any tutorial to do this.</p>
<p>I know that converting the measurement units to millimetres consistently across the model and ROS could fix the problem, but I'd prefer some more transparent solution rather than converting units back and forth and managing different units for the physical robot and the simulation.</p>
<p>Do you have any recommendation to deal with this?</p>
<p><strong>EDIT:</strong>
After applying <em>debz</em> and <em>hsu</em> recommendations, I also realised that my joint controller was using incorrect method to control the joint position. With all the corrections the model works without problems.</p>
<p>Thanks,
Germán</p>
http://answers.gazebosim.org/question/12327/inertia-matrices-and-double-precision-ode/?answer=20764#post-id-20764The problem also occurs on me , I wonder if you have solved it yet. Thanks!Thu, 18 Oct 2018 21:30:51 -0500http://answers.gazebosim.org/question/12327/inertia-matrices-and-double-precision-ode/?answer=20764#post-id-20764Answer by georgemacin for <p>Hi All,</p>
<p>I have a problem with the precision of ODE.</p>
<p>The environment that I'm trying to use is:</p>
<ul>
<li>Ubuntu trusty</li>
<li>ROS Indigo</li>
<li>Gazebo 6</li>
</ul>
<p>The model of my robot (about 0.4 metre tall) has links as small as this and mass of 0.025kg:</p>
<pre><code> <geometry>
<box size="0.045 0.022 0.0325"/> // Units in metre
</geometry>
</code></pre>
<p>And this is the inertial element, with the real values, for the same link:</p>
<pre><code> <inertial>
<pose frame=''>0 0 0 0 -0 0</pose>
<mass>0.0243577</mass>
<inertia>
<ixx>3.12641e-06</ixx>
<ixy>0</ixy>
<ixz>0</ixz>
<iyy>6.25435e-06</iyy>
<iyz>0</iyz>
<izz>5.09279e-06</izz>
</inertia>
</inertial>
</code></pre>
<p>So the problem that I have is that the moments of inertia are too small and the model becomes unstable.</p>
<p>I have tried scaling the values for the inertia matrix, but no the geometry, collisions, mass, etc. This had some reasonable behaviour with Gazebo 2.2, but with Gazebo 6 the inertial values are too big and the robot bounces with any slight movement.</p>
<p>I also was thinking in increasing the precision on ODE to double, but I haven't find any tutorial to do this.</p>
<p>I know that converting the measurement units to millimetres consistently across the model and ROS could fix the problem, but I'd prefer some more transparent solution rather than converting units back and forth and managing different units for the physical robot and the simulation.</p>
<p>Do you have any recommendation to deal with this?</p>
<p><strong>EDIT:</strong>
After applying <em>debz</em> and <em>hsu</em> recommendations, I also realised that my joint controller was using incorrect method to control the joint position. With all the corrections the model works without problems.</p>
<p>Thanks,
Germán</p>
http://answers.gazebosim.org/question/12327/inertia-matrices-and-double-precision-ode/?answer=15229#post-id-15229The decimal keyword denotes a 128-bit data type. Compared to floating-point types, the decimal type has a greater precision and a smaller range, which makes it suitable for financial and monetary calculations. Precision is the main difference where double is a double precision (64 bit) floating point data type and decimal is a 128-bit floating point data type.
Double - 64 bit (15-16 digits)
Decimal - 128 bit (28-29 significant digits)
So Decimals have much higher precision and are usually used within monetary (financial) applications that require a high degree of accuracy. But in performance wise Decimals are slower than double and float types. Double Types are probably the most normally used data type for real values, except handling money. In general, the double type is going to offer at least as great precision and definitely greater speed for arbitrary real numbers. More about...[Double vs Decimal](http://net-informations.com/q/faq/float.html)
GeorgeTue, 17 Jan 2017 01:01:30 -0600http://answers.gazebosim.org/question/12327/inertia-matrices-and-double-precision-ode/?answer=15229#post-id-15229Answer by debz for <p>Hi All,</p>
<p>I have a problem with the precision of ODE.</p>
<p>The environment that I'm trying to use is:</p>
<ul>
<li>Ubuntu trusty</li>
<li>ROS Indigo</li>
<li>Gazebo 6</li>
</ul>
<p>The model of my robot (about 0.4 metre tall) has links as small as this and mass of 0.025kg:</p>
<pre><code> <geometry>
<box size="0.045 0.022 0.0325"/> // Units in metre
</geometry>
</code></pre>
<p>And this is the inertial element, with the real values, for the same link:</p>
<pre><code> <inertial>
<pose frame=''>0 0 0 0 -0 0</pose>
<mass>0.0243577</mass>
<inertia>
<ixx>3.12641e-06</ixx>
<ixy>0</ixy>
<ixz>0</ixz>
<iyy>6.25435e-06</iyy>
<iyz>0</iyz>
<izz>5.09279e-06</izz>
</inertia>
</inertial>
</code></pre>
<p>So the problem that I have is that the moments of inertia are too small and the model becomes unstable.</p>
<p>I have tried scaling the values for the inertia matrix, but no the geometry, collisions, mass, etc. This had some reasonable behaviour with Gazebo 2.2, but with Gazebo 6 the inertial values are too big and the robot bounces with any slight movement.</p>
<p>I also was thinking in increasing the precision on ODE to double, but I haven't find any tutorial to do this.</p>
<p>I know that converting the measurement units to millimetres consistently across the model and ROS could fix the problem, but I'd prefer some more transparent solution rather than converting units back and forth and managing different units for the physical robot and the simulation.</p>
<p>Do you have any recommendation to deal with this?</p>
<p><strong>EDIT:</strong>
After applying <em>debz</em> and <em>hsu</em> recommendations, I also realised that my joint controller was using incorrect method to control the joint position. With all the corrections the model works without problems.</p>
<p>Thanks,
Germán</p>
http://answers.gazebosim.org/question/12327/inertia-matrices-and-double-precision-ode/?answer=12330#post-id-12330I think it is a recurrent problem. I faced the same instability with a recent project. What might happen is not that ODE can't handle small doubles variable as many previous topics suggest (inertial e-06 is quite OK). But the way your joints are defined might be the cause. If the inertials are small, then your links are easy to move. One link moves, disturb an other one through the joint that links them, and so on. This happens because your joints are too perfect, they transfer too much energy. At the end your robot shakes and can even explode.
I solved my case by playing with these parameters (not all of them are necessarily relevant). Increasing damping limits the mutual physical actions between your links. Increasing friction set up a lower limit for velocity before the joints actually transfer the energy coming from the action of one of the links.
<axis>
<xyz>0 0 1</xyz>
<dynamics>
<friction>friction</friction>
<damping>damping</damping>
</dynamics>
</axis>
<physics>
<ode>
<cfm_damping>cfm_damping</cfm_damping>
<implicit_spring_damper>implicit_spring</implicit_spring_damper>
</ode>
</physics>
I use these parameters (my damping is that hight because I use strong PID controllers on my joints. You'd better take a value between 0 and 1):
friction = 0.01
damping = 6
cfm_damping = 1
implicit_spring = 1
I hope this helps. Wed, 13 Jan 2016 07:17:57 -0600http://answers.gazebosim.org/question/12327/inertia-matrices-and-double-precision-ode/?answer=12330#post-id-12330Comment by gecastro for <p>I think it is a recurrent problem. I faced the same instability with a recent project. What might happen is not that ODE can't handle small doubles variable as many previous topics suggest (inertial e-06 is quite OK). But the way your joints are defined might be the cause. If the inertials are small, then your links are easy to move. One link moves, disturb an other one through the joint that links them, and so on. This happens because your joints are too perfect, they transfer too much energy. At the end your robot shakes and can even explode.
I solved my case by playing with these parameters (not all of them are necessarily relevant). Increasing damping limits the mutual physical actions between your links. Increasing friction set up a lower limit for velocity before the joints actually transfer the energy coming from the action of one of the links. </p>
<pre><code> <axis>
<xyz>0 0 1</xyz>
<dynamics>
<friction>friction</friction>
<damping>damping</damping>
</dynamics>
</axis>
<physics>
<ode>
<cfm_damping>cfm_damping</cfm_damping>
<implicit_spring_damper>implicit_spring</implicit_spring_damper>
</ode>
</physics>
</code></pre>
<p>I use these parameters (my damping is that hight because I use strong PID controllers on my joints. You'd better take a value between 0 and 1):</p>
<pre><code>friction = 0.01
damping = 6
cfm_damping = 1
implicit_spring = 1
</code></pre>
<p>I hope this helps. </p>
http://answers.gazebosim.org/question/12327/inertia-matrices-and-double-precision-ode/?comment=12345#post-id-12345Original values fit with the collision. But when using gazebo 2.2 I gave up and ended scaling them by 100, which even if it is wrong had acceptable stability/performance. Now, with gazebo 6, I'm trying to get rid of the scaling. MOIs are calculated using basic shapes (box, cylinder, sphere) from here https://en.wikipedia.org/wiki/List_of_moments_of_inertiaThu, 14 Jan 2016 16:59:12 -0600http://answers.gazebosim.org/question/12327/inertia-matrices-and-double-precision-ode/?comment=12345#post-id-12345Comment by debz for <p>I think it is a recurrent problem. I faced the same instability with a recent project. What might happen is not that ODE can't handle small doubles variable as many previous topics suggest (inertial e-06 is quite OK). But the way your joints are defined might be the cause. If the inertials are small, then your links are easy to move. One link moves, disturb an other one through the joint that links them, and so on. This happens because your joints are too perfect, they transfer too much energy. At the end your robot shakes and can even explode.
I solved my case by playing with these parameters (not all of them are necessarily relevant). Increasing damping limits the mutual physical actions between your links. Increasing friction set up a lower limit for velocity before the joints actually transfer the energy coming from the action of one of the links. </p>
<pre><code> <axis>
<xyz>0 0 1</xyz>
<dynamics>
<friction>friction</friction>
<damping>damping</damping>
</dynamics>
</axis>
<physics>
<ode>
<cfm_damping>cfm_damping</cfm_damping>
<implicit_spring_damper>implicit_spring</implicit_spring_damper>
</ode>
</physics>
</code></pre>
<p>I use these parameters (my damping is that hight because I use strong PID controllers on my joints. You'd better take a value between 0 and 1):</p>
<pre><code>friction = 0.01
damping = 6
cfm_damping = 1
implicit_spring = 1
</code></pre>
<p>I hope this helps. </p>
http://answers.gazebosim.org/question/12327/inertia-matrices-and-double-precision-ode/?comment=12340#post-id-12340The only small things I can suggest:
- verify your inertials (using the gazebo client, view->inertials). They should fit to the collision geometry of your links. If only one link hasn't right inertial, the entire robot gets shaky.
- I use the following parameters: max_step_size = 0.002, solver type = quick, sor = 1.4, constraints cfm = 0, erp = 1.Thu, 14 Jan 2016 11:35:49 -0600http://answers.gazebosim.org/question/12327/inertia-matrices-and-double-precision-ode/?comment=12340#post-id-12340Comment by gecastro for <p>I think it is a recurrent problem. I faced the same instability with a recent project. What might happen is not that ODE can't handle small doubles variable as many previous topics suggest (inertial e-06 is quite OK). But the way your joints are defined might be the cause. If the inertials are small, then your links are easy to move. One link moves, disturb an other one through the joint that links them, and so on. This happens because your joints are too perfect, they transfer too much energy. At the end your robot shakes and can even explode.
I solved my case by playing with these parameters (not all of them are necessarily relevant). Increasing damping limits the mutual physical actions between your links. Increasing friction set up a lower limit for velocity before the joints actually transfer the energy coming from the action of one of the links. </p>
<pre><code> <axis>
<xyz>0 0 1</xyz>
<dynamics>
<friction>friction</friction>
<damping>damping</damping>
</dynamics>
</axis>
<physics>
<ode>
<cfm_damping>cfm_damping</cfm_damping>
<implicit_spring_damper>implicit_spring</implicit_spring_damper>
</ode>
</physics>
</code></pre>
<p>I use these parameters (my damping is that hight because I use strong PID controllers on my joints. You'd better take a value between 0 and 1):</p>
<pre><code>friction = 0.01
damping = 6
cfm_damping = 1
implicit_spring = 1
</code></pre>
<p>I hope this helps. </p>
http://answers.gazebosim.org/question/12327/inertia-matrices-and-double-precision-ode/?comment=12334#post-id-12334Some of those values help a bit, specially when applied to the world, not just to the joint.
But I still can't get a stable model. I'm trying to model some Dynamixel servos, but given the size (small moments of inertia) and torque (<limit effort="2.5" velocity="5.6548668"/>), gazebo doesn't like it...
The parameter that seems to work the best is reducing max_step_size between 0.0001-0.00001, but still get some jitter in the joints.Thu, 14 Jan 2016 01:08:02 -0600http://answers.gazebosim.org/question/12327/inertia-matrices-and-double-precision-ode/?comment=12334#post-id-12334Answer by hsu for <p>Hi All,</p>
<p>I have a problem with the precision of ODE.</p>
<p>The environment that I'm trying to use is:</p>
<ul>
<li>Ubuntu trusty</li>
<li>ROS Indigo</li>
<li>Gazebo 6</li>
</ul>
<p>The model of my robot (about 0.4 metre tall) has links as small as this and mass of 0.025kg:</p>
<pre><code> <geometry>
<box size="0.045 0.022 0.0325"/> // Units in metre
</geometry>
</code></pre>
<p>And this is the inertial element, with the real values, for the same link:</p>
<pre><code> <inertial>
<pose frame=''>0 0 0 0 -0 0</pose>
<mass>0.0243577</mass>
<inertia>
<ixx>3.12641e-06</ixx>
<ixy>0</ixy>
<ixz>0</ixz>
<iyy>6.25435e-06</iyy>
<iyz>0</iyz>
<izz>5.09279e-06</izz>
</inertia>
</inertial>
</code></pre>
<p>So the problem that I have is that the moments of inertia are too small and the model becomes unstable.</p>
<p>I have tried scaling the values for the inertia matrix, but no the geometry, collisions, mass, etc. This had some reasonable behaviour with Gazebo 2.2, but with Gazebo 6 the inertial values are too big and the robot bounces with any slight movement.</p>
<p>I also was thinking in increasing the precision on ODE to double, but I haven't find any tutorial to do this.</p>
<p>I know that converting the measurement units to millimetres consistently across the model and ROS could fix the problem, but I'd prefer some more transparent solution rather than converting units back and forth and managing different units for the physical robot and the simulation.</p>
<p>Do you have any recommendation to deal with this?</p>
<p><strong>EDIT:</strong>
After applying <em>debz</em> and <em>hsu</em> recommendations, I also realised that my joint controller was using incorrect method to control the joint position. With all the corrections the model works without problems.</p>
<p>Thanks,
Germán</p>
http://answers.gazebosim.org/question/12327/inertia-matrices-and-double-precision-ode/?answer=12341#post-id-12341As debz said, 1e-6 kg m^2 should be fine for inertia values specified in doubles. In addition to the damping tip from debz, the instability also has to do with inertia ratio across joint constraints than the actual magnitude of the inertia. The instability can occur if the link is connected to another link with moment of inertia of 2+ orders of magnitude difference (for example moi in the same constrained direction that is >1e-4 or <1e-8 kg m^2). If this is the case, more inner iterations are needed if you are using the default solver.Thu, 14 Jan 2016 12:06:19 -0600http://answers.gazebosim.org/question/12327/inertia-matrices-and-double-precision-ode/?answer=12341#post-id-12341Comment by hsu for <p>As debz said, 1e-6 kg m^2 should be fine for inertia values specified in doubles. In addition to the damping tip from debz, the instability also has to do with inertia ratio across joint constraints than the actual magnitude of the inertia. The instability can occur if the link is connected to another link with moment of inertia of 2+ orders of magnitude difference (for example moi in the same constrained direction that is >1e-4 or <1e-8 kg m^2). If this is the case, more inner iterations are needed if you are using the default solver.</p>
http://answers.gazebosim.org/question/12327/inertia-matrices-and-double-precision-ode/?comment=12350#post-id-12350ODE in gazebo has been compile with double precision for some time e.g. (default / v1.2) :) https://bitbucket.org/osrf/gazebo/src/78ad6dd8ac7d857bdeebf8ce05857c5400fcaf8f/deps/opende/CMakeLists.txt?at=default&fileviewer=file-view-default#CMakeLists.txt-262 and https://bitbucket.org/osrf/gazebo/src/gazebo_1.2/deps/opende/CMakeLists.txt?fileviewer=file-view-default#CMakeLists.txt-237Fri, 15 Jan 2016 00:08:58 -0600http://answers.gazebosim.org/question/12327/inertia-matrices-and-double-precision-ode/?comment=12350#post-id-12350Comment by gecastro for <p>As debz said, 1e-6 kg m^2 should be fine for inertia values specified in doubles. In addition to the damping tip from debz, the instability also has to do with inertia ratio across joint constraints than the actual magnitude of the inertia. The instability can occur if the link is connected to another link with moment of inertia of 2+ orders of magnitude difference (for example moi in the same constrained direction that is >1e-4 or <1e-8 kg m^2). If this is the case, more inner iterations are needed if you are using the default solver.</p>
http://answers.gazebosim.org/question/12327/inertia-matrices-and-double-precision-ode/?comment=12347#post-id-12347Is this with the default build packages from osrfoundation? I haven't do anything yet to change the precision of ODE. I understand that for previous releases ODE is set to single precision (float), not sure if this is still the case.Thu, 14 Jan 2016 17:21:40 -0600http://answers.gazebosim.org/question/12327/inertia-matrices-and-double-precision-ode/?comment=12347#post-id-12347Comment by gecastro for <p>As debz said, 1e-6 kg m^2 should be fine for inertia values specified in doubles. In addition to the damping tip from debz, the instability also has to do with inertia ratio across joint constraints than the actual magnitude of the inertia. The instability can occur if the link is connected to another link with moment of inertia of 2+ orders of magnitude difference (for example moi in the same constrained direction that is >1e-4 or <1e-8 kg m^2). If this is the case, more inner iterations are needed if you are using the default solver.</p>
http://answers.gazebosim.org/question/12327/inertia-matrices-and-double-precision-ode/?comment=12346#post-id-12346I'll check this, there is definitely a difference of order 1e3 or 1e4 between some links. The base link is: <box size="0.102 0.109 0.106"/><mass value="0.97559947"/><inertia ixx="0.00187941032723" ixy="0.0" ixz="0.0" iyy="0.0017593303405" iyz="0.0" izz="0.00181176879104"/>. While a child links is: <box size="0.045 0.022 0.0325"/><mass value="0.024357719"/><inertia ixx="3.12641347358e-06" ixy="0.0" ixz="0.0" iyy="6.25434930399e-06" iyz="0.0" izz="5.0927910438e-06"/>Thu, 14 Jan 2016 17:15:31 -0600http://answers.gazebosim.org/question/12327/inertia-matrices-and-double-precision-ode/?comment=12346#post-id-12346