Closed GiulioRomualdi closed 2 years ago
I also noticed that when the tag is <color>
is actually this:
Indeed for a MaterialElement
if the tag is color
the setAttributeCallback
is called with a lambda function
So in theory m_info->m_rgba
should be correctly initialized and it should contain the color of the link
Probably the cirrect support for parsing color
needs to be implemented in the URDF parser, as you noted. Furthermore, the visualizer(s) need to be modified to properly take into account this.
Some notes to keep into account while working on this:
.stl
).This may be related to this TODO: https://github.com/robotology/idyntree/blob/cbb0bf5e593b7add489bccb7dd3ba5054b200573/src/model_io/urdf/src/RobotElement.cpp#L55 . Perhaps @francesco-romano may recall something on this.
I would say I did not expect it to be used (or it was not implemented in the old parser and I did not add it in the new)
A first fix (for material colors defined in visual --> material --> color elements, not in robot --> color) is provided in https://github.com/robotology/idyntree/tree/fixURDFMaterials .
When I try to load the talos robot stored in
example-robot-data
the robot link colors are not setThe same is valid for the meshcatvisualizer
However, the
urdf
file contains the colors.On the other hand using
gepetto-visualizer
the colors are correctly loadedI try to debug the problem and I noticed that iDynTree XMLParser is able to find the
<color>
attributehowever
visual.m_material
seems to be not initialized indeed if I addhere:
https://github.com/robotology/idyntree/blob/db312bfe9f490f991250603f05cea84a8c156899/src/model_io/urdf/src/URDFDocument.cpp#L345-L346
I got
for all robot's links
The very same problem happens also for
icub