Revision history [back]

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?