Home › Forum › SOFA › Using SOFA › [SOLVED] VectorSpringForcField is not stiff enough
Tagged: Linux_ubuntu, SOFA_2012, Stiffness, VectorSpringForceField
- This topic has 6 replies, 2 voices, and was last updated 3 years, 5 months ago by BrunoB81HK.
-
AuthorPosts
-
31 May 2021 at 23:13 #19614BrunoB81HKBlocked
Hi!
I’m using a
VectorSpringForceField
in a scene in the same way it is used in this Geomagic Touch example. Basically, I have a reference model that follow an haptic device and a “collision” model that is used to measure the forces applied on an instrument.My problem is that the springs are not stiff enough to generate high enough forces on the instrument. Even tough I increase the springs stiffness, the computed force stays the same. This result in my reference model penetrating to much in the FEM model.
My scene looks like this :
<?xml version="1.0"?> <Node name="Root" gravity='0 0 -9.81' dt='0.01'> <!--VisualStyle displayFlags="hideVisual showForceFields showCollisionModels showWireframe"/--> <BackgroundSetting image="../../img/Sofa_Trex_background.png"/> <RequiredPlugin pluginName='SofaTrex SofaOpenglVisual SofaHaptics SofaBoundaryCondition SofaConstraint SofaImplicitOdeSolver SofaLoader SofaMeshCollision SofaRigid SofaSimpleFem SofaDeformable SofaUserInteraction'/> <DefaultPipeline name='CollisionPipeline' verbose='0'/> <BruteForceDetection name='ForceDetection'/> <DefaultContactManager name='Response' response='FrictionContact'/> <LocalMinDistance name='proximity' contactDistance='0.001' alarmDistance='0.05' angleCone='15.0'/> <FreeMotionAnimationLoop/> <LCPConstraintSolver name='ConstraintSolver' tolerance="0.001" maxIt="1000"/> <SofaTrexConnector name="TrexDriver" maxInputForceFeedback="20.0" forceScale="1." armOrigin="-0.15 0.0 -0.25" smoothing="0.0" motorTension="3"/> <MeshObjLoader name='LiverVisMesh' filename='../../mesh/Liver/LiverVis.obj'/> <MeshObjLoader name='LiverColMesh' filename='../../mesh/Liver/LiverCol.obj'/> <MeshGmshLoader name='LiverFEMMesh' filename='../../mesh/Liver/LiverFEM.msh'/> <Node name="Liver"> <EulerImplicitSolver rayleighStiffness='0.1' rayleighMass='0.1'/> <CGLinearSolver threshold='1e-11' tolerance='1e-11' iterations='25'/> <TetrahedronSetTopologyContainer src='@../LiverFEMMesh'/> <TetrahedronSetGeometryAlgorithms template='Vec3d'/> <MechanicalObject src='@../LiverFEMMesh' name='LiverDOFs'/> <PrecomputedConstraintCorrection recompute='true'/> <DiagonalMass name='LiverMass' totalMass='1'/> <FixedConstraint name='LiverFixedConstraint' indices='49 53 71 73 109 133'/> <TetrahedronFEMForceField name='LiverFEM' method='large' template='Vec3d' youngModulus='3000' poissonRatio='0.4' computeGlobalMatrix='0'/> <Node name='LiverCol'> <MeshTopology src='@../../LiverColMesh'/> <MechanicalObject name='LiverColModel' src='@../../LiverColMesh'/> <TriangleCollisionModel contactStiffness='1000' contactFriction='0.5'/> <BarycentricMapping input='@../LiverDOFs' output='@LiverColModel'/> </Node> <Node name='LiverVis'> <OglModel name='LiverVisModel' src='@../../LiverVisMesh' color='0.78 0.27 0.27 1.00'/> <BarycentricMapping input='@../LiverDOFs' output='@LiverVisModel'/> </Node> </Node> <Node name="Trex"> <MechanicalObject name='TrexDOFs' template='Rigid3d' position="@TrexDriver.positionDevice"/> <MechanicalStateController template="Rigid3d" listening="true" mainDirection="-1.0 0.0 0.0" handleEventTriggersUpdate="true"/> <Node name="TrexVis" activated="true" > <MeshObjLoader name='loader' filename='../../mesh/InstrumentPoke/InstrVis.obj'/> <OglModel name="TrexVisModel" src='@loader' color='0.17 1.00 1.00 1.00'/> <RigidMapping input='@../TrexDOFs' output='@TrexVisModel' index="0"/> </Node> <Node name="TrexRef"> <MeshObjLoader name='loader' filename='../../mesh/InstrumentPoke/InstrCol.obj'/> <MeshTopology src='@loader'/> <MechanicalObject name="TrexRefModel" src='@loader'/> <RigidMapping input='@../TrexDOFs' output='@TrexRefModel'/> </Node> </Node> <Node name="Instr"> <EulerImplicitSolver rayleighStiffness='0.1' rayleighMass='0.1'/> <CGLinearSolver threshold='1e-11' tolerance='1e-11' iterations='25'/> <MechanicalObject name='InstrDOFs' template='Rigid3d'/> <UniformMass name='InstrMass' totalMass='0.05'/> <LCPForceFeedback template="Rigid3d" name="ForceFeedback" listening="1" activate="1" forceCoef="1."/> <UncoupledConstraintCorrection/> <Node name='InstrVis'> <MeshObjLoader name='loader' filename='../../mesh/InstrumentPoke/InstrVis.obj'/> <OglModel name='InstrVisModel' src='@loader'/> <RigidMapping input='@../InstrDOFs' output='@InstrVisModel'/> </Node> <Node name='InstrCol'> <MeshObjLoader name='loader' filename='../../mesh/InstrumentPoke/InstrCol.obj'/> <MeshTopology src='@loader'/> <MechanicalObject name='InstrColModel' src='@loader'/> <PointCollisionModel contactStiffness='10' listRadius='0.0025'/> <RigidMapping input='@../InstrDOFs' output='@InstrColModel'/> </Node> <VectorSpringForceField name="vector" template="Vec3d" object1="@Trex/TrexRef/TrexRefModel" object2="@Instr/InstrCol/InstrColModel" stiffness="1000" viscosity="0" /> </Node> </Node>
11 June 2021 at 11:13 #19674HugoKeymasterHi @brunob81hk
it is strange that increasing the stiffness does not change the behavior here.
Could you try to remove the Rayleigh numerical damping (rayleighStiffness/rayleighMass set to 0 for the Instr) ?Best
Hugo
14 June 2021 at 20:39 #19699BrunoB81HKBlockedHi @hugo
When setting those to 0, the instrument will go thru the liver much faster. Normally, the force peak at 0.6N, but it now peak at ~0.16N
Just to be clear, the behavior change when I change the stiffness, the collision instrument is faster to follow the reference if I use a greater stiffness. It is just the computed force that stays the same. I feel like, if the spring between the reference and the collision instrument is bigger, the computed force should be greater for a given displacement. Am I wrong?
Thanks a lot for your help!
Bruno
25 June 2021 at 10:04 #19861HugoKeymasterHi @brunob81hk
When an object goes through another one, the problem might rather be due to the collision detection and the associated numerical settings (contact/alarm distance, time step).
Regarding your last question: I do not think that increasing the stiffness of the spring should result in greater force. This spring is only here for haptic stability and making sure that your virtual haptic object follows (more or less closely depending on the stiffness) the real position of the haptic interface.
If you want to increase the force, you must change the compliance matrix computed by the ConstraintCorrection in your scene.
Let me know if it helps!
BestHugo
25 June 2021 at 20:04 #19873BrunoB81HKBlocked5 July 2021 at 14:41 #19925HugoKeymaster5 July 2021 at 15:45 #19933BrunoB81HKBlockedHi @hugo,
Sorry for the late answer. It seems your fix is working. I changed the following line
<UncoupledConstraintCorrection/>
to
<UncoupledConstraintCorrection compliance="0.5 0.5 0.0 0.0 0.5 0.0 0.5"/>
I will take the time to play with the values more to determine which is the best for me.
Thanks a lot for your help!
Bruno
-
AuthorPosts
- You must be logged in to reply to this topic.