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

Discuss about simplifying collision meshes for the finger links #199

Closed
PasMarra opened this issue Dec 6, 2023 · 24 comments
Closed

Discuss about simplifying collision meshes for the finger links #199

PasMarra opened this issue Dec 6, 2023 · 24 comments
Assignees
Labels
domain-software Related to Software prj-ergocub Related to ErgoCub Project team-fix Related to Team Fix

Comments

@PasMarra
Copy link

PasMarra commented Dec 6, 2023

grasp_contacts.mp4

Hello everyone,
I'm trying to grasp an object with ergoCub in simulation and, as you can see in the above video, the Real Time Factor drops to 0.08-0.10 as soon as the object is grasped.
Currently, the collision meshes are the same ones used for visual purposes:

<collision>
<origin xyz="0 0 0" rpy="0 -0 0"/>
<geometry>
<mesh filename="package://ergoCub/meshes/simmechanics/sim_ecub_1-1_r_hand_thumb_1.stl" scale="0.001 0.001 0.001"/>

and this may be the reason of such a high computational burden.
Would it be possible to discuss on the possibility to replace them with simpler geometrical shapes, e.g. cylinders, or a simplified version with less faces and vertices - that can be obtained, e.g., with Meshlab?

Notice that this substitution was also done on the iCubGazeboV2_5_visuomanip

cc: @Nicogene @xEnVrE

@traversaro
Copy link
Member

For reference, we are doing something similar with the feet, see #180 .

@xEnVrE
Copy link
Contributor

xEnVrE commented Dec 6, 2023

Thanks for the comment @traversaro , maybe we could try regenerating the model using cylinders with the automated machinery and check if that helps before testing more advanced solutions such as mesh semplification.

Are there instructions on how to run the model generation machinery locally so that we can test that together with @PasMarra after having changed the yaml files?

Thank you

@traversaro
Copy link
Member

Are there instructions on how to run the model generation machinery locally so that we can test that together with @PasMarra after having changed the yaml files?

I guess you will need a machine with creo, as now the generation is happening with creo2urdf. @Nicogene probably knows more. However, as a first step you can manually modify the meshes of the link, and you are done with we can look in automatizing the process.

@Nicogene
Copy link
Member

Nicogene commented Dec 7, 2023

Thanks for the comment @traversaro , maybe we could try regenerating the model using cylinders with the automated machinery and check if that helps before testing more advanced solutions such as mesh semplification.

Are there instructions on how to run the model generation machinery locally so that we can test that together with @PasMarra after having changed the yaml files?

Thank you

Yes you need first to install creo2urdf first (either from sources or from binaries), and then run it within creo. If you want I can press the button for you for this quick test.

If using cylinders as simplified geometries is not enough @mfussi66 and I could investigate if we can approximate the meshes with convex hulls using Creo APIs or something else, adding an extra option for it

@PasMarra
Copy link
Author

If you want I can press the button for you for this quick test.

Hi @Nicogene, unfortunately we don't have creo and we have never used it, so we cannot do the procedure. Could you please test the first option with cilinders for us, so that we can test our pipeline again?

@Nicogene Nicogene self-assigned this Dec 14, 2023
@Nicogene Nicogene added domain-software Related to Software prj-ergocub Related to ErgoCub Project team-fix Related to Team Fix labels Dec 14, 2023
@Nicogene
Copy link
Member

Nicogene commented Dec 14, 2023

Hi @Nicogene, unfortunately we don't have creo and we have never used it, so we cannot do the procedure. Could you please test the first option with cilinders for us, so that we can test our pipeline again?

Yes sure, it would be super if you can provide to me the lenght and radius of the cylinders you prefer for the fingers' links, otherwise, I will calculate them measuring on the CAD

@PasMarra
Copy link
Author

I will calculate them measuring on the CAD

For the time being I don't have a particular preference, so I think that this option is the best..

Nicogene added a commit that referenced this issue Dec 18, 2023
For augmenting the real time factor we used to simplify the collision geometry of the fingers with cylinders. The measures have been taken roughtly from the CAD. It fixes #199
@Nicogene
Copy link
Member

@PasMarra @xEnVrE I made the changes you requested:

Could you please see if now when grasping the rtf is ok?

@xEnVrE
Copy link
Contributor

xEnVrE commented Dec 18, 2023

Yes, @PasMarra is going to test it asap! :)

@PasMarra
Copy link
Author

PasMarra commented Dec 18, 2023

Hi @Nicogene, I wanted to test your changes #205 (comment), but there is something I would like to point out:

  • The changes have been applyed only to the left hand, but I need both of them;

Screenshot from 2023-12-18 17-23-48

  • The cylinders are not aligned with the fingers, so I would ask you to change their pose. By doing so, please be sure that, for each phalanx, the cylinder is tangent to the visual mesh at least on the finger's inner side.

Screenshot from 2023-12-18 17-42-05

Thank you.

@PasMarra
Copy link
Author

@Nicogene

Given that, in the future, the fingertips will play an active role in the grasp, I would also ask you to replace the cylinders with a convex hull as collision mesh. Thank you.

