Home | Tutorials | Wiki | Issues
Ask Your Question

Revision history [back]

You can create a material script, and then use that material script on a ground plane.

  1. Create a new model directory:

    mkdir ~/.gazebo/models/my_ground_plane

  2. Create the materials directories:

    mdkir -p ~/.gazebo/models/my_ground_plane/materials/textures mdkir -p ~/.gazebo/models/my_ground_plane/materials/scripts

  3. Create your material script file:

    vim ~/.gazebo/models/my_ground_plane/materials/scripts/my_ground_plane.material

  4. Copy in the following contents:

    material MyGroundPlane/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 MyImage.png
        filtering trilinear
      }
    }
    

    } }

  5. Copy your image to ~/.gazebo/models/my_ground_plane/materials/textures/MyImage.png

  6. Create a ~/.gazebo/models/my_ground_plane/model.sdf file with the following contents

    <sdf version="1.4"> <model name="my_ground_plane"> <static>true</static> <link name="link"> <collision name="collision"> <geometry> <plane> <normal>0 0 1</normal> <size>100 100</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>100 100</size> </plane> </geometry> <material> <script> <uri>model://my_ground_plane/materials/scripts/my_ground_plane.material</uri> <name>MyGroundPlane/Image</name> </script> </material> </visual> </link> </model> </sdf>

  7. Create a ~/.gazebo/models/my_ground_plane/model.config file with the following contents


    <model> <name>My Ground Plane</name> <version>1.0</version> <sdf version="1.4">model.sdf</sdf>

    <description> My textured ground plane. </description> </model>

  8. In your world SDF file, use your ground plane like so:

    <include> <uri>model://my_ground_plane</uri> </include>

You can create a material script, and then use that material script on a ground plane.

  1. Create a new model directory:

    mkdir ~/.gazebo/models/my_ground_plane

  2. Create the materials directories:

    mdkir -p ~/.gazebo/models/my_ground_plane/materials/textures mdkir -p ~/.gazebo/models/my_ground_plane/materials/scripts

  3. Create your material script file:

    vim file ~/.gazebo/models/my_ground_plane/materials/scripts/my_ground_plane.material

  4. Copy in with the following contents:

 material MyGroundPlane/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

0.5

          texture_unit
   {
     texture MyImage.png
     filtering trilinear
   }
 }
      }
    }

} }

  1. Copy your image to ~/.gazebo/models/my_ground_plane/materials/textures/MyImage.png

  2. Create a ~/.gazebo/models/my_ground_plane/model.sdf file with the following contents

    <?xml version="1.0"?>
    <sdf version="1.4">
     <model name="my_ground_plane">
       <static>true</static>
        <link name="link">
          <collision name="collision">
            <geometry>
              <plane>
                <normal>0 0 1</normal>
                <size>100 100</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>100 100</size>
              </plane>
            </geometry>
            <material>
              <script>
                <uri>model://my_ground_plane/materials/scripts/my_ground_plane.material</uri>
                <name>MyGroundPlane/Image</name>
              </script>
            </material>
          </visual>
        </link>
      </model>
    </sdf>

    </sdf>
  3. Create a ~/.gazebo/models/my_ground_plane/model.config file with the following contents


    <model> <name>My Ground Plane</name> <version>1.0</version> <sdf version="1.4">model.sdf</sdf>

    <description>
       My textured ground plane.
     </description>
    

    </model>

  4. In your world SDF file, use your ground plane like so:

    <include>
      <uri>model://my_ground_plane</uri>
    </include>

    </include>

Update: Also check out this tutorial.

You can create a material script, and then use that material script on a ground plane.

  1. Create a new model directory:

    mkdir ~/.gazebo/models/my_ground_plane

  2. Create the materials directories:

    mdkir -p ~/.gazebo/models/my_ground_plane/materials/textures mdkir -p ~/.gazebo/models/my_ground_plane/materials/scripts

  3. Create your material script file ~/.gazebo/models/my_ground_plane/materials/scripts/my_ground_plane.material with the following contents:

    material MyGroundPlane/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 MyImage.png
            filtering trilinear
          }
        }
      }
    }
  1. Copy your image to ~/.gazebo/models/my_ground_plane/materials/textures/MyImage.png

  2. Create a ~/.gazebo/models/my_ground_plane/model.sdf file with the following contents

    <?xml version="1.0"?>
    <sdf version="1.4">
    <model name="my_ground_plane">
      <static>true</static>
        <link name="link">
          <collision name="collision">
            <geometry>
              <plane>
                <normal>0 0 1</normal>
                <size>100 100</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>100 100</size>
              </plane>
            </geometry>
            <material>
              <script>
                <uri>model://my_ground_plane/materials/scripts/my_ground_plane.material</uri>
                <name>MyGroundPlane/Image</name>
              </script>
            </material>
          </visual>
        </link>
      </model>
    </sdf>
    
  3. Create a ~/.gazebo/models/my_ground_plane/model.config file with the following contents


    <model> <name>My Ground Plane</name> <version>1.0</version> <sdf version="1.4">model.sdf</sdf>

    <description>
      My textured ground plane.
    </description>
    

    </model>

  4. In your world SDF file, use your ground plane like so:

    <include>
      <uri>model://my_ground_plane</uri>
    </include>