Robotics StackExchange | Archived questions

How to create wall in gazebo from a grayscale image?

Hello, as explained in the question, I'm trying to create walls in Gazbo from a grayscale image that I have. I used he Image tags in SDF :

<sdf version="1.4">
<model name="institut">


    <link name="link">
    <visual name="instiut">
    <geometry>
    <image>
    <uri>model://institut/materials/map_gazebo.png</uri>
    <height>2.0</height>
    <scale>10.0</scale>
    <threshold>250</threshold>
    <granularity>1</granularity>
    </image>
    </geometry>
    </visual>

    <collision name ="coll">
    <geometry>
    <image>
    <uri>model://institut/materials/map_gazebo.png</uri>
    <height>2.0</height>
    <scale>10.0</scale>
    <threshold>250</threshold>
    <granularity>1</granularity>
    </image>
    </geometry>
    </collision>

    </link>
  </model>
</sdf>

There is no error or warning when inserting the model in Gazebo, but nothing appears. (The model name is listed in the inserted models list)

Can anyone spot an error or had anyone some experience with this? Thanks.

Asked by SouheilDehmani on 2014-10-28 12:25:30 UTC

Comments

Please see this answer http://answers.ros.org/question/196083/gazebo-30-problem/. Gazebo questions should better be asked on its designated forum.

Asked by 130s on 2014-10-29 01:08:20 UTC

That's http://answers.gazebosim.org

Asked by tfoote on 2014-10-29 19:58:55 UTC

Answers

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

Asked by l0g1x on 2014-10-29 12:31:12 UTC

Comments