How to use custom OGRE materials in URDF in ROS Indigo that displays in Gazebo?
Hi everyone
I want to create a custom OGRE material file, store it in my ROS Indigo package, and have my robot's visual in Gazebo use these materials.
I don't want to use SDF (I know how to; in fact, I learned SDF before URDF).
Here's what I tried and the results I got:
Using Gazebo's built in materials work.
<gazebo reference="…"> <material>Gazebo/Yellow</material> </gazebo>
Adding materials to Gazebo's built in materials file at
/usr/share/gazebo-2.2/media/materials/scripts/gazebo.material
also works.- This didn't work. It's for ROS Fuerte and Gazebo 1, so I had to make some changes:
roscreate-pkg gazebo_tutorials std_msgs rospy roscpp gazebo
failed becauseERROR: dependency [gazebo] cannot be found
. I installed throughapt-get
every package that hadgazebo
in the name, but that didn't fix it. So, instead, I replacedgazebo
by all packages returned byrospack list
that started withgazebo
. Only after the package was created that I realized it was the command to generate the old package format. This and this pages confirm thatrospack find gazebo
used to work in the past and doesn't anymore. So I created a new package and replaced the<depend>
tags by<build_depend>
,<buildtool_depend>
and<run_depend>
.- I tried with
<gazebo gazebo_media_path="${prefix}" />
but, when launching the package,Warning [Visual.cc:819] Unable to get Material[…] for Geometry[…. Object will appear white
. Then I replaced${prefix}
by the full path to where my….material
file was located; same result.
- The first snippet from the answer to this question results in
Warning [Visual.cc:819] Unable to get Material[script] for Geometry[…. Object will appear white
. Note it saysscript
instead of the material name. I tried several variations for<uri>
's argument. - This confirmed a suspicion that the
….material
file must be inside aMedia
folder, so I'm testing with and without it. - This led me
- here, but adding the
<env>
tag to the launch file also didn't work. Becausefind gazebo
doesn't work anymore, I'm using"$GAZEBO_RESOURCE_PATH:$(find …)"
. I'm not certain if it makes sense. - and here. There's two
….material
files and one….urdf
file that uses one of those materials, but this file isn't used anywhere. Also, the syntax is strange. It says<material>b21.material</material>
, which is the name of the file, but the materials defined there are namedb21_base_dark
andb21_base_blue
. These names aren't used anywhere. I also tried to place my….material
file in the fullMedia/materials/scripts
path as is used by this package.manifest.xml
only confirms to me that"${prefix}"
is correct, but I don't know what's the impact of not having thegazebo
package anymore.
- here, but adding the
- I don't mind using a colored Collada file if it worked. I applied random face colors with MeshLab. Mesh is still white. In RViz, it's a darker gray. Adding an
<ambient>
tag as per here ...
It works on Lunar. I've updated the first post. I still want to make it work in Indigo.
I've created a test package and updated the first post.
I've added tests, a fix and an image of what I'm getting now, and updated the first post.