Home › Forum › SOFA › Using SOFA › Collisions and LinearMovementConstraint
Tagged: 64_bits, Linux_mint, Plugin_other, SOFA_1906
- This topic has 7 replies, 2 voices, and was last updated 5 years, 2 months ago by Hugo.
-
AuthorPosts
-
28 August 2019 at 18:44 #14166FrancoisBlocked
Hi,
I’m trying to create a scene in Python where an instrument enter in collision with another object by following a predetermined path. I am using Discrete Intersections and the LinearMovementConstraint component to control the trajectory of the instrument.
However, the collision response doesn’t work. The intersections seems to be drawn correctly in the GUI but the objects just passe right through each other. Although, when the objects are pulled against each other with the mouse, the collisions work fine.
Any idea why it’s not working? I tried to include a code example within this message but I always get the “*** Forbidden. Message seems to be spam. ***” message when trying to submit.
Thanks you,
Francois2 September 2019 at 17:03 #14176HugoKeymasterHi @fleonard
Could you share your scene with us? (link to a github/wetransfer ..)
Since you are imposing the displacement (using the LinearMovementConstraint), the simulation will make sure this constraint is respected even if the object collides with others. Therefore the result is logical and it is working properly.
To work what you expect, a solution to impose the displacement on the rest_position and to add a RestShapeSpringForceField. But it’s hard to give appropriate advices without seeing your simulation.
Best
Hugo
10 September 2019 at 22:01 #14226FrancoisBlockedHi,
The displacement is only imposed on one object. I don’t understand why the other object doesn’t deform or get pushed by it. I will try the RestShapeSpringForceField to see what it does.
Meanwhile, I’ve put a simplified scene here.
Thank you,
Francois
13 September 2019 at 19:43 #14236HugoKeymasterHi @fleonard
I do not advise to use DiscreteIntersection for the detection but rather the LocalMinDistance (or MinProximityIntersection) as shown below:
self.rootNode.createObject("LocalMinDistance", name="Intersection", alarmDistance="0.3", contactDistance="0.1", useLMDFilters="0")
Best
Hugo
30 September 2019 at 22:07 #14321FrancoisBlockedHi @hugo,
Sorry for the late reply. Why do you not advise to use DiscreteIntersection? In my scene, many objects are very close to each other. With proximity intersections, I haven’t been able to set the contact distance small enough so that the objects are not in collision from the start and yet have realistic looking collisions.
Also, how can I impose a displacement on the rest_position?
Best,
Francois
1 October 2019 at 09:37 #14322HugoKeymasterHi @fleonard
No prob. LocalMinDistance actually inherits from DiscreteIntersection but has a more complete implementation (e.g. of all intersections between discrete primitives to compute). You can see this here in the API doc.
If your objects are not in contact, you should be able to find a value of alarm and contact distance which satisfies your expectations.
What do you mean by imposing a displacement on the rest_position? Do you want to keep the same position but to have shifted rest_position? or do you want to shift the object at initialization of the scene ?
Hugo
2 October 2019 at 00:18 #14334FrancoisBlockedHi Hugo,
I will try again with LocalMinDistance.
For the rest_position, I was referring to your previous suggestion to impose the displacement on the rest_position and to add a RestShapeSpringForceField, rather then using LinearMovementConstraint. With what component can I do that?
Thanks,
François
7 October 2019 at 15:10 #14354HugoKeymasterHi @fleonard
To work with the approach involving the RestShapeSpringForceField, you could simply pass these rest positions to the MechanicalObject at the init (from a loader) like :
<MeshObjLoader name="undeformed" filename="mesh1.obj"/> <MeshObjLoader name="deformed-targetConfiguration" filename="mesh2.obj"/> <MechanicalObject name="Dofs" position="@undeformed.position" rest_position="@deformed-targetConfiguration.position" /> <RestShapeSpringForceField />
Best,
Hugo
-
AuthorPosts
- You must be logged in to reply to this topic.