Home › Forum › SOFA › Programming with SOFA › Continuous collision detection
Tagged: 64_bits, Collisions, Linux_mint, SOFA_1906
 This topic has 11 replies, 3 voices, and was last updated 2 years, 7 months ago by Benjamin.

AuthorPosts

22 May 2020 at 20:14 #16338FrancoisBlocked
Hi,
I wrote an algorithm for continuous collision detection. I would like it to work with constraints for the collision response. I’m having some difficulties understanding how to get this to work in Sofa.
I calculate the time and coordinate of contact between the two collision elements, but whatever I pass to the detectionOutputVector, the result is a little bit off. The distance between the elements after the constraint correction are always different and the objects end up penetrating into each other.
Is there any implementation of a continuous collision detection algorithm available somewhere, like in a 3rd party plugin, or any other resource that would be helpful to understand how to use continuous collisions in Sofa?
Thank you,
François Léonard
31 May 2020 at 18:59 #16467HugoKeymasterHi @fleonard
Sorry for letting you down for so long.
I am currently working on a documentation of this part in SOFA. It should help the understanding of this dark part in SOFA!Which AnimationLoop are you using?
Yes there was a third party (private) plugins on continuous collision detection with implicit surfaces (I am unfortunately not knowledgeable about it). This work arose from the collaboration between two research teams. I could see to share this code if you’d like. To do so, we could Skype anytime in order to get some info/updates on your side.
Best,
Hugo
23 June 2020 at 00:29 #16692FrancoisBlockedHi @hugo,
Sorry for the late reply. It looks like I don’t receive emails anymore when my messages are answered.
I made some progress in the last few weeks. I understood some things about how the freeAnimationLoop and the free positions work. I’m using the freeAnimationLoop with the LCPConstraintSolver. However, I don’t fully understand the math behind the constraint correction and how Delta v^cor is calculated. I’m also not sure what exactly the contacts’ values sent to the contact manager need to be and what the contactDistance does with collision responses using constraints.
My continuous detection almost works, but the times of intersection I calculate seems a little off. Sometimes the intersection falls just before or after the step, letting the objects penetrate even though the point and triangle visibly pass through each other. I wonder if it’s the numerical errors that propagate in the calculations, making the time of intersection a little off. In other cases, I detect an intersection and create a contact, but the constraint correction let the point and triangle penetrate anyway.
I would love to see this continuous collision plugin. Maybe it could help me figure out what I’m doing wrong. I’m available to Skype anytime.
Thank you,
François
23 June 2020 at 22:50 #16698HugoKeymasterHi @fleonard
Good to read.
I hope the documentation on the AnimationLoop helped.
As you might have noticed, the documentation on Collision has improved a bit.For the FreeAnimationLoop and the Lagrange multipliers approach did you pay attention to the doc page?
Defining the numerical setting for collision detection is complex. You need to use a time step small enough to make sure that your objects won’t go through one another in between one time step. For this, the time step, the alarm and contact distance are key.
Let me know if above information are helping already.
Best,Hugo
24 June 2020 at 21:48 #16716FrancoisBlockedHi @hugo,
I saw that that the documentation improved a lot over the last few months. Thanks for all the work on this!
So far I made a discrete collision detection algorithm based on spatial subdivision that works well with the correct numerical settings (time step, alarm and contact distance). Now, I’m trying to adapt it to handle continuous collision detection. The idea is to compute the exact time of collision during the step (using linear interpolation of the vertices positions) and then to correct the positions so that the objects don’t go through one another. I’m using the free positions as the endofstep positions for the linear interpolation. For the collision response, I’m trying to use constraints to correct the positions. It’s mostly this last part that is not clear to me.
Best,
François
7 July 2020 at 22:59 #16819HugoKeymasterHi @fleonard
What’s new with your continuous detection algorithm?
Regarding the last collision step, the response, it’s a part I do not perfectly master neither. But take a look at the FrictionContact class which implements thecreateResponse()
function called in the doCollisionResponse stage.Best wishes,
Hugo
15 September 2020 at 22:14 #17147FrancoisBlockedHi @hugo,
Sorry for the late reply. I didn’t work on this since July. I had not made progress in preventing objects to penetrate each others using constraints for collision response.
I’ll try to dive more into the theory and math of the solvers, Lagrange multipliers and constraints. I think I need this to understand the code. However, I’m running out of time since I’m supposed to graduate soon.
Do you know who’s familiar with this part of SOFA, and if it’s possible to discuss with them?
Thanks,
François
16 September 2020 at 09:47 #17150HugoKeymasterHi @fleonard,
I know a bit this part of SOFA, we could setup a meeting. Feel free to contact me per email. Do not forget to come back here in the forum to update about your future progresses 😉
Hugo
29 September 2020 at 07:00 #17225BenjaminBlockedHi Hugo,
I am also currently working on Continuous Collision Detection. Do you know if anyone is familiar with this part? Do you have suggestions how to build the unit test to test the collision part in SOFA?
Regards,
Ben5 October 2020 at 22:33 #17284HugoKeymasterHi @wzdy4444
@fleonard and his team in Montreal are actually pretty active on continuous collision detection. Could you tell us more Francois about your work and progresses?For building your unit test (which are also most welcome in SOFA!), you can take a look at the Collision online doc. I hope this helps.
Best wishes,
Hugo
9 October 2020 at 00:48 #17333FrancoisBlockedHi @wzdy4444
I’ve been working on a collision algorithm for a simulation developed at my university. I’m not certain if Sofa has an implementation of continuous collision detection, but there is ways to integrate one with the freeAnimationLoop and the free positions. The part I’ve been struggling with is the response, where I try to use the Lagrange multiplier constraints. I don’t know what you are working on and what you are trying to test. If you tell me about it I might be able to help. Let me know if you have questions.
Regards,
Francois9 October 2020 at 10:33 #17335BenjaminBlockedHi Francois @fleonard,
Thanks for your reply.
What I am thinking is to replace the detection algorithm in SOFA with my algorithm. The part of code in SOFA I’d like to replace is the addCollisionPair in BruteForceDection.cpp. So the same outputs as the old code (contact time, contact point, etc.) will be given by the new algorithms and the SOFA will use these outputs to do the response as it used to be. And the other parts of codes like response won’t be modified.
I haven’t reach to the freeAnimationLoop right now. I saw your old post saying it would be considered when implementing your collision dectection. Can I ask why?
Regards,
Ben 
AuthorPosts
 You must be logged in to reply to this topic.