Robotics StackExchange | Archived questions

Ray sensor crashing Gazebo

Hi,

I'm trying to add velodyne sensor to my robot, modelled using URDF. Unfortunately, Gazebo (1.8.6) crashes on startup if there are both horizontal and vertical sections. With horizontal only, it works fine. Is there any problem in my sensor definition or is it bug in the simulator?

<gazebo reference="velodyne_link">
      <sensor type="ray" name="ray_sensor">
        <always_on>true</always_on>
        <update_rate>10.0</update_rate>
        <pose>0 0 0 0 0 0</pose>
        <visualize>true</visualize>
        <ray>
          <scan>
            <horizontal>
              <samples>21875</samples>
              <resolution>1.0</resolution>
              <min_angle>-3.14</min_angle>
              <max_angle>3.14</max_angle>
            </horizontal>
            <vertical>
              <samples>32</samples>
              <resolution>1.0</resolution>
              <min_angle>-0.535</min_angle>
              <max_angle>0.186132</max_angle>
            </vertical>

          </scan>

          <range>
            <min>1.0</min>
            <max>20.0</max>
            <resolution>0.01</resolution>
          </range>
        </ray>
        <plugin name="gazebo_ros_ray_sensor_controller" filename="libgazebo_ros_block_laser.so">
          <gaussianNoise>0.005</gaussianNoise>
          <alwaysOn>true</alwaysOn>
          <updateRate>10.0</updateRate>
          <topicName>velodyne_cloud</topicName>
          <frameName>velodyne_link</frameName>
        </plugin>
      </sensor>
    </gazebo>

Removing plugin doesn't change anything (Gazebo still crashes).

UPDATE:

Code snippet from first answer works but, it seems that obstacles are "ignored" by sensor - see picture (can't upload it here because of low karma). Also it seems to be producing just 2D data.

Asked by ZdenekM on 2013-06-26 05:49:02 UTC

Comments

coudl you please supply your urdf? we have having the same problem!

Asked by gazer on 2013-07-10 18:40:48 UTC

Answers

Does this SDF world work for you:

<?xml version="1.0" ?>
<sdf version="1.4">
  <world name="default">
    <!-- A global light source -->
    <include>
      <uri>model://sun</uri>
    </include>
    <!-- A ground plane -->
    <include>
      <uri>model://ground_plane</uri>
    </include>

    <model name="velodyne">
      <pose>0 0 0.1 0 0 0</pose>
      <link name="link">
        <inertial>
          <mass>0.1</mass>
        </inertial>

        <collision name="collision">
          <geometry>
            <box>
              <size>0.2 0.2 0.2</size>
            </box>
          </geometry>
        </collision>

        <visual name="visual">
          <geometry>
            <box>
              <size>0.2 0.2 0.2</size>
            </box>
          </geometry>
        </visual>

        <sensor name="laser" type="ray">
          <pose>0.01 0 0.0175 0 -0 0</pose>
          <ray>
            <scan>
              <horizontal>
                <samples>640</samples>
                <resolution>1</resolution>
                <min_angle>-2.26889</min_angle>
                <max_angle>2.268899</max_angle>
              </horizontal>
              <vertical>
                <samples>32</samples>
                <resolution>1</resolution>
                <min_angle>-0.535</min_angle>
                <max_angle>0.186132</max_angle>
              </vertical>
            </scan>
            <range>
              <min>0.1</min>
              <max>10</max>
              <resolution>0.01</resolution>
            </range>
          </ray>

          <plugin name="laser" filename="libRayPlugin.so" />
          <always_on>1</always_on>
          <update_rate>30</update_rate>
          <visualize>true</visualize>
        </sensor>
      </link>
    </model>
  </world>
</sdf>

Asked by nkoenig on 2013-06-27 18:08:39 UTC

Comments

Hi. Thanks for SDF example. It doesn't crash simulator but, also doesn't work properly. I will update question.

Asked by ZdenekM on 2013-07-02 01:19:03 UTC

I know that visualization of vertical laser in Gazebo does not work quite right, but the actual range values may be ok. Maybe you can try subscribing to your laser scan topic and plot of the range values to see if they are correct?

Asked by iche033 on 2013-07-03 00:06:41 UTC

Hi. Did you solve this issue? I am having the same problem. Please keep me update as I am looking to implement the swissranger_camera with the libgazebo_block laser plugin. Thanks !

Asked by gazer on 2013-07-03 10:50:01 UTC

@iche033, I am having the same problem with the vertical laser in Gazebo using the "ros block laser" plugin, removing the vertical will makes the visualization correct. But then using Rviz, the pointclouds published just doesn't make sense

Asked by gazer on 2013-07-10 18:43:47 UTC

Hi, I am using the above velodyne sensor SDF in order to generate the point cloud data and I am able to visualize in rviz , but the problem is it is not rotating. So can , anyone pplz suggest me how to rotate the velodyne sensor.. Thanks !

Asked by anonymous on 2014-09-03 23:50:42 UTC

The above comment about the velodyne sensor has moved to this question

Asked by nkoenig on 2014-09-09 19:07:40 UTC