I am trying to port a ros1 example (clearpath's husky simulator) into ros2.
For ROS1 Noetic / Gazebo Classic 11.10, the simulated velodyne lidar config is:
<gazebo reference="${name}">
<sensor type="gpu_ray" name="${name}-VLP16">
<pose>0 0 0 0 0 0</pose>
<visualize>false</visualize>
<update_rate>${hz}</update_rate>
<ray>
<scan>
<horizontal>
<samples>${samples}</samples>
<resolution>1</resolution>
<min_angle>${min_angle}</min_angle>
<max_angle>${max_angle}</max_angle>
</horizontal>
<vertical>
<samples>${lasers}</samples>
<resolution>1</resolution>
<min_angle>-${15.0*M_PI/180.0}</min_angle>
<max_angle> ${15.0*M_PI/180.0}</max_angle>
</vertical>
</scan>
<range>
<min>${collision_range}</min>
<max>${max_range+1}</max>
<resolution>0.001</resolution>
</range>
<noise>
<type>gaussian</type>
<mean>0.0</mean>
<stddev>0.0</stddev>
</noise>
</ray>
<plugin name="gazebo_ros_laser_controller" filename="libgazebo_ros_velodyne_gpu_laser.so">
<topicName>${topic}</topicName>
<frameName>${name}</frameName>
<organize_cloud>${organize_cloud}</organize_cloud>
<min_range>${min_range}</min_range>
<max_range>${max_range}</max_range>
<gaussianNoise>${noise}</gaussianNoise>
</plugin>
</sensor>
</gazebo>
In ROS2-Humble / Gazebo Ignition / Fortress, the simulated velodyne lidar config is:
<gazebo reference="${name}_laser">
<sensor name="${name}" type="gpu_lidar">
<update_rate>${update_rate}</update_rate>
<visualize>true</visualize>
<always_on>true</always_on>
<ignition_frame_id>${name}_laser</ignition_frame_id>
<topic>$(arg namespace)/sensors/${name}/scan</topic>
<lidar>
<scan>
<horizontal>
<samples>${samples_h}</samples>
<resolution>1</resolution>
<min_angle>${min_ang_h}</min_angle>
<max_angle>${max_ang_h}</max_angle>
</horizontal>
<vertical>
<samples>${samples_v}</samples>
<resolution>1</resolution>
<min_angle>${min_ang_v}</min_angle>
<max_angle>${max_ang_v}</max_angle>
</vertical>
</scan>
<range>
<min>${min_range}</min>
<max>${max_range}</max>
<resolution>0.01</resolution>
</range>
</lidar>
</sensor>
</gazebo>
Here is a comparison the scans. The environment is slightly different, but the ground is perfectly flat in both cases and the robot is not moving. Top view:
Here is the side view on ROS1, we can see that all points on the ground are perfectly (minor the added noise) aligned on same plane:
Here is the side view on ROS2, we can see that points on the ground are not all on the same plane:
You can download those point clouds here:
Why does the simulated lidar on Gazebo Ignition look so worst than on Gazebo Classic? Am I missing a parameter or is there a better lidar plugin to use?