Hi there,
I am currently developing an urdf model of our robot for simulation in gazebo. I always had problems setting the mass origin correctly. My model has a base_footprint link as root link, which has and so I didn't care about it's inertia origin, the child link is the base_link which is the main body of the robot, where I set the mass and origin values. I found out that gazebo (or the urdf converter?) is handling the model in a very strange way. The origin value of base_link is ignored and the origin for all (fixed) parts is the origin specified in base_footprint.
So now my question is how this is supposed to be? Is this wanted behaviour or a bug in gazebo? Or am I missing something? It took me weeks to figure out what exactly is the problem, and I couldn't find any information about this problem.
edit: Another question. Where should I specify the inertia values and how are they evaluated? e.g. what happens if I give an inertia matrix for both base_footprint and base_link at different origins?
UPDATE2: I removed my previous urdf, now here is a new example:
cube1.urdf:
<robot name="cube1">
<link name="cube">
<visual>
<geometry>
<box size="1 1 1"/>
</geometry>
</visual>
<collision>
<geometry>
<box size="1 1 1"/>
</geometry>
</collision>
<inertial>
<mass value="10"/>
<origin xyz="5 5 5" />
<inertia ixx="0.0" ixy="0.0" ixz="0.0" iyy="0.0" iyz="0.0" izz="0.0"/>
</inertial>
</link>
</robot>
cube2.urdf:
<robot name="cube2">
<link name="cube">
<visual>
<geometry>
<box size="1 1 1"/>
</geometry>
</visual>
<collision>
<geometry>
<box size="1 1 1"/>
</geometry>
</collision>
<inertial>
<mass value="10"/>
<origin xyz="5 5 5" />
<inertia ixx="0.0" ixy="0.0" ixz="0.0" iyy="0.0" iyz="0.0" izz="0.0"/>
</inertial>
</link>
<link name="pseudo_link">
<visual>
<geometry>
<box size="0.1 0.1 0.1"/>
</geometry>
</visual>
<collision>
<geometry>
<box size="0.1 0.1 0.1"/>
</geometry>
</collision>
<inertial>
<mass value="0.00001"/>
<inertia ixx="0.0" ixy="0.0" ixz="0.0" iyy="0.0" iyz="0.0" izz="0.0"/>
</inertial>
</link>
<joint name="cube_joint" type="fixed">
<origin xyz="0 0 0" rpy="0 0 0" />
<parent link="pseudo_link"/>
<child link="cube"/>
</joint>
</robot>
Both times it's a simple cube with 1m sides and a mass of 10kg. The mass origin has an offset of 5m in every direction, so it is outside of the geometry. cube2 has an additional pseudo link as parent which has a very small mass and its origin in the center. If gazebo handled the mass origin correctly I would expect both cubes to show the same behavior. If you spawn both models in gazebo you can see that cube1 starts standing on the corner, as expected, because the mass origin is outside. However cube2 is just laying on the floor as normal cubes do. So clearly the mass origin of cube2 is inside the cube (in the center) and not where I set it in the cube link.
Originally posted by Kai Bublitz on ROS Answers with karma: 357 on 2012-02-09
Post score: 1
Original comments
Comment by DimitriProsser on 2012-02-09:
How are you measuring the mass origin?
Comment by Kai Bublitz on 2012-02-13:
I'm just guessing the mass origin so that it is somewhere in the center of the robot. I know that is not very accurate but it's good enough for what I need.
Comment by DimitriProsser on 2012-02-14:
Well, how do you know that the mass origin is not being set correctly?
Comment by Kai Bublitz on 2012-02-14:
I can see it from the behavior in gazebo. When I choose such extreme values as in my example above the robot should fall to one side or the other, however it does not. I could try to make a more specific example to prove it (or prove myself wrong)