Gazebo | Ignition | Community
Ask Your Question

problem adding an image as texture to an object

asked 2022-02-16 03:34:50 -0500

user1928 gravatar image

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">
            <normal>0 0 1</normal>
            <size>10 10</size>
      <visual name="visual">
            <normal>0 0 1</normal>
            <size>10 10</size>    </plane>    <mesh>
    </link>   </model> </sdf>

3) contents of model.config

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

4) contents of materials/scripts/aruco_marker.material

material ArucoMarker/Image
      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 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!

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted

answered 2022-02-21 00:01:11 -0500

Veerachart gravatar image

You need to give the <uri> to the materials/scripts and materials/textures directory of your model, so that the material with the given <name> is read and the texture file is found. i.e.


See this model from gazebo as an example

edit flag offensive delete link more


Thanks, it was helpful. I had another bug in my code. As can be seen in my post above, the name tag within the material tag in the visual section of my model.sdf file wasn't matching with the name mentioned in my .material script.

user1928 gravatar imageuser1928 ( 2022-02-21 04:42:49 -0500 )edit

I tried generating the collada (.dae) file with blender but that wasn't required. The one generated with the online convertor (mentioned in my post) was good enough.

user1928 gravatar imageuser1928 ( 2022-02-21 04:45:02 -0500 )edit

Question Tools

1 follower


Asked: 2022-02-16 03:34:50 -0500

Seen: 753 times

Last updated: Feb 21 '22