ROS Resources: Documentation | Support | Discussion Forum | Index | Service Status | Q&A answers.ros.org

# Calculating inertia for a vehicle robot

I'm trying to set the inertia for this Ackermann vehicle robot. I'm trying to model the GEM e2 https://gem.polaris.com/en-us/e2/specs/

I'm using these equations: https://en.wikipedia.org/wiki/List_of...

It seems pretty straight forward. I'm using meters and kilograms. However, in Gazebo when I use the View Inertia option -- to see the pink rectangles representing the inertia -- it's way bigger than the robot.

Am I missing something important???

Here is how I'm calculating inertia. I've tried it a few different ways:

    <!--<macro name="box_inertia" params="m x y z">
<inertia  ixx="${m*(z*z+x*x)/12}" ixy = "0" ixz = "0" iyy="${m*(y*y+x*x)/12}" iyz = "0"
izz="${m*(y*y+z*z)/12}" /> </macro> <macro name="box_inertia" params="x y z mass"> <inertia ixx="${0.0833333 * mass * (y*y + z*z)}" ixy="0.0" ixz="0.0"
iyy="${0.0833333 * mass * (x*x + z*z)}" iyz="0.0" izz="${0.0833333 * mass * (x*x + y*y)}" />
</macro>-->
<macro name="box_inertia" params="x y z m">
<inertia  ixx="${m*(y*y+z*z)/12}" ixy = "0" ixz = "0" iyy="${m*(x*x+z*z)/12}" iyz = "0"
izz="${m*(x*x+z*z)/12}" /> </macro> <macro name="cylinder_inirtia" params="m r h"> <inertia ixx="${(m*((3*r*r)+(h*h)))/12}" ixy = "0" ixz = "0"
iyy="${(m*((3*r*r)+(h*h)))/12}" iyz = "0" izz="${(m*r*r)/2}" />
</macro> edit retag close merge delete

Sort by » oldest newest most voted

The formulas seem correct (e.g. I used to have:

<!-- inertial -->
<xacro:macro name="box_inertial" params="m x y z">
<intertial>
<mass value="${m}"/> <inertia ixx="${m*(y*y+z*z)/12}"   ixy="0"                   ixz="0"
iyy="${m*(x*x+z*z)/12}" iyz="0" izz="${m*(x*x+z*z)/12}"
/>
</intertial>
</xacro:macro>


so same as you unless xacro:macro instead of macro changes anything).

From the Gazebo tutorial:

You can temporarily set all the links to have a mass of 1.0 (by editing the URDF or SDF file). Then all the purple boxes should have more or less the same shapes as the bounding boxes of their links. This way you can easily detect problems like misplaced Center of Mass or wrongly rotated Inertia Matrix. Do not forget to enter the correct masses when you finish debugging.

It seems like you expect to see the bounding boxes of the links superimposed to the inertial ones, but for those you'd have to set the masses to 1.0 instead of the actual mass. Would that fix it?

more