Gazebo | Ignition | Community
Ask Your Question

Revision history [back]

gazebo_ros ray sensor header appears broken

I am attempting to simulate an Ouster OS1 lidar, publishing to my ros2 stack using the libgazebo_ros_ray_sensor plugin. However, all of the messages are being filtered out in my ros2 stack with a message like "[planner_server-13] [INFO] [1647883788.634003928] [global_costmap.global_costmap_rclcpp_node]: Message Filter dropping message: frame 'lidar_front_data_frame' at time 145.702 for reason 'Unknown'" This does not happen when using a real OS1 lidar.

I am using ros2-foxy, gazebo 11.9.0 on ubuntu 20.04. Thanks!

Looking at the messages, the header section has some significant differences.

Real lidar output:

header:
  stamp:
    sec: 1060
    nanosec: 506131150
  frame_id: laser_front_data_frame
height: 32
width: 1024
fields:
- name: x
  offset: 0
  datatype: 7
  count: 1
- name: y
  offset: 4
  datatype: 7
  count: 1
- name: z
  offset: 8
  datatype: 7
  count: 1
- name: intensity
  offset: 16
  datatype: 7
  count: 1
- name: t
  offset: 20
  datatype: 6
  count: 1
- name: reflectivity
  offset: 24
  datatype: 4
  count: 1
- name: ring
  offset: 26
  datatype: 2
  count: 1
- name: ambient
  offset: 28
  datatype: 4
  count: 1
- name: range
  offset: 32
  datatype: 6
  count: 1
is_bigendian: false
point_step: 48
row_step: 49152
data:
- 20
- etc...

Gazebo-ros simulated output:

header:
  stamp:
    sec: 19
    nanosec: 302500000
  frame_id: lidar_front_data_frame
height: 1
width: 8192
fields:
- name: x
  offset: 0
  datatype: 7
  count: 1
- name: y
  offset: 4
  datatype: 7
  count: 1
- name: z
  offset: 8
  datatype: 7
  count: 1
- name: intensity
  offset: 12
  datatype: 7
  count: 1
is_bigendian: false
point_step: 16
row_step: 131072
data:
- 218
- etc...

And the relevant part of the sdf:

<sensor type="ray" name="lidar_front_sensor">
        <pose>0 0 0 0 0 0</pose>
        <visualize>false</visualize>
        <update_rate>10.0</update_rate>
        <ray>
          <scan>
            <horizontal>
              <samples>512</samples>
              <resolution>1</resolution>
              <min_angle>-3.14159</min_angle>
              <max_angle>3.14159</max_angle>
            </horizontal>
            <vertical>
              <samples>16</samples>
              <resolution>1</resolution>
              <min_angle>-0.2897247</min_angle> <!-- -16.6 degrees -->
              <max_angle>+0.2897247</max_angle> <!-- +16.6 degrees -->
            </vertical>
          </scan>
          <range>
            <min>0.1</min>
            <max>100</max>
            <resolution>0.003</resolution>
          </range>
        </ray>   
        <plugin name="lidar_front_ray_sensor_plugin" filename="libgazebo_ros_ray_sensor.so">
          <ros>
            <namespace>/lidar_front</namespace>
            <remapping>~/out:=points</remapping>
          </ros>
          <output_type>sensor_msgs/PointCloud2</output_type>
          <frame_name>lidar_front_data_frame</frame_name>
        </plugin>
      </sensor>