Robotics StackExchange | Archived questions

Gazebo bumper sensor states msg shows no output

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 amprobot.xacro and amprobot.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</pose>
        <geometry>
          <box>
            <size>0.1 0.05 0.05</size>
          </box>
        </geometry>
        <material>
          <script>
            <uri>__default__</uri>
            <name>__default__</name>
          </script>
        </material>
      </visual>
      <velocity_decay/>
      <gravity>1</gravity>
      <velocity_decay/>
      <self_collide>0</self_collide>
      <sensor name='bump_sensor' type='contact'>
        <update_rate>15</update_rate>
        <visualize>1</visualize>
        <contact>
          <collision>robot_footprint_fixed_joint_lump__bumper_collision_collision_3</collision>
          <topic>state_bumper</topic>
        </contact>
        <plugin name='state_gazebo_ros_bumper_controller' filename='libgazebo_ros_bumper.so'>
          <alwaysOn>true</alwaysOn>
          <updateRate>15.0</updateRate>
          <bumperTopicName>state_bumper</bumperTopicName>
          <frameName>world</frameName>
        </plugin>
        <pose frame=''>0.08 0 0.04 0 -0 0</pose>
      </sensor>

Ubuntu:

$ lsb_release -a
No LSB modules are available.
Distributor ID: Ubuntu
Description:    Ubuntu 16.04.6 LTS
Release:    16.04
Codename:   xenial

ROS environment:

$ env | grep ROS
ROS_ROOT=/opt/ros/kinetic/share/ros
ROS_PACKAGE_PATH=/home/jit/catkin_ws/src:/opt/ros/kinetic/share
ROS_MASTER_URI=http://localhost:11311
ROS_VERSION=1
ROSLISP_PACKAGE_DIRECTORIES=/home/jit/catkin_ws/devel/share/common-lisp
ROS_DISTRO=kinetic
ROS_ETC_DIR=/opt/ros/kinetic/etc/ros

Gazebo:

$ gazebo -v
Gazebo multi-robot simulator, version 7.0.0
Copyright (C) 2012-2016 Open Source Robotics Foundation.
Released under the Apache 2 License.
http://gazebosim.org

Asked by jatinm on 2019-09-27 14:57:23 UTC

Comments

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

Asked by mequi on 2020-07-27 12:07:53 UTC

Same issue here. Googled everything I can...

Asked by Sission on 2021-04-29 10:48:10 UTC

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

Asked by lucasw on 2021-09-28 07:01:44 UTC

Answers

Did anybody make any progress on that? Despite using the correct collision-tag read from the sdf-file, the state argument of the published messages remains empty with obvious collisions.

Asked by lukasschueler on 2021-11-29 10:44:07 UTC

Comments