Home › Forum › SOFA › Using SOFA › [SOLVED] Problem about a grasping scene
- This topic has 6 replies, 2 voices, and was last updated 9 years, 7 months ago by Forest.
-
AuthorPosts
-
22 May 2015 at 09:43 #3318WongBlocked
Hello,
Previously, I posted a problem about grasping(https://www.sofa-framework.org/forum/topic/how-to-construct-a-grasper-scenewith-force-feedback/),but no one replied.
however, I did find some examples about grasping in sofa, so I constructed a scene by reference to these examples. Then a new problem arose.
My grasper consists of two parts:an upper part and a lower part. When being grasped by manually modifying the rest_position of the DOFs mapped to the articulations of the grasper, the object will penetrate the lower part. You can see this problem in the package file.
The package file is as follows:
https://www.dropbox.com/s/e9bonppswlvhm0p/test.zip?dl=0
Sincerely,
Wong22 May 2015 at 13:38 #3320ForestBlockedDear Wong,
I have tried your scene and in my case, the torus only penetrate the tool when the grasper is closed too much (more than PI/4).
You torus is rigid, therefore, if the constraint solver can not find a solution for the whole torus, you will have some penetrations, and this is what happens in your scene when you close the jaws too much. A deformable torus might reduce your problem (but it will be slower).
To answer to your question regarding grasping, I know two ways to model it.
1- Physically. By this, I mean by relying only on the SOFA contacts resolution algorithms, like you do in your scene. In my experience, it burdens the simulation a lot (due to the high number of contacts) and is also quite unstable, particularly when the tip of your instrument is translating.
2- Non physically. In this method, when your grasper is closing, and until it opens back, you deactivate the collision with your torus and fix its position relatively to the grasper through a constraint or a controller. This method is of course much more stable than the previous one. The drawback is that you will have to write some code of your own, as I am not aware of publicly available objects that would do this for you.
Finally, I have some small remarks regarding your scene:
– your collision models are way too complex. Your jaws should be modelled as simple boxes. With such a complex model, you get a huge number of contacts which make the constraint problem harder to solve, and the simulation slower.
– similarly, you might try to decrease your alarm and contact distances.Regards,
Clément Forest
Digital-Trainers23 May 2015 at 06:06 #3324WongBlockedHello Forest,
Thank you for your reply.
According to your advice, I change the collision models into two boxes and try to use a deformable torus. But the problem still remains.You can see the package file.
https://www.dropbox.com/s/7l8na8sf0jniqit/test2.zip?dl=0And in your non-physically method, how to deactivate the collision? Then do you mean fixing the relative position of the torus? How to do? But I want to obtain the collision force. If the collision is deactivated, will the force become zero?
Sincerely,
Wong26 May 2015 at 07:22 #3331WongBlockedHello Forest,
Do you know how to judge whether a collision model collides with another specific collision model and how to fix the position of a collision model relatively to a rigid DOF(the collision model is free initially) in animating by writing code?
Could you give me some further information or point out some examples to reference?
Sincerely,
Wong26 May 2015 at 14:24 #3333ForestBlockedTo check if a model collides with another, you have to look into the detection output of the NarrowPhase. This is a list of pairs of collision models. You have to check for an element that contains collision models from both models. You’ll also have to check that the element is actually a collision (ie. that the distance is below the contact distance).
One possibility to move your rigid model is to create a constraint (eg. by deriving PairInteractionConstraint).
To deactivate the collision between two objects, you can change the collision group of one of your models, so it is the same than the other, or you can add a rule to the ContactManager to set the corresponding response to “null”.
Regards,
Clément Forest
Digital-Trainers27 May 2015 at 02:34 #3339WongBlockedHello Forest,
I have also considered changing the collision group.
Please allow me to ask one more question.
If I want to set both two parts of the grasper in the same group but the torus can only collide with the lower part, what should I do?
Sincerely,
Wong28 May 2015 at 11:22 #3345ForestBlockedCollision group only allow simple management of collision behaviour. As far as I remember:
– Group 0 elements collide with everything (including other elements from group 0)
– Group i elements collide with everything except elements in the same group.To have a more subtle control, you will have to use the contact manager to deactivate the collision response for a pair of collision groups.
In your case, you will have to assign a different group to each jaw, as they behave differently. Then add a rule to deactivate the response between the upper jaw and the torus, and probably one to deactivate the response between the two jaws.
Clément Forest
Digital-Trainers -
AuthorPosts
- You must be logged in to reply to this topic.