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

How to create wall in gazebo from a grayscale image? [closed]

asked 2014-10-28 12:25:30 -0500

SouheilDehmani gravatar image

updated 2014-10-29 04:08:58 -0500

gvdhoorn gravatar 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.

edit retag flag offensive reopen merge delete

Closed for the following reason question is off-topic or not relevant. Please see http://wiki.ros.org/Support for more details. by tfoote
close date 2014-10-29 19:58:33.828410

Comments

1

Please see this answer http://answers.ros.org/question/19608... . Gazebo questions should better be asked on its designated forum.

130s gravatar image 130s  ( 2014-10-29 01:08:20 -0500 )edit
tfoote gravatar image tfoote  ( 2014-10-29 19:58:55 -0500 )edit

1 Answer

Sort by ยป oldest newest most voted
1

answered 2014-10-29 12:31:12 -0500

l0g1x gravatar image

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

edit flag offensive delete link more

Question Tools

1 follower

Stats

Asked: 2014-10-28 12:25:30 -0500

Seen: 2,904 times

Last updated: Oct 29 '14