ROS Resources: Documentation | Support | Discussion Forum | Index | Service Status | ros @ Robotics Stack Exchange
Ask Your Question

Revision history [back]

You need to diffuse the image across the visual of your "wall" model. it might be tedious to not have a stretched image, but this is the way you can do it. Here is some sample code:

inside your .gazebo/models/awesome_wall/ create a materials folders which will have two folders 'scripts' and 'textures'. Place your .png in the textures, and in the scripts folder create a file called wall.material which you then open and put the follow code:

material awesome_wall/wall
{
 receive_shadows on
    technique
    {
            pass
            {
                    ambient 0.8 1.0 0.8 1.0
                    diffuse 0.8 1.0 0.8 1.0
                    specular 0.1 0.1 0.1 1.0 12.5

                    texture_unit
                    {
                            texture map_gazebo.png
                    }
            }
    }
}

After you do that, go into your sdf and replace it with this:

<?xml version="1.0" ?>
<sdf version="1.4">
  <model name="awesome_wall">
    <static>true</static>
    <link name="link">
      <pose>0 0 0 0 0 0</pose>
      <must_be_base_link>1</must_be_base_link>
      <collision name="collision">
         <geometry>
           <box>
             <size>1 1 0.005</size>  <!-- adjust this to whatever you want -->
          </box>
         </geometry>
       </collision>
       <visual name="visual">
           <cast_shadows>false</cast_shadows>
           <geometry>
             <box>
                <size>1 1 0.005</size>  <!-- same size as collision -->
            </box>
          </geometry>
          <material>
            <script>
                <uri>model://igvc/materials/scripts</uri>
                <uri>model://igvc/materials/textures</uri>
                <name>awesome_wall/wall</name>
            </script>
          </material>
         </visual>
        </link>
      </model>
    </sdf>

Ofcourse replace awesome_wall with whatever you folder is called