Home | Tutorials | Wiki | Issues
Ask Your Question
1

Adding ros integrated contact sensors

asked 2014-01-30 06:19:21 -0500

EricSidorov gravatar image

Hello everyone!

I'm building a biped model and I want to add a sensor that detects a collision between its foot and the ground and sends a message to a ROS topic.

The 'Bumper controller' described here sounds pretty much like what I want. But when I try to put the following tag in the .gazebo file:

<gazebo>
  <plugin name="gazebo_ros_bumper_controller" filename="libgazebo_ros_bumper.so">
    <alwaysOn>true</alwaysOn>
    <updateRate>100</updateRate>
    <bumperTopicName>test_bumper</bumperTopicName>
    <frameName>world</frameName>
  </plugin>
</gazebo>

As suggested in the tutorial, I get the following error:

Error [Model.cc:761] Model[bumperbot] is attempting to load a plugin, but detected an incorrect plugin type. Plugin filename[libgazeborosbumper.so] name[gazeborosbumpercontroller]

I ftought it was because I did not specify any link for the sensor, so I tried using:

<gazebo reference='base_link'>

This time I got the message:

Error [parser.cc:697] XML Element[plugin], child of element[link] not defined in SDF. Ignoring.[link]
Error [parser.cc:688] Error reading element <link>
Error [parser.cc:688] Error reading element <model>
Error [parser.cc:348] Unable to read element <sdf>
Error [parser.cc:299] parse as old deprecated model file failed.
Error [World.cc:1469] Unable to read sdf string

I also tried to follow this answer, which suggested using a tag like this:

<sensor:contact name="contact_sensor">
  <geom>base_link_geom</geom>
  <updateRate>20.0</updateRate>
  <controller:gazebo_ros_bumper name="gazebo_ros_bumper_controller" plugin="libgazebo_ros_bumper.so">
      <alwaysOn>true</alwaysOn>
      <updateRate>20.0</updateRate>
      <bumperTopicName>bumper</bumperTopicName>
      <interface:bumper name="bumper_iface" />
  </controller:gazebo_ros_bumper>
</sensor:contact>

This time the xml couldn't even be parsed.

I did manage to add the gazebo contact sensor

<gazebo reference="base_link">
  <sensor type="contact" name="contact">
    <update_rate>100.000000</update_rate>
    <contact>
      <collision>base_link_collision</collision>
      <topic>/contact</topic>
    </contact>
    <plugin name='gazebo_contact' filename='libContactPlugin.so'/>
  </sensor>
</gazebo>

But it publishes to a gazebo topic, not a ROS topic.

Does anyone know what am I doing wrong? I'm using gazebo 1.9.3 and ros-hydro.

P.S: I've noticed the turtlebot has a sensor that does exactly what I want, but I couldn't figure out where to find the plugin which is used there or how to add it to my model.

Thanks in advance!

edit retag flag offensive close merge delete

3 Answers

Sort by ยป oldest newest most voted
4

answered 2014-01-31 13:25:49 -0500

Here is an example:

<gazebo reference="gripper">
  <sensor name="gripper_contact_sensor" type="contact">
    <always_on>true</always_on>
    <update_rate>30.0</update_rate>
    <contact>
      <collision>collision</collision>
    </contact>
    <plugin name="gripper_bumper" filename="libgazebo_ros_bumper.so">
      <bumperTopicName>gripper_contact_sensor_state</bumperTopicName>
      <frameName>gripper</frameName>
    </plugin>
  </sensor>
</gazebo>
edit flag offensive delete link more
1

answered 2014-04-03 08:30:17 -0500

Gxav gravatar image

So did you get it worked? I am trying to do the same but always get an empty topic when using libgazeborosbumper.so and no topic is generated when using my own plugin. How you create collision name using urdf description? Thank you in advance

edit flag offensive delete link more

Comments

I got the same problem, empty topic, though I have tried to work around by following the above link I leave

shawnysh gravatar imageshawnysh ( 2017-06-12 04:36:15 -0500 )edit

Did you get it done by the way? Thanks!

shawnysh gravatar imageshawnysh ( 2017-06-12 04:37:36 -0500 )edit
0

answered 2017-06-12 04:31:16 -0500

shawnysh gravatar image

updated 2017-06-12 04:36:53 -0500

collision tag in contact tag of gazebo tag is very tricky, to which one should pay more attention.

Here is the link to work around: gazebo-contact-sensor-added-to-a-robot-link-in-urdf-file-is-not-working-as-expected

edit flag offensive delete link more
Login/Signup to Answer

Question Tools

Stats

Asked: 2014-01-30 06:19:21 -0500

Seen: 5,293 times

Last updated: Jun 12 '17