-
Notifications
You must be signed in to change notification settings - Fork 67
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 the possibility to display the arrows in MeshcatVizualizer #1087
Conversation
Hi Giulio, I was reading your implementation of the rotation matrix In this case the rotation matrix can be computed as: With this formulation, there is no singularity in You can also avoid to compute the cross product but I don't know which computation is better. |
Hi @rob-mau thank you for the hint. However, I think we still need an if indeed in case |
transform[3, 3] = 1 | ||
|
||
if np.linalg.norm(vector) < 1e-6: | ||
warnings.warn("The vector is too small to be visualized.", category=UserWarning, stacklevel=2) |
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.
Is there something less than warning? It often happens that you don't care too much about the length of the arrow before displaying it. Having a warning continuously printed might be annoying
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 agree, if you display data from a sensor (i.e. force sensor) it makes total sense to have a near 0 value, there is any other reason to have this print/check?
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.
Done 4bdfa9c
Btw, you can also compute the relative rotation by simply computing the corresponding axis and angle that align the two vectors. The first can be computed via the cross product, the second via the dot product. Since we are already loading iDynTree bindings, it may make sense to use directly the builtin function in iDynTree:
I did the same for the visualization of vectors in the iDynTree visualizer: idyntree/src/visualization/src/VectorsVisualization.cpp Lines 40 to 45 in 4de2bf4
|
Yes, the singularity in |
…r is less than a tolerance
Co-authored-by: Stefano Dafarra <stefano.dafarra@gmail.com>
@GiulioRomualdi is this ready to be merged, right? |
yes |
This PR allows you to easily draw arrows in MeshcatVizualizer
The original idea was taken from @rob-mau and generalized to avoid using non-standard datatype.
For instance the following code
draws the following arrow