Gazebo Including new materials

From The Player Project

(Difference between revisions)
Jump to: navigation, search
Line 94: Line 94:
world files.
world files.
 +
[[Category:Gazebo]]
[[Category:Documentation]]
[[Category:Documentation]]
[[Category:Tutorials]]
[[Category:Tutorials]]

Revision as of 19:48, 13 February 2011

Including new materials in gazebo

This tutorial is a copy of the tutorial written by [Luis Manso] and can be found here [pdf].

When Gazebo is executed it tries to open “~/.gazeborc” in order to read its configuration paths.

The following is its default content:

<?xml version="1.0"?>
<gazeborc>
    <gazeboPath>/usr/local/share/gazebo</gazeboPath>
    <ogrePath>/usr/local/lib/OGRE</ogrePath>
</gazeborc>

From now on it will be assumed that the name of the Gazebo user is USERNAME and that its home directory is /home/USERNAME. Thus USERNAME should be replaced with the corresponding user name.

first step

is to create the directory where the material file and textures will be stored. In this tutorial the directory '~/.gazebo/' will be used. Feel free to use any other directory, but make sure to make the corresponding changes in further steps.

Make sure that /home/USERNAME/.gazeborc exists (do not mistake ~/.gazeborc for ~/.gazebo), and has USERNAME as its owner:

  • If it does not exist it, write the following lines inside it using the unprivileged user that will run gazebo:
<?xml version="1.0"?>
<gazeborc>
  <gazeboPath>/usr/local/share/gazebo</gazeboPath>
  <gazeboPath>/home/USERNAME/.gazebo</gazeboPath>
  <ogrePath>/usr/local/lib/OGRE</ogrePath>
</gazeborc>
  • If it does exist but the user is not USERNAME, change the file owner to USERNAME by running:
sudo chown ~/.gazeborc USERNAME
  • In any case, make sure that the .gazeborc file contains the previous six lines (replacing USERNAME with the regular user name, of course).

second step

Once the .gazeborc file is set, the .gazebo directory must be filled with the following directory tree:

/home/USERNAME/.gazebo/
`-- Media/
    `-- materials/
        |-- scripts/
        `-- textures/

Textures will be placed in '.gazebo/Media/materials/textures/' , and the gazebo material file must be placed in '.gazebo/Media/materials/scripts/' . After storing the texture files in the textures directory and filling the Gazebo.material file, the .gazebo/ directory should look like this:

/home/USERNAME/.gazebo/
`-- Media/
    `-- materials/
        |-- scripts/
        |   `-- Gazebo.material
        `-- textures/
            |-- x.png
            |-- y.png
            `-- z.png

The 'Gazebo.material' file should contain a node for every texture. Entries look like the following:

material TextureName
{
  technique
  {
    pass
    {
      texture_unit
      {
         texture texturename.png
      }
    }
  }
}

In order to know more about material files see: [http://www.ogre3d.org/wiki/index.php/Materials].

At this point, according to the previous example, 'TextureName' should work as material within Gazebo world files.

Personal tools