-
Notifications
You must be signed in to change notification settings - Fork 71
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
[model_io] Fix the color parsing in the model_io #961
Conversation
Once `VisualElement::childElementForName` is called with input equal to 'material' a pointer to the material info is stored inside the VisualElement.
Great, quite a clean fix. Can you add a line on the CHANGELOG? If you plan to work on robotology/icub-models-generator#216 we can wait for that also to be ready and merge/release both things together, otherwise no problem, we can merge this and enjoy a colorful iCub! |
By the way, checking the CI failure, the bugfix revealed a bug in the test models that was "hidden" by this bug:
Can you fix the vendored |
I looked into the idyntree/src/tests/data/iCubGenova02.urdf Line 1394 in cbb0bf5
r_foot (see idyntree/src/tests/data/iCubGenova02.urdf Line 1394 in cbb0bf5
/home/runner/work/idyntree/idyntree/src/tests/data/iCubGenova02.urdf model.
|
Hi, @traversaro I think it's easier to fix the model. Should update the model to the latest one stored in icub-models? |
You can try. |
After a short discussion with @traversaro, we decided to fix directly the |
The PR introduces also the
a webpage with the visualizer will be automatically opened Since robotology/icub-models-generator#217 has been merged the robots will be displayed as follows
|
@@ -0,0 +1,37 @@ | |||
#!@Python3_EXECUTABLE@ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This will hardcode the python executable used at build time in this script. Do you have any specific reason for which you do not want to use the usual Python3 shebang?
#!@Python3_EXECUTABLE@ | |
#!/usr/bin/env python3 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I was thinking if a virtual enviroment
is used
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
For that using /usr/bin/env python3
should work fine.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ok! perfect!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hi @traversaro, 3c9e243 should implement what you suggested
Can you update the changelog? |
2c7cff1
to
3c9e243
Compare
Done in 69378f6 I opened this PR on |
69378f6
to
023550a
Compare
Co-authored-by: Silvio Traversaro <[email protected]>
@GiulioRomualdi can I merge or you want to do further changes? |
Feel free to merge it |
Once
VisualElement::childElementForName
is called with input equal to 'material' a pointer to thematerial info is stored inside the VisualElement.
Rationale
Differently from
GeometrcElement
, the constructor ofMaterialElement
takes as input a copy ofstd::shared_ptr<MaterialInfo>
and not a reference to a shared pointeridyntree/src/model_io/urdf/src/MaterialElement.cpp
Lines 23 to 30 in cbb0bf5
For this reason in the following line
idyntree/src/model_io/urdf/src/VisualElement.cpp
Line 51 in cbb0bf5
Since
m_info.m_material = nullptr
andMaterialElement
copies the value,m_info.m_material
was not updated byif (!m_info) { m_info = std::make_shared<MaterialInfo>(); }
Passing a reference to a shared ptr cannot solve the problem in this particular case. Indeed given the following code:
idyntree/src/model_io/urdf/src/RobotElement.cpp
Lines 53 to 56 in cbb0bf5
the compiler will complain since
nullptr
is ar-value
and it cannot be converted into al-value
.Outcome of the PR
This is how Talos is now displayed with
meshcat
irrlicht
For iCub there is the usual problem with the colors
meshcat
irrlicht