[ros-users] Textures and gazebo materials

John Hsu johnhsu at willowgarage.com
Fri Nov 12 17:39:43 UTC 2010


Possibly your STL model does not have uv coordinates, try this

<?xml version="1.0" ?>
<!-- The trimesh -->
<model:physical name="mesh_skeleton_model">
<xyz>0.0 0.0 0.0</xyz>
<rpy>0 0 0</rpy>
<static>true</static>
<body:trimesh name="mesh_skeleton_model_body">
<xyz>0.0 0.0 0.0</xyz>
<rpy>90.0 0.0 90.0</rpy>
<turnGravityOff>true</turnGravityOff>
<massMatrix>false</massMatrix>
<dampingFactor>0.05</dampingFactor>
<geom:trimesh name="mesh_skeleton_model_geom">
<laserRetro>2000.0</laserRetro>
<kp>100000000.0</kp>
<kd>1.0</kd>
<scale>1.0 1.0 1.0</scale>
<mesh>/home/patrickm/dev/ros/ros_tutorials/my_robot/objects/mesh_full.stl</mesh>
*<genTexCoord>true</genTexCoord>*
<visual>
<scale>0.001 0.001 0.001</scale>
<material>Gazebo/RustySteel</material>
<mesh>/home/patrickm/dev/ros/ros_tutorials/my_robot/objects/mesh_full.stl</mesh>
</visual>
</geom:trimesh>
</body:trimesh>
</model:physical>

Let me know if that helps.
thanks,
John

On Fri, Oct 22, 2010 at 7:53 AM, Patrick McMichael
<patrickm at rec.ri.cmu.edu>wrote:

> Hello,
>
> I apologize beforehand if this question has already been asked and
> answered -- I did not find it in my search(es).
>
> I've been using ROS for a little while now and am trying to set up my
> own world -- things are going pretty well but I keep being thwarted by
> the material constructs in gazebo.
>
> Is there a tutorial somewhere for how to setup your own materials, or
> how to get the built-in materials to use the textures they mention.  For
> example, in `rospack find
> gazebo`/gazebo/share/gazebo/Media/materials/scripts/Gazebo.materials
> there is a material called "Gazebo/RustySteel" defined like this:
>
> material Gazebo/RustySteel
> {
>     technique
>     {
>         pass
>         {
>
>             texture_unit
>             {
>                 texture RustySteel.jpg
>             }
>         }
>     }
> }
>
> I can't seem to find any description on what these things mean, really.
> The texture RustySteel.jpg resides in the `rospack find
> gazebo`/gazebo/share/gazebo/Media/materials/textures directory.  However
> when I try to load this into my own .model file like this:
>
> <?xml version="1.0" ?>
> <!-- The trimesh -->
> <model:physical name="mesh_skeleton_model">
> <xyz>0.0 0.0 0.0</xyz>
> <rpy>0 0 0</rpy>
> <static>true</static>
> <body:trimesh name="mesh_skeleton_model_body">
> <xyz>0.0 0.0 0.0</xyz>
> <rpy>90.0 0.0 90.0</rpy>
> <turnGravityOff>true</turnGravityOff>
> <massMatrix>false</massMatrix>
> <dampingFactor>0.05</dampingFactor>
> <geom:trimesh name="mesh_skeleton_model_geom">
> <laserRetro>2000.0</laserRetro>
> <kp>100000000.0</kp>
> <kd>1.0</kd>
> <scale>1.0 1.0 1.0</scale>
>
> <mesh>/home/patrickm/dev/ros/ros_tutorials/my_robot/objects/mesh_full.stl</mesh>
> <visual>
> <scale>0.001 0.001 0.001</scale>
> <material>Gazebo/RustySteel</material>
>
> <mesh>/home/patrickm/dev/ros/ros_tutorials/my_robot/objects/mesh_full.stl</mesh>
> </visual>
> </geom:trimesh>
> </body:trimesh>
> </model:physical>
>
> ... it just gives me a flat, shadedless brown (where it gets the brown
> from I don't know)
>
> This file is loaded into the world in my launch file like this:
>
> <param name="mesh_skeleton" textfile="$(find
> my_robot)/objects/mesh_skeleton.model" />
> <node name="xml2factor_mesh_skeleton" pkg="gazebo" type="spawn_model"
> args="-gazebo -param mesh_skeleton -x 6.917 -z 1.849 -model
> mesh_skeleton" respawn="false" output="screen" />
>
> I tried adding the lines
>
> <depend package="gazebo"/>
>
> and
>
> <export>
> <gazebo gazebo_media_path="${prefix}" />
> </export>
>
> to my package's manifest.xml file, but they didn't help anything.
> Besides, the flat colors themselves work ok (although they too are
> always flat ambient and don't seem to pay any attention to the shading
> model or diffuse, specular or any other components).
>
> Any ideas what I might be doing wrong?
>
> Thanks,
>
> Patrick
> _______________________________________________
> ros-users mailing list
> ros-users at code.ros.org
> https://code.ros.org/mailman/listinfo/ros-users
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osuosl.org/pipermail/ros-users/attachments/20101112/af03f55e/attachment-0002.html>


More information about the ros-users mailing list