Gazebo | Ignition | Community
Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

Contact Sensor doesn't work in Gazebo 9

I'm trying to create contact sensor with Gazebo 9 + ROS Melodic, here is my code:


<?xml version="1.0"?>
<robot name="test" xmlns:xacro="">

   <link name="chassis">
      <mass value="100" />
      <origin xyz="0 0 0" rpy="0 0 0" />
      <inertia ixx="16.66666" ixy="0.0" ixz="0.0" iyy="41.66665" iyz="0.0" izz="41.66665" />
        <box size="2 1 1" />
    <collision name="chassis_collision">
        <box size="2 1 1" />

  <link name="bumper"><box size="0.1 0.1 0.1" />
        <box size="0.1 0.1 0.1" />
    <collision name="bumper_collision">
        <box size="0.1 0.1 0.1" />

  <joint name="chassis_bumper_joint" type="fixed">
    <parent link="chassis" />
    <child link="bumper" />
    <origin xyz="1 0.5 0" rpy="0 0 0" />
    <axis xyz="0 0 1" />

  <gazebo reference="bumper">
    <sensor name="bumper_sensor" type="contact">
      <plugin name="bumper_plugin" filename="">


<?xml version="1.0" encoding="utf-8"?>
<sdf version="1.4">
<world name="default">
    <gravity>0 0 -9.8</gravity>

launch file


  <include file="$(find gazebo_ros)/launch/empty_world.launch">
    <arg name="world_name" value="$(find simulation_app)/worlds/"/>
    <arg name="paused" value="false"/>
    <arg name="use_sim_time" value="true"/>
    <arg name="gui" value="true"/>
    <arg name="headless" value="false"/>
    <arg name="debug" value="false"/>
    <arg name="verbose" value="true"/>

  <param name="robot_description" command="$(find xacro)/xacro --inorder $(find simulation_app)/urdf/test.urdf.xacro" />
  <node pkg="gazebo_ros" type="spawn_model" name="spawn_urdf" args="-urdf -param robot_description -model test"/>


I expect to get something when bumper touches ground plane since chassis has inertial but instead I'm getting empty states in bumper_sensor topic when it happens:

    seq: 6693
        secs: 257
        nsecs: 555000000
    frame_id: "bumper"
        states: []

Does anybody know if I'm missing something?