Gazebo | Ignition | Community
Ask Your Question
0

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

asked 2018-09-10 17:08:37 -0600

anna.sarp gravatar image

updated 2018-09-11 08:39:08 -0600

Hi,

I am using ROS kinetic 1.12.13 and gazebo 7.13.0

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 ?

Thanks

edit retag flag offensive close merge delete

Comments

Strange, the contacts should be generated the same way for static objects. Have you checked that the contact points show up on the Gazebo UI?

chapulina gravatar imagechapulina ( 2018-09-13 09:55:16 -0600 )edit

1 Answer

Sort by ยป oldest newest most voted
0

answered 2018-09-17 03:14:39 -0600

Duckfrost 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

edit flag offensive delete link more

Question Tools

2 followers

Stats

Asked: 2018-09-10 17:08:37 -0600

Seen: 6,082 times

Last updated: Sep 17 '18