Nicogene added a commit that referenced this issue Dec 19, 2023
For augmenting the real time factor we used to simplify the collision geometry of the fingers with cylinders. The measures have been taken roughtly from the CAD. It fixes #199
Nicogene added a commit that referenced this issue Dec 19, 2023
For augmenting the real time factor we used to simplify the collision geometry of the fingers with cylinders. The measures have been taken roughtly from the CAD. It fixes #199
@Nicogene
Copy link
Member

Hi @PasMarra, I realized that I run creo2urdf with an unsaved yaml, sorry for the unconvenience.
I committed the right one with the correct urdf, I pushed forced then you have to do pull --rebase.

Right now this is the situation
immagine

Given that, in the future, the fingertips will play an active role in the grasp, I would also ask you to replace the cylinders with a convex hull as collision mesh. Thank you.

For this feature, we need to schedule a more consistent activity since this is a feature that is missing in creo2urdf.

Let's see if these simplified collisions allow us to do a decent grasp reducing the rtf, if it doesn't work we will focus on implementing the exportation of the convex hull.

cc @xEnVrE @pattacini

@xEnVrE
Copy link
Contributor

xEnVrE commented Dec 19, 2023

Thanks for the update @Nicogene. It seems to me that the proximal link of the thumb is still missing a collision volume:

image

Is it the case or is it just a visualization glitch? Thank you

Nicogene added a commit that referenced this issue Dec 19, 2023
For augmenting the real time factor we used to simplify the collision geometry of the fingers with cylinders. The measures have been taken roughtly from the CAD. It fixes #199
Nicogene added a commit that referenced this issue Dec 19, 2023
For augmenting the real time factor we used to simplify the collision geometry of the fingers with cylinders. The measures have been taken roughtly from the CAD. It fixes #199
@Nicogene
Copy link
Member

Is it the case or is it just a visualization glitch? Thank you

It was actually an error on the displacement of the r_thumb_2 collision that for some reason has to have the opposite sign with respect to the others, maybe the link frame is differently oriented?

Anyhow changing the sign of the xyz of the origin fixes the problem.

immagine

@xEnVrE
Copy link
Contributor

xEnVrE commented Dec 19, 2023

Thanks @Nicogene, I guess @PasMarra will make some tests using the latest URDF and let us know!

@Nicogene
Copy link
Member

Nicogene commented Dec 19, 2023

maybe the link frame is differently oriented?

Actually, yes there is a problem in the link frame:

Right thumb

immagine

Left thumb

immagine

This is not creating problems, just to be aware of it

cc @pattacini @fiorisi @Lawproto

@PasMarra
Copy link
Author

Hi @Nicogene, here is the test.

grasp_issue_2.mp4

As you can see, the Real Time Factor still drops substantially.

I would ask you to adjust the length/pose of the distal phalanx for each finger because they protrude out maybe too much, and to move the proximal phalanx collision mesh towards the hand's inner side since currently it is tangent to the external side.

On my part, I will simplify the bottle's mesh.

@Nicogene
Copy link
Member

I would ask you to adjust the length/pose of the distal phalanx for each finger because they protrude out maybe too much, and to move the proximal phalanx collision mesh towards the hand's inner side since currently it is tangent to the external side.

Ok for me, it is strange that using cylinders didn't improve the rtf, let's see if with these tweaks it is adjusted a bit

Nicogene added a commit that referenced this issue Dec 19, 2023
For augmenting the real time factor we used to simplify the collision geometry of the fingers with cylinders. The measures have been taken roughtly from the CAD. It fixes #199
@Nicogene
Copy link
Member

I pushed-forced the reduced collisions (remember to pull --rebase)

immagine

@PasMarra
Copy link
Author

PasMarra commented Dec 20, 2023

Hi @Nicogene, the rtf drops even with the bottle's simplified collision mesh. But I think I've found the reason: the palm. From the previous videos you can see that there is always a direct contact between the object and the palm; so, I've tried a grasp with only fingers, i.e. excluding the palm, and as you can see the problem is mitigated. For this reason, I think we should find a way to simplify the palm collision mesh.

grasp_no_palm.mp4

cc @xEnVrE

@Nicogene
Copy link
Member

Here:

I committed the urdf with the palms with simplifyied collisions

immagine

@PasMarra please let me know if now it is fine

@PasMarra
Copy link
Author

Not yet.

291923595-fefa6314-ff23-44a5-abc2-57e0f6efcf01

Could you please simplify also these two? At least the left one.

4rt

I think they may be contributing to the problem:

arrow

@Nicogene

@PasMarra
Copy link
Author

PasMarra commented Dec 20, 2023

As discussed with @Nicogene, we opted for the removal of the two meshes above, since they should not play an important role for the grasp. The problem remains:

Screenshot from 2023-12-20 16-47-31

I would suggest to focus on the palm mesh, which seems to be the real cause of the problem as seen above

@Nicogene
Copy link
Member

Nicogene commented Dec 21, 2023

Chatting T2T w/ @PasMarra we concluded that any simplification of the finger/hand mesh did not improve consistently the rtf, we noticed that also in the iCub model there is the same rtf drop when starting grasping, with the difference that when it used the iCub model we start from an higher rtf.

Then it makes more sense to work on increasing the rtf when using ergoCub model overall, @PasMarra will open a dedicated issue for that.
For all those reasons I will not merge:

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
domain-software Related to Software prj-ergocub Related to ErgoCub Project team-fix Related to Team Fix
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants