General description
This component is used to solve an effector constraint by applying a force on a given point of a model.
Methods description
Requirement: Real time inverse simulation method
Method
Here, the constraint matrix J will contain the given direction of the force in the rows corresponding to the given point of the model, and λ will represent the intensity of the applied force.
How to use the component
To learn how to create a SOFA scene, please refer to the tutorial provided by the SOFA Modeler or this documentation.
An example is provided in the “examples” directory of the plugin. Let’s consider this deformable object:
skin = rootNode.createChild('skin') skin.createObject('EulerImplicit', name='odesolver') skin.createObject('SparseLDLSolver', name='preconditioner') skin.createObject('MeshVTKLoader', name='loader', filename=path+'skin.vtk') skin.createObject('TetrahedronSetTopologyContainer', src='@loader', name='container') skin.createObject('TetrahedronSetTopologyModifier') skin.createObject('TetrahedronSetTopologyAlgorithms') skin.createObject('TetrahedronSetGeometryAlgorithms') skin.createObject('MechanicalObject', name='tetras', showIndices='false', showIndicesScale='4e-5') skin.createObject('UniformMass', totalmass='0.03') skin.createObject('TetrahedronFEMForceField', name='FEM', method='large', poissonRatio='0.3', youngModulus='180', drawAsEdges="1") ... skin.createObject('LinearSolverConstraintCorrection', solverName='preconditioner')
You can define the positions on which you want to apply the force and map these position to the deformable object by creating a child node and using a “Mapping” component:
pointForce = skin.createChild('pointForce') pointForce.createObject('MechanicalObject', position="72 68 -2 70 70 2 70 70 0") pointForce.createObject('ForcePointActuator', triangles='@topo.triangles', direction="-1 -1 0", indices="0 1 2", maxForce="90", minForce="0", maxForceVariation="5") pointForce.createObject('BarycentricMapping', name='mapping', mapForces='false', mapMasses='false')
The direction of the force is specified by the user. By using an “Effector” component and the “QPInverseProblemSolver” you can solve the inverse problem of finding the right force to apply to solve the effector target.
Data field
Here are described the data fields corresponding to this particular component.
Input data
indices : Index of the point of the model on which we want to apply the force.
maxForce /minForce: Correspond to the constrainst λmin ≤ λ ≤ λmax where λ represents the force. If no values are set by the user, no constraint on λ will be considered. Note that the force is constrained to be positive.
maxForceVariation: Maximum variation of the force allowed. If not set, no max variation will be concidered.
direction: Direction of the force we want to apply.
Output data
displacement : Displacement achieved at the end of the time step compared to initial state. δ = Waaλ + δfree
force : The force λ applied at the end of the time step.