Heightmap z pose wrong (image)

asked 2014-05-24 12:38:10 -0500

TyNguyen gravatar image

updated 2014-05-24 12:53:19 -0500

Hi, i'm having problem regarding heightmap's z coordinate. To create a road with some slopes, i create a 257x257 heightmap image with pixel values as following(in Matlab):

  1. First flat part AB: a 257x60 matrix of 1's

  2. The up slope part BC: a 257x197 matrix with values proportional to pixel order and slope angle. For i = 1: 197, value = tan(phi)*i

  3. Normalize the whole pixel values by a factor equal to the max value. For i = 1:257, value = value/max(all value)

image here

Finally, i import this heightmap image into the world. Though it could make a slope, the slope angle is bigger as i expected. (And i wonder why with a same pixel's value of for example 0.5 in heightmap image, gazebo displays different z height with different heightmap images). Is there any other method to control the height of terrain or how to solve this problem? I get stuck in this for a very long time. Thanks for your reply.

edit retag flag offensive close merge delete


Finally, i found the answer. This problem was caused by wrong grayscale image generation.

TyNguyen gravatar imageTyNguyen ( 2014-05-28 12:06:13 -0500 )edit