22 May 2020 at 20 h 14 min #16338
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?
François Léonard31 May 2020 at 18 h 59 min #16467
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.
Hugo23 June 2020 at 0 h 29 min #16692
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.
François23 June 2020 at 22 h 50 min #16698
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.
Hugo24 June 2020 at 21 h 48 min #16716
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 end-of-step 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.
François7 July 2020 at 22 h 59 min #16819
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 the
createResponse()function called in the doCollisionResponse stage.
Hugo15 September 2020 at 22 h 14 min #17147
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?
François16 September 2020 at 9 h 47 min #17150
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 😉
Hugo29 September 2020 at 7 h 00 min #17225BenjaminParticipant
- University of Auckland
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?
Ben5 October 2020 at 22 h 33 min #17284
@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.
Hugo9 October 2020 at 0 h 48 min #17333
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.
Francois9 October 2020 at 10 h 33 min #17335BenjaminParticipant
- University of Auckland
Hi 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?
- You must be logged in to reply to this topic.