Ask Your Question
0

Gazebo : Detecting collision with a static object using contact sensor pugin

asked 2018-09-10 19:59:36 -0600

prasanna.kumar gravatar image

updated 2018-09-11 08:41:18 -0600

Hi,

DISCLAIMER: I know this is a gazebo question and not ROS only question. I posted on Gazebosim forum but no luck, so I am posting here.

I have a staic object in a gazebo world. This static object has camera, depth and contact sensors attached to it. I will refer to this object as "sensor_agent".

When this sensor_agent collides with other non-static objects, the contact sensor outputs contact states but however I have a whole bunch of models in my world like building and trees which are static objects (<static> true </static>). When the sensor_agent collides with these static objects the, the contact states is empty.

Here is sdf file of one of those static models.

Is there any way I can detect collision with these static objects using contact sensor ?

If not, is there any other way I can detect collision with these objects ?

I am using ROS kinetic 1.12.13 and gazebo 7.13.0.

Thanks

edit retag flag offensive close merge delete

1 Answer

Sort by » oldest newest most voted
1

answered 2018-09-17 03:16:49 -0600

RDaneelOlivaw gravatar image

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.

edit flag offensive delete link more

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools

2 followers

Stats

Asked: 2018-09-10 19:59:36 -0600

Seen: 448 times

Last updated: Sep 17 '18