Dynamic Applied force extraction and visualization #5354
Replies: 6 comments 3 replies
-
|
@Zentetsu When I modify it to apply my case, I found that nb_constraints can be larger than 3. (nb_constraints > 3) above for loop occurs runtime error due to index out of problem because forces dimension is nb_dofs by 3. Could you please provide information about what constraint_list and forces_norm represent? It would really help me with the implementing. |
Beta Was this translation helpful? Give feedback.
-
Regarding my two first points: Constraint ID
|
Beta Was this translation helpful? Give feedback.
-
|
Hello ! Regarding your "UPDATE - 13/06": How did you identify the constraint id of all collision model pairs ? |
Beta Was this translation helpful? Give feedback.
-
|
For your information, I just created an example as a PR in the SofaPython3 repository describing how to easily access (and visualize) contact forces, when using the response method "FrictionContactConstraint". See ➡️ https://github.com/sofa-framework/SofaPython3/pull/514/files |
Beta Was this translation helpful? Give feedback.
-
|
|
Beta Was this translation helpful? Give feedback.
-
|
|
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!
I'm working on a simulation complementary to this one.
My goal here is to be able to track and visualize the forces applied to objects (solid and deformable) and the end effector of a robotic arm.
I used this example to track the force. However, I still have some questions left.
The simulation for the moment contains two cubes (rigid and deformable) and the floor.
Constraint ID
PointCollisionModelIn the example, the constraints are display in this format with and contain 2 dofs:
In my simulation, the constraints appear in this format and contain 1 dof:
If I understood, there are 3 Constraint IDs for each object's points due to the use of
TriangleCollisionModel.However, I don't know how to deal with it. Should I sum them up or ignore some of them?
Here is the snippet of code that I made to display force:
The one for managing the collision:
And a screenshot from the simulation (one cube):
Constraint ID multi
CollisionModelI'm also concerned when the objects use multiple
CollisionModel(Line, Point, and Triangle)To be sure that the two cubes are able to interact with each other I add
TriangleCollisionModelandLineCollisionModel.In this case, the constraint format changes, but I'm not sure how to manage them.
Is there any specific way to deal the multiple type of constraints with two cubes when they enter in collision?
PointCollisionModelonlySimulation
Constraint data
TriangleCollisionModelLineCollisionModelPointCollisionModelSimulation
Constraint data
Deformable object
When I want to monitor the force applied to the deformable cube, multiple arrows appear with a drastically bigger scale than the one with the rigid cube. Is that normal?
PS: the total force for the rigid and deformable cube is the same
UPDATE - 06/05
CollisionModel
Concerning the management of the
collision modeland theconstraint ID, I was able to understand it a bit further.It needs to be managed in parallel with the
ContactListener, which will give information about whichcollision modeland the vertices involved in force management. All the constraint IDs should not be summed for the same object.In my use case, multiple objects can interact with each other, and it's essential to be careful when managing the
Constraint ID.Regarding my other concern about the total force
The problem came from the
UncoupledConstraintCorrection. I defined this way:The compliance made this behavior. However, I can track the force correctly by removing the
complianceargument.Still, I'm unsure how to use the
UncoupledConstraintCorrectionparameter.Deformable object
Even after solving my problem with a rigid object, I'm still concerned when it involves a deformable one.
From this example and this one, I'm still not able to figure out their differences and how to correctly extract the force applied on a deformable object.
UPDATE - 13/06
Force Measurement of deformable object
After reviewing my code and comparing it with other code examples, I was able to fix my problem when measuring the force applied to a deformable object by correcting the definition of the object:
GenericConstraintCorrectionI also changed the collision model on which I'm tracking the force applied. Before, I used the Collision model of the STL file(
MeshTopology), and now I'm using the collision model of the mesh file(TetrahedronSetTopologyContainer).In this way, I can follow the force applied to each point of my model.
Force measurement during resting phase
The setting of this test is one big deformable cube(125g) resting on the floor and a second cube(5kg) resting on the top of the first one.
The force I'm tracking seems correct, however, there is a part I'm not sure how to interpret.
The force detected on the cube's face touching the ground seems correct:
As well as the face of the second cube resting on the biggest one:
But I don't know how to interpret the force measured by the upper face of the big cube:
Simulation
Measured force output
PointCollisionModel; floorTriangleCollisionModelTriangleCollisionModel; small cubePointCollisionModelPointCollisionModel; small cubeTriangleCollisionModelTriangleCollisionModel; big cubePointCollisionModelPointCollisionModel; big cubeTriangleCollisionModelSnippet of code - UPDATED VERSION -
Beta Was this translation helpful? Give feedback.
All reactions