PrecomputedConstraintCorrection make all the models in the scene dissapears #2624
-
Hi everyone, I'm currently building a simulation and I came across this problem. I'm simulation a laparoscopy intervention with one or two instruments. In those simulations, only one instrument have a force feedback. For this, I have 2 different code fragment. When I'm using the code for one instrument, I use a The problem is that, with an Is there any way that I can use a Here is my current codes (the One instrument<Node name="Instruments">
<!-- Load all the meshes -->
<MeshObjLoader name="ShaftVisMesh" filename="../../mesh/Instrument/Shaft.obj"/>
<MeshObjLoader name="LeftVisMesh" filename="../../mesh/Instrument/PokeL.obj"/>
<MeshObjLoader name="RightVisMesh" filename="../../mesh/Instrument/PokeR.obj"/>
<MeshObjLoader name="JawColMesh" filename="../../mesh/Instrument/JawCol.obj"/>
<Node name="Trex">
<EulerImplicitSolver rayleighMass="0.1" rayleighStiffness="0.01"/>
<CGLinearSolver iterations="40" tolerance="1.0e-9" threshold="1.0e-15"/>
<MechanicalObject name="Bati" template="Rigid3d" position="0 0 0 0 0 0 1" rest_position="@TrexDriver.trexPosition"/>
<UniformMass totalMass="0.01"/>
<!-- The force feedback component -->
<LCPForceFeedback name="ForceFeedBack" template="Rigid3d" activate="1" forceCoef="10.0"/>
<!-- Forcefield to link the Trex position with instrument base position -->
<RestShapeSpringsForceField points="0" stiffness="1000" angularStiffness="1000000000"/>
<PrecomputedConstraintCorrection recompute="true"/>
<Node name="Grasper">
<!-- Mechanical object containing the 2 articulations -->
<MechanicalObject name="Articulations" template="Vec1d" position="0 0" rest_position="@TrexDriver.trexPliersAngles"/>
<!-- Forcefield to link the desired joint angle to the jaws angle -->
<RestShapeSpringsForceField points="0 1" stiffness="1000000 1000000"/>
<UncoupledConstraintCorrection compliance="0.000001 0.000001"/>
<Node name="Jaws">
<MechanicalObject name="GrasperDOFs" template="Rigid3d" position="0 0 0 0 0 0 1 0 0 0 0 0 0 1 0 0 0 0 0 0 1"/>
<!-- The point where the instrument grabs -->
<Node name="GrabPoint">
<MechanicalObject position="-0.02 0 0 1 0 0 0"/>
<PointCollisionModel group="1" tags="TrexCol" contactStiffness="10.0"/>
<RigidMapping input="@.." index="0"/>
</Node>
<Node name="ShaftVisual">
<OglModel name="model" src="@/Instruments/ShaftVisMesh"/>
<RigidMapping input="@.." output="@model" index="0"/>
</Node>
<Node name="LeftVisual">
<OglModel name="model" src="@/Instruments/LeftVisMesh"/>
<RigidMapping input="@.." output="@model" index="1"/>
</Node>
<Node name="RightVisual">
<OglModel name="model" src="@/Instruments/RightVisMesh"/>
<RigidMapping input="@.." output="@model" index="2"/>
</Node>
<Node name="LeftCollision">
<MeshTopology src="@/Instruments/JawColMesh"/>
<MechanicalObject name="model" src="@/Instruments/JawColMesh"/>
<LineCollisionModel moving="1" simulated="1" group="1"/>
<PointCollisionModel moving="1" simulated="1" group="1"/>
<RigidMapping input="@.." output="@model" index="1"/>
</Node>
<Node name="RightCollision">
<MeshTopology src="@/Instruments/JawColMesh"/>
<MechanicalObject name="model" src="@/Instruments/JawColMesh"/>
<LineCollisionModel moving="1" simulated="1" group="1"/>
<PointCollisionModel moving="1" simulated="1" group="1"/>
<RigidMapping input="@.." output="@model" index="2"/>
</Node>
<ArticulatedSystemMapping input1="@../Articulations" output="@GrasperDOFs" input2="@../../Bati"/>
</Node>
<ArticulatedHierarchyContainer/>
<!-- Articulations definitions -->
<Node name="articulationCenters">
<Node name="articulationCenterLeft">
<ArticulationCenter parentIndex="0" childIndex="1" posOnParent="0 0 0" posOnChild="0 0 0"/>
<Node name="articulations">
<Articulation translation="0" rotation="1" rotationAxis="0 0 1" articulationIndex="0"/>
</Node>
</Node>
<Node name="articulationCenterRight">
<ArticulationCenter parentIndex="0" childIndex="2" posOnParent="0 0 0" posOnChild="0 0 0"/>
<Node name="articulations">
<Articulation translation="0" rotation="1" rotationAxis="0 0 1" articulationIndex="1"/>
</Node>
</Node>
</Node>
</Node>
</Node>
</Node> Two instruments<Node name="Instruments">
<!-- Load all the meshes -->
<MeshObjLoader name="ShaftVisMesh" filename="../../mesh/Instrument/Shaft.obj"/>
<MeshObjLoader name="LeftVisMesh" filename="../../mesh/Instrument/PokeL.obj"/>
<MeshObjLoader name="RightVisMesh" filename="../../mesh/Instrument/PokeR.obj"/>
<MeshObjLoader name="JawColMesh" filename="../../mesh/Instrument/JawCol.obj"/>
<Node name="Trex">
<EulerImplicitSolver rayleighMass="0.1" rayleighStiffness="0.01"/>
<CGLinearSolver iterations="40" tolerance="1.0e-9" threshold="1.0e-15"/>
<MechanicalObject name="Bati" template="Rigid3d" position="-0.02 -0.05 0.15 0 0 0 1" rest_position="@TrexDriver.trexPosition"/>
<UniformMass totalMass="0.01"/>
<!-- The force feedback component -->
<LCPForceFeedback name="ForceFeedBack" template="Rigid3d" activate="1" forceCoef="10.0"/>
<!-- Forcefield to link the Trex position with instrument base position -->
<RestShapeSpringsForceField points="0" stiffness="1000" angularStiffness="1000000000"/>
<UncoupledConstraintCorrection compliance="0.0001 0.000000001 0 0 0.000000001 0 0.000000001"/>
<Node name="Grasper">
<!-- Mechanical object containing the 2 articulations -->
<MechanicalObject name="Articulations" template="Vec1d" position="0 0" rest_position="@TrexDriver.trexPliersAngles"/>
<!-- Forcefield to link the desired joint angle to the jaws angle -->
<RestShapeSpringsForceField points="0 1" stiffness="1000000 1000000"/>
<UncoupledConstraintCorrection compliance="0.000001 0.000001"/>
<Node name="Jaws">
<MechanicalObject name="GrasperDOFs" template="Rigid3d" position="0 0 0 0 0 0 1 0 0 0 0 0 0 1 0 0 0 0 0 0 1"/>
<!-- The point where the instrument grabs -->
<Node name="GrabPoint">
<MechanicalObject position="-0.02 0 0 1 0 0 0"/>
<PointCollisionModel group="1" tags="TrexCol" contactStiffness="10.0"/>
<RigidMapping input="@.." index="0"/>
</Node>
<Node name="ShaftVisual">
<OglModel name="model" src="@/Instruments/ShaftVisMesh"/>
<RigidMapping input="@.." output="@model" index="0"/>
</Node>
<Node name="LeftVisual">
<OglModel name="model" src="@/Instruments/LeftVisMesh"/>
<RigidMapping input="@.." output="@model" index="1"/>
</Node>
<Node name="RightVisual">
<OglModel name="model" src="@/Instruments/RightVisMesh"/>
<RigidMapping input="@.." output="@model" index="2"/>
</Node>
<Node name="LeftCollision">
<MeshTopology src="@/Instruments/JawColMesh"/>
<MechanicalObject name="model" src="@/Instruments/JawColMesh"/>
<LineCollisionModel moving="1" simulated="1" group="1"/>
<PointCollisionModel moving="1" simulated="1" group="1"/>
<RigidMapping input="@.." output="@model" index="1"/>
</Node>
<Node name="RightCollision">
<MeshTopology src="@/Instruments/JawColMesh"/>
<MechanicalObject name="model" src="@/Instruments/JawColMesh"/>
<LineCollisionModel moving="1" simulated="1" group="1"/>
<PointCollisionModel moving="1" simulated="1" group="1"/>
<RigidMapping input="@.." output="@model" index="2"/>
</Node>
<ArticulatedSystemMapping input1="@../Articulations" output="@GrasperDOFs" input2="@../../Bati"/>
</Node>
<ArticulatedHierarchyContainer/>
<!-- Articulations definitions -->
<Node name="articulationCenters">
<Node name="articulationCenterLeft">
<ArticulationCenter parentIndex="0" childIndex="1" posOnParent="0 0 0" posOnChild="0 0 0"/>
<Node name="articulations">
<Articulation translation="0" rotation="1" rotationAxis="0 0 1" articulationIndex="0"/>
</Node>
</Node>
<Node name="articulationCenterRight">
<ArticulationCenter parentIndex="0" childIndex="2" posOnParent="0 0 0" posOnChild="0 0 0"/>
<Node name="articulations">
<Articulation translation="0" rotation="1" rotationAxis="0 0 1" articulationIndex="1"/>
</Node>
</Node>
</Node>
</Node>
</Node>
<Node name="Dummy">
<EulerImplicitSolver rayleighMass="0.1" rayleighStiffness="0.01"/>
<CGLinearSolver iterations="40" tolerance="1.0e-9" threshold="1.0e-15"/>
<MechanicalObject name="Bati" template="Rigid3d" position="-0.02 0.05 0.15 0 0 0 1" rest_position="@TrexDriver.dummyPosition"/>
<UniformMass totalMass="0.01"/>
<!-- Forcefield to link the Dummy position with instrument base position -->
<RestShapeSpringsForceField points="0" stiffness="1000" angularStiffness="1000000000"/>
<UncoupledConstraintCorrection compliance="0.0001 0.000000001 0 0 0.000000001 0 0.000000001"/>
<Node name="Grasper">
<!-- Mechanical object containing the 2 articulations -->
<MechanicalObject name="Articulations" template="Vec1d" position="0 0" rest_position="@TrexDriver.dummyPliersAngles"/>
<!-- Forcefield to link the desired joint angle to the jaws angle -->
<RestShapeSpringsForceField points="0 1" stiffness="1000000 1000000"/>
<UncoupledConstraintCorrection compliance="0.000001 0.000001"/>
<Node name="Jaws">
<MechanicalObject name="GrasperDOFs" template="Rigid3d" position="0 0 0 0 0 0 1 0 0 0 0 0 0 1 0 0 0 0 0 0 1"/>
<!-- The point where the instrument grabs -->
<Node name="GrabPoint">
<MechanicalObject position="-0.02 0 0 1 0 0 0"/>
<PointCollisionModel group="2" tags="DummyCol" contactStiffness="10.0"/>
<RigidMapping input="@.." index="0"/>
</Node>
<Node name="ShaftVisual">
<OglModel name="model" src="@/Instruments/ShaftVisMesh"/>
<RigidMapping input="@.." output="@model" index="0"/>
</Node>
<Node name="LeftVisual">
<OglModel name="model" src="@/Instruments/LeftVisMesh"/>
<RigidMapping input="@.." output="@model" index="1"/>
</Node>
<Node name="RightVisual">
<OglModel name="model" src="@/Instruments/RightVisMesh"/>
<RigidMapping input="@.." output="@model" index="2"/>
</Node>
<Node name="LeftCollision">
<MeshTopology src="@/Instruments/JawColMesh"/>
<MechanicalObject name="model" src="@/Instruments/JawColMesh"/>
<LineCollisionModel moving="1" simulated="1" group="2"/>
<PointCollisionModel moving="1" simulated="1" group="2"/>
<RigidMapping input="@.." output="@model" index="1"/>
</Node>
<Node name="RightCollision">
<MeshTopology src="@/Instruments/JawColMesh"/>
<MechanicalObject name="model" src="@/Instruments/JawColMesh"/>
<LineCollisionModel moving="1" simulated="1" group="2"/>
<PointCollisionModel moving="1" simulated="1" group="2"/>
<RigidMapping input="@.." output="@model" index="2"/>
</Node>
<ArticulatedSystemMapping input1="@../Articulations" output="@GrasperDOFs" input2="@../../Bati"/>
</Node>
<ArticulatedHierarchyContainer/>
<!-- Articulations definitions -->
<Node name="articulationCenters">
<Node name="articulationCenterLeft">
<ArticulationCenter parentIndex="0" childIndex="1" posOnParent="0 0 0" posOnChild="0 0 0"/>
<Node name="articulations">
<Articulation translation="0" rotation="1" rotationAxis="0 0 1" articulationIndex="0"/>
</Node>
</Node>
<Node name="articulationCenterRight">
<ArticulationCenter parentIndex="0" childIndex="2" posOnParent="0 0 0" posOnChild="0 0 0"/>
<Node name="articulations">
<Articulation translation="0" rotation="1" rotationAxis="0 0 1" articulationIndex="1"/>
</Node>
</Node>
</Node>
</Node>
</Node>
</Node> UsingSOFA v21.06 |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 8 replies
-
Thanks a lot @BrunoB81HK for reporting your issue. However, I am not familiar working with two haptic devices but @epernod is. Erik how do you handle such two-haptic-device force feedback? Some vague memory tells me you faced this topic as well .. |
Beta Was this translation helpful? Give feedback.
Thanks a lot @BrunoB81HK for reporting your issue.
Choosing by default a full construction of the compliance matrix (precomputed in your case using the
PrecomputedConstraintCorrection
) is a very good practice.However, I am not familiar working with two haptic devices but @epernod is. Erik how do you handle such two-haptic-device force feedback? Some vague memory tells me you faced this topic as well ..