Difference between <origin> in urdf file and spawning a part at a given position

asked 2019-05-06 01:17:05 -0500

steradiant gravatar image

updated 2019-05-06 02:15:05 -0500

Hello,

I'm wondering what the difference between the following two methods is: I have the following urdf file

   <link name="tube_link">
<collision>
  <origin xyz="-0.25 0.5 0.835" rpy="0 0 0"/>
  <geometry>
     <cylinder radius="0.02" length="0.12" />
  </geometry>
</collision>

<visual>
  <origin xyz="-0.25 0.5 0.835" rpy="0 0 0"/>
  <geometry>
     <cylinder radius="0.02" length="0.12" />
  </geometry>
</visual>

<inertial>
  <mass value="0.3" />
  <origin xyz="-0.25 0.5 0.835" rpy="0 0 0"/>
  <cylinder_inertia_def radius="0.02" length="0.12" mass="0.3"/>
</inertial>

</link>

I use the <origin> tag to place the tube at a certain position in the Gazebo world. The tube correctly spawns at this position. One thing I was wondering was, when I look at the axis cross of the object (which is displayed by gazebo when I e.g. want to move the object in the world), I find it in the origin of the world which surprised me. Because if I want to rotate the tube inside gazebo, the rotation is also always done around the origin of the world rather than around the origin of the part itself.

I tried then another approach and set all coordinates in the origin tag to 0 and spawned the model via coordinates in the launch file like

<node name="tube_spawner" pkg="gazebo_ros" type="spawn_model" output="screen" args="-urdf -param tube_description -x -0.25 -y 0.5 -z 0.835 -model my_kuka_tube" />

But the model showed strange behavior then. It was placed on a table (cafe_table standard model from Gazebo) and it slipped of the table automatically.

So what is the difference in these two methods?

edit retag flag offensive close merge delete