# Revision history [back]

### inertia origin set in urdf handled wrong by gazebo?

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.

here are some lines from my urdf file:

  <link name="base_link">
<visual>
<geometry>
<mesh filename="package://sr1_description/meshes2/robot.stl"/>
</geometry>
<material name="Blue"/>
</visual>
<collision>
<geometry>
<mesh filename="package://sr1_description/meshes2/robot.stl"/>
</geometry>
</collision>
<inertial>
<origin xyz="1337 42 1984" rpy="0 0 0" /> <!-- whatever I put here is ignored -->
<mass value="70.0"/>
<inertia ixx="1.0" ixy="0" ixz="0" iyy="1.0" iyz="0" izz="1.0"/>
</inertial>
<visual>
<origin rpy="0 0 0" xyz="0 0 0.2"/>
<geometry>
<box size="0.001 0.001 0.001"/>
</geometry>
<material name="Blue"/>
</visual>
<collision>
<origin rpy="0 0 0" xyz="0 -0.15 0.2"/> <!-- this is the mass origin for every part -->
<geometry>
<box size="0.001 0.001 0.001"/>
</geometry>
</collision>
<inertial>
<mass value="0.0"/>
<origin xyz="-0.15 0 0.2"/>
<inertia ixx="0.0" ixy="0.0" ixz="0.0" iyy="0.0" iyz="0.0" izz="0.0"/>
</inertial>
<joint name="base_footprint" type="fixed">
<origin rpy="0 0 1.57075" xyz="0 0 0"/>
</joint>


### inertia origin set in urdf handled wrong by gazebo?

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.

here are some lines from my urdf file:

  <link name="base_link">
<visual>
<geometry>
<mesh filename="package://sr1_description/meshes2/robot.stl"/>
</geometry>
<material name="Blue"/>
</visual>
<collision>
<geometry>
<mesh filename="package://sr1_description/meshes2/robot.stl"/>
</geometry>
</collision>
<inertial>
<origin xyz="1337 42 1984" rpy="0 0 0" /> <!-- whatever I put here is ignored -->
<mass value="70.0"/>
<inertia ixx="1.0" ixy="0" ixz="0" iyy="1.0" iyz="0" izz="1.0"/>
</inertial>
<visual>
<origin rpy="0 0 0" xyz="0 0 0.2"/>
<geometry>
<box size="0.001 0.001 0.001"/>
</geometry>
<material name="Blue"/>
</visual>
<collision>
<origin rpy="0 0 0" xyz="0 -0.15 0.2"/> <!-- this is the mass origin for every part -->
<geometry>
<box size="0.001 0.001 0.001"/>
</geometry>
</collision>
<inertial>
<mass value="0.0"/>
<origin xyz="-0.15 0 0.2"/>
<inertia ixx="0.0" ixy="0.0" ixz="0.0" iyy="0.0" iyz="0.0" izz="0.0"/>
</inertial>
<joint name="base_footprint" type="fixed">
<origin rpy="0 0 1.57075" xyz="0 0 0"/>
</joint>


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?

### inertia origin set in urdf handled wrong by gazebo?

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.

here are some lines from my urdf file:

  <link name="base_link">
<visual>
<geometry>
<mesh filename="package://sr1_description/meshes2/robot.stl"/>
</geometry>
<material name="Blue"/>
</visual>
<collision>
<geometry>
<mesh filename="package://sr1_description/meshes2/robot.stl"/>
</geometry>
</collision>
<inertial>
<origin xyz="1337 42 1984" rpy="0 0 0" /> <!-- whatever I put here is ignored -->
<mass value="70.0"/>
<inertia ixx="1.0" ixy="0" ixz="0" iyy="1.0" iyz="0" izz="1.0"/>
</inertial>
<visual>
<origin rpy="0 0 0" xyz="0 0 0.2"/>
<geometry>
<box size="0.001 0.001 0.001"/>
</geometry>
<material name="Blue"/>
</visual>
<collision>
<origin rpy="0 0 0" xyz="0 -0.15 0.2"/> <!-- this is the mass origin for every part -->
<geometry>
<box size="0.001 0.001 0.001"/>
</geometry>
</collision>
<inertial>
<mass value="0.0"/>
<origin xyz="-0.15 0 0.2"/>
<inertia ixx="0.0" ixy="0.0" ixz="0.0" iyy="0.0" iyz="0.0" izz="0.0"/>
</inertial>
<joint name="base_footprint" type="fixed">
<origin rpy="0 0 1.57075" xyz="0 0 0"/>
</joint>


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">
<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>
</robot>


cube2.urdf:

<robot name="cube2">
<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>
<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>