Gazebo | Ignition | Community
Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

problem adding an image as texture to an object

I want to display an image in the gazebo environment. Looking at a few answers suggested that I've to add an object & lay the image as texture over the object.

I followed what's suggested in the answers of this post, but no avail. Then I created a collada mesh as suggested by this tutorial. Still no luck. The object gets inserted like a grey plane as shown below. image description

What I did until now:

1) I created a directory for the model with the name ~/.gazebo/models/aruco_marker. This is how the folder looks like:

image description

2) contents of model.sdf:

<?xml version="1.0"?> <sdf version="1.4"> <model name="aruco_marker">   <static>true</static>
    <link name="link">
      <collision name="collision">
        <geometry>
          <plane>
            <normal>0 0 1</normal>
            <size>10 10</size>
          </plane>
        </geometry>
        <surface>
          <friction>
            <ode>
              <mu>100</mu>
              <mu2>50</mu2>
            </ode>
          </friction>
        </surface>
      </collision>
      <visual name="visual">
        <cast_shadows>false</cast_shadows>
        <geometry>
          <plane>
            <normal>0 0 1</normal>
            <size>10 10</size>    </plane>    <mesh>
        <uri>model://aruco_marker/materials/textures/4x4_1000-25_side50.dae</uri>
          </mesh>
        </geometry>
        <material>
          <script>
            <uri>model://aruco_marker/materials/scripts/aruco_marker.material</uri>
            <name>MyGroundPlane/Image</name>
          </script>
        </material>
      </visual>
    </link>   </model> </sdf>

3) contents of model.config

<model>
    <name>Aruco Marker</name>
    <version>1.0</version>
    <sdf version="1.4">model.sdf</sdf>
    <description>
        My textured ground plane.
    </description>
</model>

4) contents of materials/scripts/aruco_marker.material

material ArucoMarker/Image
{
  technique
  {
    pass
    {
      ambient 0.5 0.5 0.5 1.0
      diffuse 1.0 1.0 1.0 1.0
      specular 0.0 0.0 0.0 1.0 0.5
      texture_unit
      {
        texture 4x4_1000-25_side50.jpg
        filtering trilinear
      }
    }
  }
}

5) This is the .jpg file: image description

I generated a .dae file for it using an online converter

Any help is greatly appreciated, thanks!