Accessing Contact forces in Collision Detectors #5314
Replies: 3 comments 4 replies
-
|
Hello ! I am sorry, but it seems to me that you are not asking any SOFA-related question. Your are asking for an update of a python script regarding some input constraints. I am honestly sure that you are able to do it by yourself. Copy-pasting your post on ChatGPT outputted a quite comprehensive answer. I didn't check the syntax or even if it was working. But anyway, it shows that you are not asking SOFA question but really a python question ;) Please, feel free to come back when you start digging more into SOFA API ! |
Beta Was this translation helpful? Give feedback.
-
|
Hi, I am also trying to get contact force and approaching to this recent discussion. I am currently using SOFA v24.12 (the most recent version), and the expression of the result is: |
Beta Was this translation helpful? Give feedback.
-
|
I close this discussion @AbhiBjee @Zentetsu |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
Hello SOFA Developers !
I am a PhD student from Purdue Mechanical Engineering.
I am very new to SOFA and currently working on understanding surgical tool tissue interactions for palpation of tumors, especially for tumor mapping.
I am currently exploring both Penalty based as well as Lagrange Multiplier based collision models for contact detection.
My primary objective is to retrieve contact forces and deformations of a Soft Body from a rigid body to soft body collision and use it for calculating local point stiffness estimation for robot control policy learning aimed for tumor mapping.
Tumor Model Liposarcoma (Musculoskeletal) and Hepatocellular sarcoma (Liver Tumor)
I am using Sofa Python3 on Windows with NVIDIA RTX 4070 8 gigs and version: SOFA 24.06 .
I am trying to understand how to extract forces from the collision detectors.
Going through the discussion forum I found this conversation thread
This thread shows a very useful example of detecting contact forces through constraint correction using Lagrange Multipliers.
The code:
constraint = self.rootNode.Cube.collision.MechanicalObject.constraint.valueshould output in the format given in the discussion as:0 2 58 0.487691 -0.305337 0.146266 59 0.333767 -0.208967 0.100102
1 2 58 0.336271 0.407063 -0.271458 59 0.230138 0.278586 -0.185781
2 2 58 0.0393245 0.305838 0.50733 59 0.026913 0.20931 0.347208
However, on my end it reads:
Constraint ID : 0 dof ID : 1 value : 0 1 -1.27615e-13
Constraint ID : 1 dof ID : 1 value : -1.27615e-13 1.27615e-13 1
Constraint ID : 2 dof ID : 1 value : 1 1.62857e-26 1.27615e-13
Constraint ID : 3 dof ID : 2 value : -1.33509e-15 1 -4.6728e-15
Constraint ID : 4 dof ID : 2 value : -4.6728e-15 4.6728e-15 1
Constraint ID : 5 dof ID : 2 value : 1 1.33509e-15 4.6728e-15
Constraint ID : 6 dof ID : 3 value : -5.10462e-13 1 -5.10462e-13
Constraint ID : 7 dof ID : 3 value : -5.10462e-13 5.10462e-13 1
Constraint ID : 8 dof ID : 3 value : 1 5.10462e-13 5.10462e-13
Constraint ID : 0 dof ID : 3 value : -7.81589e-15 1 4.26321e-15
Constraint ID : 1 dof ID : 3 value : 4.26321e-15 -4.26321e-15 1
Constraint ID : 2 dof ID : 3 value : 1 7.81589e-15 -4.26321e-15
I feel this makes the drawForces() Class to fail.
Can you please help me run this example on my end?
I would also like to request you to help me understand what the following code is doing:
How can I update it on my end based on the new format of the "Constraint" String.
Are there other approaches to extract contact forces to compute reaction forces of a rigid body in contact with soft body ?
Any help would be highly appreciated.
Thanks in advance.
Beta Was this translation helpful? Give feedback.
All reactions