Gazebo not loading diffuse texture image

asked 2023-02-06 06:43:48 -0500

robotempire gravatar image

I have a world file generated by a python code. This world file contains a heightmap with texture from images as seen below.

<model name="heightmap">
  <static>true</static>
  <link name="link">
    <visual name="visual_abcedf">
      <geometry>
        <heightmap>
          <use_terrain_paging>false</use_terrain_paging>
          <texture>
            <diffuse>file://materials/textures/grass_color.jpg</diffuse>
            <normal>file://materials/textures/grass_normal.jpg</normal>
            <size>4</size>
          </texture>
          <texture>
            <diffuse>file://materials/textures/dirt_diffusespecular.png</diffuse>
            <normal>file://materials/textures/flat_normal.png</normal>
            <size>1</size>
          </texture>
          <!-- <texture>
            <diffuse>file://materials/textures/grass_color.jpg</diffuse>
            <normal>file://materials/textures/grass_normal.jpg</normal>
            <size>4</size>
          </texture> -->
          <!-- Without this unused 3. texture the blend between the first 2 doesn't work -->
          <texture>
            <diffuse>file://materials/textures/fungus_diffusespecular.png</diffuse>
            <normal>file://materials/textures/flat_normal.png</normal>
            <size>1</size>
          </texture>
          <blend>
            <min_height>0.2</min_height>
            <fade_dist>0.05</fade_dist>
          </blend>
          <!-- <blend>
            <min_height>0.30000000000000004</min_height>
            <fade_dist>0.05</fade_dist>
          </blend> -->
          <!-- Without this unused 3. texture the blend between the first 2 doesn't work -->
          <blend>
            <min_height>4</min_height>
            <fade_dist>5</fade_dist>
          </blend>
          <uri>file://virtual_maize_field_heightmap.png</uri>
          <size>14.94 14.94 0.4</size>
          <pos>0 0 0</pos>
        </heightmap>
      </geometry>
    </visual>
    <collision name="collision">
      <geometry>
        <heightmap>
          <uri>file://virtual_maize_field_heightmap.png</uri>
          <size>14.94 14.94 0.4</size>
          <pos>0 0 0</pos>
        </heightmap>
      </geometry>
    </collision>
  </link>
</model>

When I launch the file that loads the world from the original package where I got the repo, it works fine showing this: image description

But when I use the world file and copy the media files and directory to my own package, it shows this: image description

This means the <uri>file://virtual_maize_field_heightmap.png</uri> worked and was able to load the image but the diffuse and normal could not get the specified path <diffuse>file://materials/textures/grass_color.jpg</diffuse>

I have tried the configuration below in my package.xml but still didn't work:

<export>
<gazebo_ros gazebo_media_path="${prefix}" gazebo_model_path="${prefix}/models" gazebo_resource_path="${prefix}/models" />

</export>

All files directory were duly checked and correct but the textures are not loading while the <uri>file loaded the collision.

edit retag flag offensive close merge delete