Skip to content
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

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

Merged
merged 5 commits into from
Feb 20, 2024

Conversation

diegoferigo
Copy link
Member

@diegoferigo diegoferigo commented Feb 19, 2024

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:

Copy link
Contributor

@flferretti flferretti left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM!

@traversaro
Copy link
Contributor

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
Copy link
Member Author

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.

@diegoferigo diegoferigo merged commit 79e83d6 into main Feb 20, 2024
4 checks passed
@diegoferigo diegoferigo deleted the feature/colors branch February 20, 2024 07:54
@traversaro
Copy link
Contributor

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants