This gazebo plugin creates and publishes to ROS2 (Rolling) a grid_map with elevation and occupancy and a octomap representing the 3D space
<plugin name='gridmap' filename='libgazebo_ros_gridmap.so'>
<ros>
<namespace>demo</namespace>
</ros>
<center_x>0.0</center_x>
<center_y>0.0</center_y>
<min_scan_x>-10.0</min_scan_x>
<min_scan_y>-10.0</min_scan_y>
<min_scan_z>-10.0</min_scan_z>
<max_scan_x>10.0</max_scan_x>
<max_scan_y>10.0</max_scan_y>
<max_scan_z>10.0</max_scan_z>
<min_height>0.2</min_height>
<max_height>1.5</max_height>
<resolution>0.1</resolution>
</plugin>
Provided by @miggsant