Proper way to set the size.z of <heightmap><size></size><heightmap>

asked 2020-07-27 16:23:42 -0500

To put things into context I have a DEM stored in a geotiff with proper gdal metadata set, I am using Gazebo9.

Let's say the DEM has max_elevation of 5.0 and and a min_elevation value of 1.0.

How do I correctly set the value of z_scale value (shown below) if I want to maintain the same height values stored in the dem?

<heightmap><size>desired_width desired_height z_scale</size></heightmap>

By examining https://github.com/osrf/gazebo/blob/g... and https://github.com/osrf/gazebo/blob/g... gazebo seems to use the following formula (max_elevation-min_elevation)/max_elevation, this means that z_scale would be (5.0-1.0)/5.0=0.8.

I read somewhere that I should be using the formula max_elevation-min_elevation which mean the z_scale value would 5.0-1.0=4.0. Is this correct?

Also how much reliable is the GDAL metadata parsing code within Gazebo9. Can I just rely on that?

edit retag flag offensive close merge delete