How to get force by using LCPForcefeedback in Python? #4261
Replies: 4 comments 1 reply
-
I haven't used the Haptics plugin before, so I'm not entirely certain. However, the computeForce function is a public member function, but it's also defined as a virtual void, which implies that it doesn't return any value, correct? You mentioned the Geomagic Haptics example. In the Geomagic-RigidSkull.scn file, they have included the following code:
Are you attempting to simply extract and print the forceCoef using Python? |
Beta Was this translation helpful? Give feedback.
-
Hello @SangbaekYoo, Looking at the source code of LCPFF, it seems that computeForce takes 6 Real as parameters (3 float to define the input position and 3 floats as reference for output force) so thats why maybe you could not call computeForce(). |
Beta Was this translation helpful? Give feedback.
-
|
Beta Was this translation helpful? Give feedback.
-
|
Beta Was this translation helpful? Give feedback.
-
My objective is to get force data in specific position of device in simulation.
There are good examples (Geomagic Haptics), but it is difficult to find example in Python.
Currently, I am using Haptics plugin and LCPForceFeedback class.
I am success to define object in createScene(root) function as follows:
When scene is run, I want to read force in specific position of device. For this, I guess that I can use computeForce function which is public member function of LCPForceFeedback class.(I understand that computeForce function returns force information and it is also used in Geomagic cpp file.)
https://www.sofa-framework.org/api/master/sofa/html/classsofa_1_1component_1_1haptics_1_1_l_c_p_force_feedback.html#a9e888aee5f18b622f71e6dd42586fe43
I expect to get force in Python like below line,
but there is error "attibuteError: unable to find attribute: computeForce".
I think I'm mistaken about how to use it in Python.
Can anyone give me advice how to use it?
Or is there any other method to get force in my own python code?
Beta Was this translation helpful? Give feedback.
All reactions