Gazebo bumper sensor states msg shows no output

asked 2019-09-27 14:57:23 -0500

jatinm gravatar image

updated 2021-09-28 06:45:21 -0500

lucasw gravatar image

I have a simple robot with two wheels and I am trying to add bumper sensors on each side. The goal is to create a blind robot which has a bumper/contact sensor to sense the walls in its world and then make it navigate through the world.

I can see the topic /state_bumper in rostopic list and echo it, but I cannot see any values in states msg as shown below:

$ rostopic echo /state_bumper 
header: 
  seq: 75
  stamp: 
    secs: 480
    nsecs: 588000000
  frame_id: "world"
states: []
---
header: 
  seq: 76
  stamp: 
    secs: 480
    nsecs: 588000000
  frame_id: "world"
states: []
---

Please help me understand where am I going wrong.

I have only shown below the bumper sensor-related code and cut out the robot links codes. I have two separate amp_robot.xacro and amp_robot.gazebo files which I then convert to urdf and sdf files to see the collision tag names and make sure they are the same. This was indicated as a solution in similar questions #q277175 but does not work for me. I use these commands to convert the files:

$ rosrun xacro xacro -o amp_robot.urdf amp_robot.xacro

$ gz sdf -p amp_robot.urdf > amp_robot.sdf

Robot URDF:

<?xml version="1.0" ?>
<!-- =================================================================================== -->
<!-- |    This document was autogenerated by xacro from amp_robot.xacro                | -->
<!-- |    EDITING THIS FILE BY HAND IS NOT RECOMMENDED                                 | -->
<!-- =================================================================================== -->
<!-- x-green y-red z-blue - for all values - depending on where robot is facing - generally x-->
<robot name="amp_robot" xmlns:xacro="http://www.ros.org/wiki/xacro">
  <gazebo>
    <gazebo reference="bumper_link">
    <selfCollide>false</selfCollide>
    <sensor name="bump_sensor" type="contact">
      <update_rate>15.0</update_rate>
      <visualize>true</visualize>
      <contact>
        <collision>robot_footprint_fixed_joint_lump__bumper_collision_collision_3</collision>
        <!--<topic>__default_topic__</topic>-->
        <topic>state_bumper</topic>
      </contact>
      <plugin filename="libgazebo_ros_bumper.so" name="state_gazebo_ros_bumper_controller">
        <alwaysOn>true</alwaysOn>
        <updateRate>15.0</updateRate>
        <bumperTopicName>state_bumper</bumperTopicName>
        <frameName>world</frameName>
      </plugin>
    </sensor>
  </gazebo>

  <link name="bumper_link">
    <inertial>
      <origin rpy="0 0 0" xyz="0 0 0"/>
      <mass value="1e-5"/>
      <inertia ixx="1e-6" ixy="0" ixz="0" iyy="1e-6" iyz="0" izz="1e-6"/>
    </inertial>
    <visual>
      <origin rpy="0 0 0" xyz="0.2 0 0"/>
      <geometry>
        <box size="0.1 0.05 0.05"/>
      </geometry>
      <material name="DarkGrey"/>
    </visual>
    <collision>
      <origin rpy="0 0 0" xyz="0 0 0"/>
      <geometry>
        <box size="0.1 0.05 0.05"/>
      </geometry>
      <material name="DarkGrey"/>
    </collision>
  </link>
  <joint name="bumper_joint" type="fixed">
    <origin rpy="0 0 0" xyz="0.08 0 0.04"/>
    <axis xyz="0 1 0"/>
    <!--<insert_block name="origin"/>-->
    <parent link="chassis"/>
    <child link="bumper_link"/>
  </joint>

Robot SDF

 <collision name='robot_footprint_fixed_joint_lump__bumper_link_collision_3'>
        <pose frame=''>0.08 0 0.04 0 -0 0</pose>
        <geometry>
          <box>
            <size>0.1 0.05 0.05</size>
          </box>
        </geometry>
        <surface>
          <contact>
            <ode/>
          </contact>
          <friction>
            <ode/>
          </friction>
        </surface>
      </collision>

<visual name='robot_footprint_fixed_joint_lump__bumper_link_visual_3'>
        <pose frame=''>0.28 0 0.04 0 -0 0< ...
(more)
edit retag flag offensive close merge delete

Comments

Hi jatinm. I am having these same issues. Did you ever get this figured out? Thanks.

mequi gravatar image mequi  ( 2020-07-27 12:07:53 -0500 )edit

Same issue here. Googled everything I can...

Sission gravatar image Sission  ( 2021-04-29 10:48:10 -0500 )edit

It looks like this the generated sdf name of the collision:

robot_footprint_fixed_joint_lump__bumper_link_collision_3

but this is what is being set in the <sensor> contact:

robot_footprint_fixed_joint_lump__bumper_collision_collision_3
lucasw gravatar image lucasw  ( 2021-09-28 07:01:44 -0500 )edit