ROS Resources: Documentation | Support | Discussion Forum | Index | Service Status | ros @ Robotics Stack Exchange |
1 | initial version |
The bumper plugin needs to be inside a <sensor>
element in your urdf:
<gazebo reference="front_bumper">
<sensor name=front_bumper_sensor" type="contact">
<update_rate>10.0</update_rate>
<contact>
<!-- These collision names need to match the names used in the generated -->
<!-- SDF, not the urdf names or this still won't work! -->
<collision>front_bumper_collision</collision>
</contact>
<plugin name="bumper_plugin" filename="libgazebo_ros_bumper.so">
<ros>
<namespace>demo</namespace>
<remapping>bumper_states:=bumper_demo</remapping>
</ros>
</plugin>
</sensor>
</gazebo>
To find the actual collision name you should use in the collision element look at https://answers.ros.org/question/277175/gazebo_ros_bumper_controller-not-updating-bumper-states/?answer=286184#post-id-286184
In summary, run gz sdf -p <your_filename>.urdf
and check to see the collision name it generates for the front bumper collision, then put that name into the <collision>
element.
You'll also need to give an actual name to the collision:
<collision name="front_bumper_collision">
<geometry>
<box size="0.03 0.400 0.03"/>
</geometry>
</collision>