Contact Algorithm

classic Classic list List threaded Threaded
14 messages Options
Reply | Threaded
Open this post in threaded view
|

Contact Algorithm

Mr.Happy
Hey Guys,

I am new to Granoo and I have a question regarding the contact algorithm embedded in Granoo. I ran two simulations (see picture below). In both simulations I have two blocks where Block 1 was completely fixed in all 6 degrees of freedom while block 2 was fixed in all 5 degrees of freedom but was moving in the z-direction towards block 1. The difference between both these simulations was the size of block 2 (it was much smaller in simulation 2).
The reaction force (in the z-direction) was plotted against the applied displacement (in the z-direction). For both the simulations, the force-displacement curves were exactly the same. Here is my question: Can I change the contact algorithm such that it accounts for the volume of penetration (of surface area of penetration) rather then just based on a distance? This way the reaction force will be different for both the simulations.
Currently I used the following line of code in the input file:

<PlugIn Id="_ManageCollision" Between="Body/Body" BroadPhase="AABBTree" NarrowPhase="WithShape" CallBack="Standard" Stiffness="1000000.000000000000" RestitutionCoeff="0.100000000000" RegularizationType="piecewise" DryFrictionSlope="1e5" StaticDryFrictionCoeff="0.3" DynamicDryFrictionCoeff="0.2" />

Thank you for your help! I really appreciate it.


Reply | Threaded
Open this post in threaded view
|

Re: Contact Algorithm

Cédric Hubert
Administrator
Hi,

In GranOO, all bodies are rigid, and thus, the contact algorithms just deal with polytopes.

All contact algorithms in GranOO are penalty-based, which means that they introduce a force to overcome the bodies penetration. This force is linearly proportional to the penetration, and is applied at the body's centre of mass. This force is the called "contact force", and is the force you plotted on your graphs since there is no other external force applied on your bodies.

This is why the size of the bodies does not matter, especially when their mass is not taken into account (I guess you are prescribing a displacement).

Reply | Threaded
Open this post in threaded view
|

Re: Contact Algorithm

Mr.Happy
ohh ok. I understand now. So all the contact algorithms in Granoo don't take the volume into consideration during penetration.

Thank you for your help!

Reply | Threaded
Open this post in threaded view
|

Re: Contact Algorithm

Mr.Happy
In reply to this post by Cédric Hubert
Is there any way of changing the contact algorithm within the source code? I am really interested in calculating the contact force via the volume of penetration.

Thanks for your help!
Reply | Threaded
Open this post in threaded view
|

Re: Contact Algorithm

Cédric Hubert
Administrator
The class that does the job is 'Standard' (in libCollision/Callback).
Locate the 'Standard<Physic::Body, Physic::Body>::ManageCollision(Physic::Body &, Physic::Body &, const Data &)' method, and adjust it according to your needs.

The bodies' volume is accessible from de1 and de2 arguments.
Reply | Threaded
Open this post in threaded view
|

Re: Contact Algorithm

Mr.Happy
Hey,

Thank you for your response. I have identified the line of code which calculates the contact force. How can I access the volume of penetration of the two bodies?

Again, thank you for your help!
Reply | Threaded
Open this post in threaded view
|

Re: Contact Algorithm

Cédric Hubert
Administrator
Simply call the Volume accessor on one of the bodies:

double v1 = de1.GetVolume();
Reply | Threaded
Open this post in threaded view
|

Re: Contact Algorithm

Mr.Happy
Thank you for your prompt reply. I really appreciate it.
I tried the following:

double v1 = de1.GetVolume();
double v2 = de2.GetVolume();

but I noticed that v1 and v2 are the volume of block 1 and 2 respectively. However, I am interested in the penetration volume (the volume which is common between block 1 and block 2 as they collide). Is that possible?  

Again, thank you for your help.
Reply | Threaded
Open this post in threaded view
|

Re: Contact Algorithm

Cédric Hubert
Administrator
There is no such a "built-in" way to do that.
You will need to calculate this yourself, based on the bodies positions and orientations...
Reply | Threaded
Open this post in threaded view
|

Re: Contact Algorithm

Mr.Happy
Thank you, once again, for your prompt reply. I have the following questions:

1. How can I access the current orientation of block 1 and block 2? Will this be in quaternion format?
2. Is there a way of accessing their current vertices' position or their corners' position?
3. Can you let me know where the variable 'info.penetration' is calculated?
4. Please let me know if you have any suggestions for calculating the contact volume.

Again, thank you for your help. I really appreciate it.

Reply | Threaded
Open this post in threaded view
|

Re: Contact Algorithm

Damien André
Administrator
Hello,
Mr.Happy wrote
1. How can I access the current orientation of block 1 and block 2? Will this be in quaternion format?
Yes !

Mr.Happy wrote
2. Is there a way of accessing their current vertices' position or their corners' position?
Yes you can, you should take a look at the polyhedron class in libShape. But it's not easy.

Mr.Happy wrote
3. Can you let me know where the variable 'info.penetration' is calculated?
It comes from the EPA-GJK standard algorithm. Please take a look to the internet.

Mr.Happy wrote
4. Please let me know if you have any suggestions for calculating the contact volume.
Sorry, I have no idea

Good luck, Damien.

Reply | Threaded
Open this post in threaded view
|

Re: Contact Algorithm

Mr.Happy
Thank you for your reply.

How do I get the current rotation of de1 and de2?

Thank you for your help.
Reply | Threaded
Open this post in threaded view
|

Re: Contact Algorithm

Damien André
Administrator
Simply use the de1.GetQuaternion() method
Reply | Threaded
Open this post in threaded view
|

Re: Contact Algorithm

Mr.Happy
Thanks!
I was finally able to program it.

Thank you for your help!