Ask Your Question

Getting contact sensor/bumper Gazebo plugin to work

asked 2016-10-25 22:19:38 -0600

RobB gravatar image

Has anyone had success with this? That is, creating a contact sensor/ bumper in urdf and connecting it to the Gazebo plugin described here ( ), and then receiving the messages you'd expect on the defined topic.

My Gazebo code is:

<gazebo reference="bump_sensor">
<sensor name="main_bumper" type="contact">
    <plugin name="gazebo_ros_bumper_controller" filename="">   

The model code is

<joint name="bumper_joint" type="fixed">
    <axis xyz="0 1 0" />
    <origin xyz=".2 0 0" rpy="0 0 0"/>
    <parent link="chassis"/>
    <child link="bump_sensor"/>   </joint>

 <link name="bump_sensor">
      <origin xyz="0 0 0" rpy="0 0 0"/>
    <box size="0.1 0.1 0.1"/>

      <origin xyz="0 0 0" rpy="0 0 0"/>
         <box size="0.1 0.1 0.1"/>

      <mass value="1e-5" />
      <origin xyz="0 0 0" rpy="0 0 0"/>
      <inertia ixx="1e-6" ixy="0" ixz="0" iyy="1e-6" iyz="0" izz="1e-6" />

I don't think there is anything wrong with above. The topic bumper_vals is created and I can look at the messages to it via rostopic echo. They are in the expected gazebo_msgs/ContactState format. (or is it ContactsState?)

The point is that the states[] array is always empty even on an obvious collision.

Heaps of people seem to have had problems with bumpers (especially in simulation) and I don't see any clear cut answer. Why isn't there an effort to get this to work? If you know anything about robotics, then a contact sensor is the most basic thing you need to have working. Cameras, laser sensors re great, but the contact sensor is (should be) the simple, reliable backup that gets you out of trouble. And you can do a lot with it alone - e.g investigate and test path planning algorithms in spaces with obstacles, which is my project.

Any help greatly appreciated. Rob

edit retag flag offensive close merge delete


I'm having the exact same issue

neckutrek gravatar imageneckutrek ( 2016-12-13 06:57:14 -0600 )edit

2 Answers

Sort by ยป oldest newest most voted

answered 2017-02-27 07:02:54 -0600

updated 2017-02-27 07:03:22 -0600

You need apply the name attribute to your collision tag such as:

<collision name="bump_sensor_collision">

This should make it work. However if specifying in urdf or xacro you may still have an issue in that the sensor doesn't output anything. In that case suffix the


with a _collision, such that it reads:


This trick was due to how the sdf is generated from the urdf file, in that it was appending a _collision to the name attribute of the collision specification.

edit flag offensive delete link more



it can be more complicated that a simple _collision add but this is indeed the general idee ;) More details in the link in my answer ;)

TTDM gravatar imageTTDM ( 2017-03-01 02:44:06 -0600 )edit

This trick is very important. I spend a week on this. Really don't know why gazebo not give a demo directly.

littleghost gravatar imagelittleghost ( 2018-06-27 03:06:50 -0600 )edit

answered 2017-02-02 11:13:37 -0600

TTDM gravatar image

updated 2017-02-02 11:50:08 -0600

I solved a problem which was close to this one,( you can check here: ) and I wonder if itsn't the same for you :

You call a "bump_sensor_collision" inside the gazebo flag to define the collision and you assume that it is created by the declaration of a collision inside the "bump_sensor" <link> ( which it should be ). However i found that the first name can be modified with a few supplementary informations so I invite you to check on the final sdf if your two names are identical and if they aren't to change the name inside the <gazebo> flag to make is match the collision in the <link>.

More information on how to do so are in the first link.


edit flag offensive delete link more


Cheers. I'll give it a try. Rob

RobB gravatar imageRobB ( 2017-02-27 21:50:29 -0600 )edit

Your Answer

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

Add Answer

Question Tools



Asked: 2016-10-25 22:19:38 -0600

Seen: 2,083 times

Last updated: Feb 27 '17