gazebo6 sensor contact

asked 2016-01-21 00:39:55 -0500

gecastro gravatar image

updated 2016-01-26 20:31:07 -0500

I have a problem since I changed from gazebo2 to gazebo6

I have in my URDF this:

<gazebo reference="left_foot_link">
  <sensor name="left_foot_sensor" type="contact">
    <always_on>true</always_on>
    <update_rate>100.0</update_rate>
    <contact>
      <collision>left_foot_fsr1_link_collision</collision>
      <collision>left_foot_fsr2_link_collision</collision>
      <collision>left_foot_fsr3_link_collision</collision>
      <collision>left_foot_fsr4_link_collision</collision>
  <topic>/robot/left_foot_sensor</topic>
    </contact>
  </sensor>
</gazebo>

The links fsr1, fsr2, fsr3, fsr4 are fixed to the parent. Using gz topic I can see the two topics:

  • /gazebo/default/robot/left_foot_link/left_foot_sensor/contacts
  • /robot/left_foot_sensor

But messages in both of this topics are empty (only timestamp). While in the topic /gazebo/default/physics/contacts, I can see:

contact {
  collision1: "robot::left_foot_link::left_foot_link_lump::left_foot_fsr1_link_collision_1"
  collision2: "ground_plane::link::collision"
  position {
    x: 0.038235972692059896
    y: 0.016852892204142138
    z: -8.2373648911671e-05
  }
  ...

EDIT

I found that because the sdf parser, the basename for grouped links includes a "_lump" postfix (see https://bitbucket.org/osrf/sdformat/p... for details). I managed to get the contacts working by setting explicitly the collision name in the sensor like is shown below. The parent link is called "left_foot_link", the child links "left_foot_fsr1_link", ..., "left_foot_fsr4_link".

<gazebo reference="left_foot_link">
  <sensor name="left_foot_sensor" type="contact">
    <always_on>true</always_on>
    <update_rate>100.0</update_rate>
    <contact>
      <collision>left_foot_link_lump::left_foot_fsr1_link_collision_1</collision>
      <collision>left_foot_link_lump::left_foot_fsr2_link_collision_2</collision>
      <collision>left_foot_link_lump::left_foot_fsr3_link_collision_3</collision>
      <collision>left_foot_link_lump::left_foot_fsr4_link_collision_4</collision>
  <topic>/robot/left_foot_sensor</topic>
    </contact>
  </sensor>
</gazebo>

I couldn't understand why the postfix _1 _2 _3 _4 are attached to the child links. Anyone would suggest a better way to remove the hard-coded prefix/postfix in the names? In which version the pull request #235 will be reflected?

Thanks!

edit retag flag offensive close merge delete

Comments

I had the same problem but not with the same postfix. Thanks you for this post.

Brosseau.F gravatar imageBrosseau.F ( 2016-04-29 08:04:43 -0500 )edit