Generating Heightmap on Gazebo 2.2

asked 2016-06-17 00:10:15 -0600

webvenky gravatar image

I tried generating heightmap to model a terrain. Below is a sample terrain map generated using Gimp (129 x 129) (alpha channel removed).

image description

However I could get only a part of the terrain getting generated.

image description

My model.sdf

<?xml version="1.0" ?>
<sdf version="1.4">
  <model name="heightmap">
    <static>true</static>
    <link name="link">
      <collision name="collision">
        <geometry>
          <heightmap>
            <uri>model://heightmap/materials/textures/heightmap3.png</uri>
            <size>1 1 1</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>
            <texture>
              <diffuse>file://media/materials/textures/grass_diffusespecular.png</diffuse>
              <normal>file://media/materials/textures/flat_normal.png</normal>
              <size>1</size>
            </texture>
            <texture>
              <diffuse>file://media/materials/textures/fungus_diffusespecular.png</diffuse>
              <normal>file://media/materials/textures/flat_normal.png</normal>
              <size>1</size>
            </texture>
            <blend>
              <min_height>2</min_height>
              <fade_dist>5</fade_dist>
            </blend>
            <blend>
              <min_height>4</min_height>
              <fade_dist>5</fade_dist>
            </blend>
            <uri>model://heightmap/materials/textures/heightmap3.png</uri>
            <size>1 1 1</size>
            <pos>0 0 0</pos>
          </heightmap>
        </geometry>
      </visual>
    </link>
  </model>
</sdf>
edit retag flag offensive close merge delete

Comments

While, I won't claim to be all that good at Gazebo, I had this same problem today. I was trying to follow this tutorial: https://vimeo.com/58409707 . However, I got the exact same error that you did where only part of the terrain was showing and I got a Mesh error. What I found to fix this was to make this file a .world file instead of a .sdf file. (I then used a roslaunch file to launch it, but you could launch it probably without a roslaunch file.)

bb gravatar imagebb ( 2016-09-07 19:11:01 -0600 )edit

Does this problem also exist for you on Gazebo 7?

nkoenig gravatar imagenkoenig ( 2016-09-08 09:53:51 -0600 )edit

@bb Yeah, opening it as a world file solves the issue in Gazebo 2.2. Thanks.

webvenky gravatar imagewebvenky ( 2016-09-08 10:20:57 -0600 )edit