ami-iit / rod

The ultimate Python tool for RObot Descriptions processing.
https://pypi.org/project/rod/
BSD 3-Clause "New" or "Revised" License
14 stars 3 forks source link

Add support of colors when exporting to URDF geometries with material element #27

Closed diegoferigo closed 7 months ago

diegoferigo commented 7 months ago

We use the //visual/material/diffuse SDF element and convert it into the visual/material/color@rgba URDF attribute.

Note that other material properties of SDF are ignored. We cannot work around it since the material properties of URDF are more limited than those of SDF.

Additional information on SDF materials:

traversaro commented 7 months ago

Note that other material properties of SDF are ignored. We cannot work around it since the material properties of URDF are more limited than those of SDF.

Just for completeness: it is probably not worth it, but a way to fully support all SDF materials in URDF is to generate new meshes on the fly in Collada and/or obj format, encode the material information there, and use those material-aware meshes in URDF instead of the meshes used by SDF.

diegoferigo commented 7 months ago

Note that other material properties of SDF are ignored. We cannot work around it since the material properties of URDF are more limited than those of SDF.

Just for completeness: it is probably not worth it, but a way to fully support all SDF materials in URDF is to generate new meshes on the fly in Collada and/or obj format, encode the material information there, and use those material-aware meshes in URDF instead of the meshes used by SDF.

I never saw this done elsewhere, interesting approach! It seems quite convoluted to do by hand, but doable in code and a good candidate in rod. If someone needs full color support, this could be a great workaround to the feature disparity between URDF and SDF.

traversaro commented 7 months ago

I never saw this done elsewhere, interesting approach! It seems quite convoluted to do by hand, but doable in code and a good candidate in rod. If someone needs full color support, this could be a great workaround to the feature disparity between URDF and SDF.

Yes, due to technical difficulties in handing mesh files users and libraries tend to think of meshes as "black box" that can't be modified, while effectively they are part of robots description exactly as the URDF and SDF files.