Gazebo contact sensor added to a robot link in urdf file is not working as expected?
I have added a contact sensor to one of the finger links of a robot's gripper as follows:
<link name="bh_finger_13_link">
<inertial>
<mass value="0.01"/>
<origin xyz="0 0 0" rpy="0 0 0"/>
<inertia ixx="1" ixy="0" ixz="0" iyy="1" iyz="0" izz="1" />
</inertial>
<visual>
<origin xyz="0 0 0" rpy="0 0 0" />
<geometry>
<mesh file
name="package://bh262_description/meshes/bhand/finger_tip.dae" />
</geometry>
<material name="Yellow" />
</visual>
<collision name="bh_finger_13_collision">
<origin rpy="0 0 0" xyz="0.0 0.0 0.0"/>
<geometry name="bh_finger_13_collision">
<mesh filename="package://bh262_description/meshes/bhand/finger_tip.dae" />
</geometry>
<contact_coefficients kd="1.0" kp="1000.0" mu="0"/>
</collision>
</link>
<gazebo reference="bh_finger_13_link">
<sensor name='my_contact' type='contact'>
<plugin name="my_plugin" filename="libcontact.so"/>
<contact>
<collision>bh_finger_13_link_collision</collision>
</contact>
<update_rate> 5 </update_rate>
</sensor>
</gazebo>
On lauching the urdf file, I am getting the gazebo topics /gazebo/default/wam/bh_finger_13_link/my_contact
and /gazebo/default/wam/bh_finger_13_link/my_contact/contacts
. However, on echoing these topics, I am not getting the collision data. In order to debug this issue, I have also added a contact sensor to a box model sdf, and made the finger link to touch this object. On echoing the topic associated with the contact sensor of the box model, I am getting the collision of the box with the finger link, but on echoing the topic associated with the finger link, I am not getting the same collision information. I am not able to figure out the reason behind this discrepancy. Any help is much appreciated.
Did you find any solution ? I have exaclty the same issue: i'm able to have collision data from the sensor contact type in a world model but when i do it inside a robot then the collision is empty and on the dedicated topic I only have timestamps