Robotics StackExchange | Archived questions

Issue with simulating 3D LiDAR Scanner sensor

Hello everyone, Here I am trying to simulate a 3D LiDAR scanner with the following properties: Click Here The scenario is that my lidar is installed on a height and it is scanning the environment, including a mobile robot. The lidar has a pitch angle, looking down on the robot like the following picture.

image description

This sensor, scans the 3D space with horizontal and vertical laser beams. However, the published LaserScan topic is 2D, with Z values of 0. Here is the code inside the sensor tag:

<sensor type="gpu_ray" name="lidar">

  <pose>0.15 0 2.60 0 0.5323 0</pose>
  <visualize>false</visualize>
  <update_rate>15</update_rate>

  <ray>
    <scan>

      <horizontal>
        <samples>600</samples>
        <resolution>1</resolution>
        <min_angle>-1.04</min_angle>
        <max_angle>1.04</max_angle>
      </horizontal>

      <vertical>
        <samples>125</samples>
        <resolution>1</resolution>
        <min_angle>-0.21</min_angle>
        <max_angle>0.21</max_angle>
      </vertical>

    </scan>

    <range>
      <min>1</min>
      <max>120</max>
      <resolution>0.1</resolution>
    </range>

    <noise>
      <type>gaussian</type>
      <mean>0.0</mean>
      <stddev>0.01</stddev>
    </noise>
  </ray>

  <plugin name="gazebo_ros_head_lidar_controller" filename="libgazebo_ros_gpu_laser.so">
    <topicName>/jakal/laser/scan</topicName>
    <frameName>lidar_link</frameName>
    <organize_cloud>true</organize_cloud>
  </plugin>

</sensor>

And here is the visualized output of the laserscan topic, in Rviz:

image description

Does anybody have a clue why this might be? I specified both vertical and horizontal scan beams but the output is 2D! I must also mention that I am quite new to both ROS and Gazebo, so all of your help is highly appreciated.

Thanks.

Asked by Soroush Maleki on 2022-02-14 11:45:42 UTC

Comments

Answers

I think you better make use of the block_laser plugin. You can specify the horizontal and vertical samples. This will give you a 3D result (pointcloud topic)

<gazebo reference="block_laser_link">
    <sensor type="ray" name="block_laser_sensor">
      <pose>0 0 0 0 0 0</pose>
      <visualize>false</visualize>
      <update_rate>10</update_rate>
      <ray>
        <scan>
          <horizontal>
            <samples>720</samples>
            <resolution>1</resolution>
            <min_angle>-1.570796</min_angle>
            <max_angle>1.570796</max_angle>
          </horizontal>
          <vertical>
            <samples>8</samples>
            <resolution>1</resolution>
            <min_angle>-0.2</min_angle>
            <max_angle>0.2</max_angle>
          </vertical>

        </scan>
        <range>
          <min>0.10</min>
          <max>30.0</max>
          <resolution>0.01</resolution>
        </range>
        <noise>
          <type>gaussian</type>
          <!-- Noise parameters based on published spec for Hokuyo laser
               achieving "+-30mm" accuracy at range < 10m.  A mean of 0.0m and
               stddev of 0.01m will put 99.7% of samples within 0.03m of the true
               reading. -->
          <mean>0.0</mean>
          <stddev>0.01</stddev>
        </noise>
      </ray>
      <plugin name="gazebo_ros_block_laser_controller" filename="libgazebo_ros_block_laser.so">
        <updateRate>20</updateRate>
        <topicName>/agv/pointcloud</topicName>
        <frameName>block_laser_link</frameName>
      </plugin>
    </sensor>
  </gazebo>

Asked by Nobel on 2022-02-21 03:22:47 UTC

Comments