Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

Hi, I've tried your SDF model ( without the meshes, just because you didnt give them here ) in a simulation I created for testing collisions and seems to work.

image description image description

I'll leave here the code for the different parts so that you can test it yourself and also a ROSject where you have all the project ready to use.

I've made also a VIDEO that explains this.

I think the problem might come from an incirrect configuration of the contact plugin, because it has this tricky behaviour that you have to make the conversion from the urdf/xacro to sdf to see exactly the name of the collision element , otherwise it doesnt work.

Lets say you have something like this in your xacro/urdf:

<!-- Contact Sensor -->
<gazebo reference="${lr}_arm_fist">
    <sensor name="lowerleg_contactsensor_sensor" type="contact">
      <always_on>true</always_on>
      <contact>
        <collision>${lr}_upper_arm_fixed_joint_lump__${lr}_bump_sensor_collision_collision_1</collision>
      </contact>
      <plugin name="${lr}_arm_fist_plugin" filename="libgazebo_ros_bumper.so">
        <bumperTopicName>${lr}_arm_fist_contact</bumperTopicName>
        <frameName>${lr}_arm_fist</frameName>
      </plugin>
    </sensor>
</gazebo>

In this example the collision elemnt name in the final sdf is: ${lr}_upper_arm_fixed_joint_lump__${lr}_bump_sensor_collision_collision_1.

That name was selected because I went to the final SDF and saw which name was given to the collision element of the end efector that has to register the collisions.

Here you have the script that transforms xacro/urdf to sdf, and look for the collision element of the link element that you want to register collisions.

#!/usr/bin/env bash
echo "Commadn to test that collisions elements are well done for bumber plugin"
cd ../robot/
pwd
ls
rosrun xacro xacro --inorder contact_robot.xacro > contact_robot.urdf
gz sdf -p contact_robot.urdf > contact_robot.sdf

Here you have the git to the hole testing project: GIT CONTACT TESTS

Hope this cleared up some doubts and helped.