Gazebo | Ignition | Community
Ask Your Question
0

How add a jpeg file to gazebo

asked 2014-09-26 15:35:03 -0600

this post is marked as community wiki

This post is a wiki. Anyone with karma >75 is welcome to improve it.

Hello, I am working on Gazebo 4 and I want to add a 2D environment consisting of roads, lanes etc.I have made a jpeg file which include all this, how can I add that file in gazebo as world. Thanks

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted
2

answered 2014-09-28 17:40:17 -0600

this post is marked as community wiki

This post is a wiki. Anyone with karma >75 is welcome to improve it.

I just had a similar need - a carpet on the floor. What worked for me was the following (with Gazebo 1.9):

1) In the world file:

<model name='carpet'>
  <link name='link'>
    <visual name='visual'>
      <geometry>
        <box>
          <size>12.88 12.88 0.005</size>
        </box>
      </geometry>
      <material>
        <script>
          <uri>file:///full/path/to/materials.material</uri>
          <name>Materials/Carpet</name>
        </script>
      </material>
    </visual>
  </link>
  <static>1</static>
</model>

2) materials.material file:

material Materials/Carpet
{
  technique
  {
    pass
    {
      ambient 1.0 1.0 1.0 1.0
      diffuse 1.0 1.0 1.0 1.0
      specular 0.2 0.2 0.2 1.0 12.5

      texture_unit
      {
        texture carpet14x14.jpg
        filtering trilinear
      }
    }
  }
}

I pulled this one from somewhere else and just replaced the script name and texture filename.

3) carpet14x14.jpg in the same folder as materials.material

edit flag offensive delete link more

Question Tools

Stats

Asked: 2014-09-26 15:35:03 -0600

Seen: 524 times

Last updated: Sep 28 '14