clemense / yourdfpy

Python parser for URDFs
MIT License
122 stars 13 forks source link

Apply visual colors #7

Closed stephane-caron closed 2 years ago

stephane-caron commented 2 years ago

If I understand correctly, visual materials are currently read and written but not rendered. Loading e.g. the Upkie URDF we get the dark "ninja" version:

upkie-ninja

Trimesh can render materials so getting them to yourdfpy is a matter of plugging the right info. Here is for instance a draft PR to do so (opening the issue here to keep track):

upkie-colored-chassis

Is there an interest to render colors (eventually materials) in yourdfpy?

clemense commented 2 years ago

Oh, that's great, thanks! What do you think is missing to make this a non-draft PR?

stephane-caron commented 2 years ago

Well I hacked the call to apply_visual_color(geom, v) at the first spot I found where it worked, so first I wanted your feedback on whether it makes sense within the overall code :smiley:

There are three aspects to materials from the URDF reference that a visualizer would eventually need to handle: color, texture and named material.

If it makes sense, we could go for it this way:

stephane-caron commented 2 years ago

And https://github.com/clemense/yourdfpy/pull/15 adds support for named materials, so now the Upkie model renders as:

image

Moving the remaining point on textures to https://github.com/clemense/yourdfpy/issues/16 so that we can let the PR close this issue.