Home › Forum › SOFA › Programming with SOFA › [SOLVED] Pneumatic actuator – Soft Robots plugin
Tagged: 64_bits, MacOS, Plugin_SoftRobots, SOFA_1912, Soft Robots
- This topic has 5 replies, 4 voices, and was last updated 4 years, 3 months ago by BrunoB81HK.
-
AuthorPosts
-
2 July 2020 at 15:12 #16768SherpaBlocked
Hi there,
I’ve been using the soft robotics plugin and have been adapting the pneumatic gripper tutorial to my needs. I am struggling on how to read force data exerted by the gripper on the ojects it interacts with. Is it possible to otain this data either through the code or the gui?I have checked the SOFA documentation but didn’t find something to help me so if you could point me in the right direction I would be very grateful!
Thank you!
7 July 2020 at 23:31 #16830HugoKeymasterHi @sherpa
It is actually a bit complex to access collision forces. If I remember properly, the tutorial is using a FreeMotionAnimationLoop, therefore solving collision using the Lagrange multipliers approach.
The result of the collision forces (solved within the constraint problem) are stored by the ConstraintProblem. To compute them on your degrees of freedom, you need to recover “constraint” of the MechanicalObject corresponding to the and multiply it with the lambda saved in the ConstraintSolver and resulting from the constraint resolution.It is not yet available in the SOFA API, we know it is something to improve for users/devs.
@olivier-goury could you please correct me here, if anything is incorrect?Best,
Hugo
8 July 2020 at 09:44 #16835olivierBlockedYes Hugo, you’re absolutely right. To add some info, H will give you the force direction, while lambda will give you the intensity. You can get H from the python code in your SOFA scene by calling the “constraint” field of the MechanicalObject. For lambda, I think you will have to go in the constraint solver (typically GenericConstraintSolver) and print it out at the end of the solveSystem(…) function.
Do not hesitate if you need more details,
Good luck!
Olivier23 July 2020 at 19:57 #16950BrunoB81HKBlockedHi @olivier-goury,
I’m building a scene in python and I try to compute the forces like you wrote there. I’m having trouble finding lambda. Can you Go further in your explanation of how to get the lambda?
Also, there is a Data in the GenericConstraintSolver that is named constraintForces and they doesn’t seems to be the constaints forces. What are they?
Thanks a lot for your help!
Bruno
27 July 2020 at 12:02 #16961olivierBlockedHello @brunob81hk,
For your second question, actually, the Data constraintForces does give you the value of Lambda (so the intensity of the constraint forces).
So to answer your first question, to output lambda, I think the easiest will be to get it using a PythonScriptController in which you recover the value of that data calling findData(‘constraintForces’) on the object genericConstraintSolver, or just read it from the GUI if you do not need it at each timestep.
(You can find an example of controller in SoftRobots/docs/examples/component/constraint/CableConstraint/CableConstraint.pyscn)Olivier
27 July 2020 at 17:55 #16966BrunoB81HKBlocked -
AuthorPosts
- You must be logged in to reply to this topic.