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

Adding methods for handling primitive shapes to MeshcatVisualizer #1117

Merged
merged 7 commits into from
Oct 16, 2023

Conversation

G-Cervettini
Copy link
Contributor

Adding methods to MeshcatVisualizer.cpp wrapper of meshcat-cpp to draw basic geometries.

@CLAassistant
Copy link

CLAassistant commented Sep 26, 2023

CLA assistant check
All committers have signed the CLA.

Comment on lines 61 to 65
bool setSphere(const std::string &name,
const iDynTree::Position &position,
const double radius,
const iDynTree::VectorFixSize<3> &color);

Copy link
Member

Choose a reason for hiding this comment

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

In theory, you should implement two functions. One for loading a sphere and one for set it in space.

Following what is done in MeshcatVisualizer (python version) you may have

https://github.com/robotology/idyntree/blob/c453ba094a707ab6399eeda740922bdc9cf94a84/bindings/python/visualize/meshcat_visualizer.py#L486C5-L491C10

for loading a sphere and

https://github.com/robotology/idyntree/blob/c453ba094a707ab6399eeda740922bdc9cf94a84/bindings/python/visualize/meshcat_visualizer.py#L391C1-L400C1

for setting its pose

Copy link
Member

Choose a reason for hiding this comment

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

Moreover I would implement also the version with Span and MatrixView

const std::string msg = "world_T_base needs to be a 4x4 matrix. Provided a "
+ std::to_string(world_T_base.rows()) + "x"
+ std::to_string(world_T_base.cols()) + " matrix.";
const std::string msg = "world_T_base needs to be a 4x4 matrix. Provided a " + std::to_string(world_T_base.rows()) + "x" + std::to_string(world_T_base.cols()) + " matrix.";
Copy link
Member

Choose a reason for hiding this comment

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

I would avoid having so long lines in the code

Comment on lines 72 to 76
bool setPrimitiveGeometryTransform(const iDynTree::Transform &world_T_geometry,
const std::string &geometryName);

bool setPrimitiveGeometryTransform(const iDynTree::MatrixView<const double> &world_T_geometry,
const std::string &geometryName);
Copy link
Member

Choose a reason for hiding this comment

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

Can you add the documentation?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

It is available with the last commit 09cdd73. I added 1 comment for both implementations. Do I have to duplicate it?

Copy link
Member

Choose a reason for hiding this comment

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

I think yes since they are rendered by doxygen to generate the documentation

Copy link
Member

Choose a reason for hiding this comment

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

I think yes since they are rendered by doxygen to generate the documentation

Copy link
Member

Choose a reason for hiding this comment

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

There is also a way for Doxygen to automatically insert the doc of another method, but for sure the easiest fix is to duplicate.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

With this commit 798df73 everything should be settled. Let me know if any other edit is required @GiulioRomualdi @traversaro.

@traversaro traversaro self-requested a review October 14, 2023 15:19
@traversaro
Copy link
Member

@GiulioRomualdi is this ok for you?

@GiulioRomualdi
Copy link
Member

Yes! 🟢 flag for me!

@traversaro traversaro changed the title Adding set_sphere method Adding methods for handling primitive shapes to MeshcatVisualizer Oct 16, 2023
@traversaro
Copy link
Member

Ok, I updated the PR title to reflect its current content. cc @G-Cervettini

@traversaro traversaro merged commit 03c5cf5 into robotology:master Oct 16, 2023
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.

4 participants