-
Notifications
You must be signed in to change notification settings - Fork 23
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Handle colors in sdf files #57
Comments
Perhaps it is not documented, but apparently the SDF format has the capability of specifying the colors of the material directly in the in the This capabilities seem to be alternative to the However I think it is worth to open an issue in https://bitbucket.org/osrf/sdformat/issues about the confusing documentation of the Other related issues:
|
That way would avoid the installation of an additional script file, simpler is better, true. Although it is not trivial to my eyes how to convert those properties (examples in the Heidelberg model) to the format taken by Gazebo (example here). |
The documentation of the data contained in the MaterialProp tag is given in http://it.mathworks.com/help/physmod/smlink/ref/pmitvismatprop.html . |
From the one-shot experience I had the only time I tried it, I can confirm your thoughts @traversaro |
robotology/simmechanics-to-urdf#28 includes the support to gazebo colors elements as XML blobs. As a reference, this is the simmechanics code: <MaterialProp>
<color>0.666667,0.666667,0.666667</color>
<ambient>0.4</ambient>
<diffuse>0.85</diffuse>
<specular>0.9</specular>
<shininess>0.3</shininess>
<transparency>0</transparency>
<emission>0.35</emission>
</MaterialProp> That is translate to this urdf code: <link name="r_forearm">
...
<visual>
...
<material name="r_forearm_color">
<color rgba="0.666667 0.666667 0.666667 1.0"/>
</material>
</visual>
...
</link>
...
<gazebo reference="r_forearm">
<visual>
<material>
<ambient>0.2666668 0.2666668 0.2666668 1.0</ambient>
<diffuse>0.56666695 0.56666695 0.56666695 1.0</diffuse>
<specular>0.6000003 0.6000003 0.6000003 1.0</specular>
</material>
</visual>
</gazebo> The last snipper of code is then included in Gazebo directly into the |
Where did you find this information? |
It was my very personal understanding of the comments in the parser_urdf.cc. I didn't spend much time on this though. |
Fixing #56 should be enough to handle the
urdf
side, adding something similar to the model:simmechanics:
urdf:
However, this doesn't seem to be enough for Gazebo, which uses OGRE colors. In my opinion using the default colors is not general enough, and it would require setting a kind of map between what is exported from the CAD (or specified in the simmechanics file) to the OGRE color keywords. One of the possible option to overcome this would be adding into the generator toolchain the possibility to generate a custom color file and export it where gazebo can find it.
Eventually, these lines are required in the urdf for importing colors in gazebo:
The resulting sdf would be:
Note that the
media
folder is relative toGAZEBO_RESOURCE_PATH
.cc @traversaro @nunoguedelha
Resources:
The text was updated successfully, but these errors were encountered: