Adding ros integrated contact sensors
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!