Height scale when using png image as heightmap
I have been analysing how gazebo (v7.0) renders a png image when included as heightmap in a world file.
Assuming we have a 513x513 8bit png where its maximum value is 127 and its minimum 0. When I indicate the size of the collision/geometry element as 10 10 0.5:
<collision name="collision">
<geometry>
<heightmap>
<uri>model://worlds/steps.png</uri>
<size>10 10 0.5</size>
<pos>0 0 0</pos>
</heightmap>
</geometry>
</collision>
(Note: I indicate the same size in the visual/geometry/heightmap element of the world file)
I expect the image to be rendered as a 10 x10m map with a maximum height value of 0.5 meters. However it maximum height is around 0.25m. Documentation mentions that the size either for collision or visual elements for a heightmap indicates the scale the heightmap to which it will be rendered in gazebo. It properly renders width and length but height seems unreliable. Am I missing something regarding how Z element in size is treated?
I have analysed other maps (same png size but different max/min values) and some times I get the height properly rendered, specially when the max value in the png is 255 and I want to render it to 1.0m.
This is the full world file:
<?xml version="1.0" ?>
<sdf version="1.4">
<world name="default">
<include>
<uri>model://sun</uri>
</include>
<model name="heightmap">
<static>true</static>
<link name="link">
<collision name="collision">
<geometry>
<heightmap>
<uri>model://worlds/steps.png</uri>
<size>10 10 0.5</size>
<pos>0 0 0</pos>
</heightmap>
</geometry>
</collision>
<visual name="visual_abcedf">
<geometry>
<heightmap>
<use_terrain_paging>false</use_terrain_paging>
<texture>
<diffuse>file://media/materials/textures/dirt_diffusespecular.png</diffuse>
<normal>file://media/materials/textures/flat_normal.png</normal>
<size>1</size>
</texture>
<uri>model://worlds/steps.png</uri>
<size>10 10 0.5</size>
<pos>0 0 0</pos>
</heightmap>
</geometry>
<material script='Gazebo/White'>
<emissive rgba='1.0 1.0 1.0 1.0'/>
</material>
</visual>
</link>
</model>
</world>
</sdf>
Asked by romarcg on 2019-02-26 07:41:12 UTC
Comments