diff --git a/examples/component/constraint/CableConstraint/CableSmoothActuation.py b/examples/component/constraint/CableConstraint/CableSmoothActuation.py index 30ea4db1..534cf787 100644 --- a/examples/component/constraint/CableConstraint/CableSmoothActuation.py +++ b/examples/component/constraint/CableConstraint/CableSmoothActuation.py @@ -53,7 +53,7 @@ def createScene(rootNode): bunny.addObject('FastTetrahedralCorotationalForceField', template='Vec3', name='FEM', method='large', poissonRatio='0.3', youngModulus='10000') bunny.addObject('BoxROI', name='boxROI', box=[-5, -5.0, -5, 5, -4.5, 5], drawBoxes=True) - bunny.addObject('RestShapeSpringsForceField', points='@boxROI.indices', stiffness='1e12') + bunny.addObject('FixedWeakConstraint', indices='@boxROI.indices', stiffness='1e12') bunny.addObject('GenericConstraintCorrection') diff --git a/examples/component/constraint/CableConstraint/Finger.py b/examples/component/constraint/CableConstraint/Finger.py index 57def8b5..c161ae88 100644 --- a/examples/component/constraint/CableConstraint/Finger.py +++ b/examples/component/constraint/CableConstraint/Finger.py @@ -73,10 +73,10 @@ def createScene(rootNode): # RestShapeSpringsForceField is one way in Sofa to implement fixed point constraint. # Here the constraints are applied to the DoFs selected by the previously defined BoxROI - finger.addObject('RestShapeSpringsForceField', points=finger.roi.indices.getLinkPath(), stiffness=1e12) + finger.addObject('FixedWeakConstraint', indices=finger.roi.indices.getLinkPath(), stiffness=1e12) # It is also possible to simply set by hand the indices of the points you want to fix. - # finger.addObject('RestShapeSpringsForceField', points=[0, 1, 2, 11, 55], stiffness=1e12) + # finger.addObject('RestShapeSpringsForceField', indices=[0, 1, 2, 11, 55], stiffness=1e12) finger.addObject('GenericConstraintCorrection') diff --git a/examples/component/constraint/CableConstraint/FingerWithSTLIB.py b/examples/component/constraint/CableConstraint/FingerWithSTLIB.py index 98e256b4..0eb950dd 100644 --- a/examples/component/constraint/CableConstraint/FingerWithSTLIB.py +++ b/examples/component/constraint/CableConstraint/FingerWithSTLIB.py @@ -56,7 +56,7 @@ def createScene(rootNode): # RestShapeSpringsForceField is one way in Sofa to implement fixed point constraint. # Here the constraints are applied to the DoFs selected by the previously defined BoxROI - finger.addObject('RestShapeSpringsForceField', points='@ROI1.indices', stiffness=1e12) + finger.addObject('FixedWeakConstraint', indices='@ROI1.indices', stiffness=1e12) ########################################## # Cable # diff --git a/examples/component/constraint/JointConstraint/JointConstraint.py b/examples/component/constraint/JointConstraint/JointConstraint.py index d96431ba..7f023a7d 100644 --- a/examples/component/constraint/JointConstraint/JointConstraint.py +++ b/examples/component/constraint/JointConstraint/JointConstraint.py @@ -38,7 +38,7 @@ def createScene(rootNode): object = simulation.addChild('Object') object.addObject('MechanicalObject', template='Vec1', position=0.) - object.addObject("RestShapeSpringsForceField", points=[0], stiffness=1e1) + object.addObject("FixedWeakConstraint", indices=[0], stiffness=1e1) # Try to change the data field "value" from the GUI object.addObject('JointConstraint', template='Vec1', index=0, value=0, valueType="displacement", minDisplacement=-pi, maxDisplacement=pi) diff --git a/examples/component/constraint/SurfacePressureConstraint/Springy.py b/examples/component/constraint/SurfacePressureConstraint/Springy.py index 47cdec2a..19fd864e 100644 --- a/examples/component/constraint/SurfacePressureConstraint/Springy.py +++ b/examples/component/constraint/SurfacePressureConstraint/Springy.py @@ -55,7 +55,7 @@ def createScene(rootNode): youngModulus=500) accordion.addObject('BoxROI', name='ROI1', box=[-2, -2, 0, 2, 2, 0.5], drawBoxes=True) - accordion.addObject('RestShapeSpringsForceField', points='@ROI1.indices', stiffness=1e12) + accordion.addObject('FixedWeakConstraint', indices='@ROI1.indices', stiffness=1e12) # accordion.addObject('FixedProjectiveConstraint', indices='@ROI1.indices') accordion.addObject('LinearSolverConstraintCorrection') diff --git a/examples/component/constraint/SurfacePressureConstraint/SurfacePressureConstraint.py b/examples/component/constraint/SurfacePressureConstraint/SurfacePressureConstraint.py index 51ca68f5..b03e88ef 100644 --- a/examples/component/constraint/SurfacePressureConstraint/SurfacePressureConstraint.py +++ b/examples/component/constraint/SurfacePressureConstraint/SurfacePressureConstraint.py @@ -49,7 +49,7 @@ def createScene(rootNode): bunny.addObject('BoxROI', name='boxROI', box=[-5, -7, -5, 5, -4.5, 5], drawBoxes=True, position="@tetras.rest_position", tetrahedra="@container.tetrahedra") - bunny.addObject('RestShapeSpringsForceField', points='@boxROI.indices', stiffness=1e12) + bunny.addObject('FixedWeakConstraint', indices='@boxROI.indices', stiffness=1e12) bunny.addObject('LinearSolverConstraintCorrection') # bunny/cavity diff --git a/examples/component/constraint/UnilateralPlaneConstraint/ArticulatedTentacle.py b/examples/component/constraint/UnilateralPlaneConstraint/ArticulatedTentacle.py index b4e3223b..29832ae0 100644 --- a/examples/component/constraint/UnilateralPlaneConstraint/ArticulatedTentacle.py +++ b/examples/component/constraint/UnilateralPlaneConstraint/ArticulatedTentacle.py @@ -63,7 +63,7 @@ def createScene(rootNode): tentacle.addObject('TetrahedronFEMForceField', template='Vec3', name='FEM', method='large', poissonRatio=0.3, youngModulus=200) tentacle.addObject('BoxROI', name='ROI1', box=[[50, -20, 30],[75, 20, 50]], drawBoxes=True) - tentacle.addObject('RestShapeSpringsForceField', points='@ROI1.indices', stiffness=1e12) + tentacle.addObject('FixedWeakConstraint', indices='@ROI1.indices', stiffness=1e12) tentacle.addObject('LinearSolverConstraintCorrection') diff --git a/examples/component/controller/CommunicationController/modules/accordion3.py b/examples/component/controller/CommunicationController/modules/accordion3.py index d40c1f5c..940bc753 100644 --- a/examples/component/controller/CommunicationController/modules/accordion3.py +++ b/examples/component/controller/CommunicationController/modules/accordion3.py @@ -13,7 +13,7 @@ def addAccordion(node, inverse=False): accordion.addObject('UniformMass', totalMass=0.030) accordion.addObject('TetrahedronFEMForceField', template='Vec3', name='FEM', method='large', poissonRatio=0.3, youngModulus=500) accordion.addObject('BoxROI', name='ROI1', box=[-2, -2, 0, 2, 2, 0.5], drawBoxes=True) - accordion.addObject('RestShapeSpringsForceField', points='@ROI1.indices', stiffness=1e12) + accordion.addObject('FixedWeakConstraint', indices='@ROI1.indices', stiffness=1e12) accordion.addObject('LinearSolverConstraintCorrection') # Pressure diff --git a/examples/component/controller/DataVariationLimiter/DataVariationLimiter.py b/examples/component/controller/DataVariationLimiter/DataVariationLimiter.py index da4c5c37..e88eb1ac 100644 --- a/examples/component/controller/DataVariationLimiter/DataVariationLimiter.py +++ b/examples/component/controller/DataVariationLimiter/DataVariationLimiter.py @@ -94,7 +94,7 @@ def createScene(rootNode): youngModulus=500) accordion.addObject('BoxROI', name='ROI1', box=[-2, -2, 0, 2, 2, 0.5], drawBoxes=True) - accordion.addObject('RestShapeSpringsForceField', points='@ROI1.indices', stiffness=1e12) + accordion.addObject('FixedWeakConstraint', indices='@ROI1.indices', stiffness=1e12) accordion.addObject('LinearSolverConstraintCorrection') diff --git a/examples/thematicalDocs/T1-Elements_TetraHexaBeam/Beam/Beam.py b/examples/thematicalDocs/T1-Elements_TetraHexaBeam/Beam/Beam.py index 823e9567..684d799e 100644 --- a/examples/thematicalDocs/T1-Elements_TetraHexaBeam/Beam/Beam.py +++ b/examples/thematicalDocs/T1-Elements_TetraHexaBeam/Beam/Beam.py @@ -36,7 +36,7 @@ def createScene(rootNode): beam.addObject('BeamInterpolation', name='interpol', crossSectionShape='rectangular', lengthY=5, lengthZ=5, defaultYoungModulus=1.8e6) beam.addObject('AdaptiveBeamForceFieldAndMass', name="BeamForceField", computeMass=1, massDensity=0.001) - beam.addObject('RestShapeSpringsForceField', points=0, stiffness=100e10, angularStiffness=100e10) + beam.addObject('FixedWeakConstraint', indices=0, stiffness=100e10, angularStiffness=100e10) # Visualization visuNode = beam.addChild('visualization') diff --git a/examples/thematicalDocs/T4-DirectActuation/Actuators/Cable/CableDisplacement.py b/examples/thematicalDocs/T4-DirectActuation/Actuators/Cable/CableDisplacement.py index a67ebb8e..90ef2344 100644 --- a/examples/thematicalDocs/T4-DirectActuation/Actuators/Cable/CableDisplacement.py +++ b/examples/thematicalDocs/T4-DirectActuation/Actuators/Cable/CableDisplacement.py @@ -53,10 +53,10 @@ def createScene(rootNode): # RestShapeSpringsForceField is one way in Sofa to implement fixed point constraint. # Here the constraints are applied to the DoFs selected by the previously defined BoxROI - finger.addObject('RestShapeSpringsForceField', points='@ROI.indices', stiffness=1e12) + finger.addObject('FixedWeakConstraint', indices='@ROI.indices', stiffness=1e12) # It is also possible to simply set by hand the indices of the points you want to fix. - # finger.addObject('RestShapeSpringsForceField', points=[0, 1, 2, 11, 55], stiffness=1e12) + # finger.addObject('RestShapeSpringsForceField', indices=[0, 1, 2, 11, 55], stiffness=1e12) finger.addObject('LinearSolverConstraintCorrection') diff --git a/examples/thematicalDocs/T4-DirectActuation/Actuators/Cable/CableForce.py b/examples/thematicalDocs/T4-DirectActuation/Actuators/Cable/CableForce.py index 9269c1df..7fc37d20 100644 --- a/examples/thematicalDocs/T4-DirectActuation/Actuators/Cable/CableForce.py +++ b/examples/thematicalDocs/T4-DirectActuation/Actuators/Cable/CableForce.py @@ -50,7 +50,7 @@ def createScene(rootNode): # RestShapeSpringsForceField is one way in Sofa to implement fixed point constraint. # Here the constraints are applied to the DoFs selected by the previously defined BoxROI - finger.addObject('RestShapeSpringsForceField', points='@ROI.indices', stiffness=1e12) + finger.addObject('FixedWeakConstraint', indices='@ROI.indices', stiffness=1e12) finger.addObject('LinearSolverConstraintCorrection') diff --git a/examples/thematicalDocs/T4-DirectActuation/Actuators/Pneumatic/SurfaceConstraintPressure.py b/examples/thematicalDocs/T4-DirectActuation/Actuators/Pneumatic/SurfaceConstraintPressure.py index 726ea218..14e6c191 100644 --- a/examples/thematicalDocs/T4-DirectActuation/Actuators/Pneumatic/SurfaceConstraintPressure.py +++ b/examples/thematicalDocs/T4-DirectActuation/Actuators/Pneumatic/SurfaceConstraintPressure.py @@ -31,7 +31,7 @@ def createScene(rootNode): bunny.addObject('BoxROI', name='boxROI', box=[-5, -15, -5, 5, -4.5, 5], drawBoxes=True, position="@tetras.rest_position", tetrahedra="@container.tetrahedra") - bunny.addObject('RestShapeSpringsForceField', points='@boxROI.indices', stiffness=1e12) + bunny.addObject('FixedWeakConstraint', indices='@boxROI.indices', stiffness=1e12) bunny.addObject('LinearSolverConstraintCorrection') # bunny/cavity diff --git a/examples/thematicalDocs/T4-DirectActuation/Actuators/Pneumatic/SurfaceConstraintVolume.py b/examples/thematicalDocs/T4-DirectActuation/Actuators/Pneumatic/SurfaceConstraintVolume.py index fa3fa709..52bc52c4 100644 --- a/examples/thematicalDocs/T4-DirectActuation/Actuators/Pneumatic/SurfaceConstraintVolume.py +++ b/examples/thematicalDocs/T4-DirectActuation/Actuators/Pneumatic/SurfaceConstraintVolume.py @@ -29,7 +29,7 @@ def createScene(rootNode): bunny.addObject('BoxROI', name='boxROI', box=[-5, -15, -5, 5, -4.5, 5], drawBoxes=True, position="@tetras.rest_position", tetrahedra="@container.tetrahedra") - bunny.addObject('RestShapeSpringsForceField', points='@boxROI.indices', stiffness=1e12) + bunny.addObject('FixedWeakConstraint', indices='@boxROI.indices', stiffness=1e12) bunny.addObject('LinearSolverConstraintCorrection') # bunny/cavity diff --git a/examples/thematicalDocs/T4-DirectActuation/DriveTheRobot/Simulation.py b/examples/thematicalDocs/T4-DirectActuation/DriveTheRobot/Simulation.py index d5958820..fe404713 100644 --- a/examples/thematicalDocs/T4-DirectActuation/DriveTheRobot/Simulation.py +++ b/examples/thematicalDocs/T4-DirectActuation/DriveTheRobot/Simulation.py @@ -50,25 +50,9 @@ def createScene(rootNode): robot.addObject('LinearSolverConstraintCorrection') - leg0 = rootNode.addChild('RestPositionLeg0') - leg0.addObject('MechanicalObject', name='meca0', template='Vec3', showObject=True, showObjectScale=15, - showIndices=False, showIndicesScale=4e-5, - position='@../robot/boxROI1.pointsInROI') - leg1 = rootNode.addChild('RestPositionLeg1') - leg1.addObject('MechanicalObject', name='meca1', template='Vec3', showObject=True, showObjectScale=15, - showIndices=False, showIndicesScale=4e-5, - position='@../robot/boxROI2.pointsInROI') - leg2 = rootNode.addChild('RestPositionLeg2') - leg2.addObject('MechanicalObject', name='meca2', template='Vec3', showObject=True, showObjectScale=15, - showIndices=False, showIndicesScale=4e-5, - position='@../robot/boxROI3.pointsInROI') - - robot.addObject('RestShapeSpringsForceField', name='fixed1', points="@boxROI1.indices", - external_rest_shape="@RestPositionLeg0/meca0", stiffness=1e3) - robot.addObject('RestShapeSpringsForceField', name='fixed2', points="@boxROI2.indices", - external_rest_shape="@RestPositionLeg1/meca1", stiffness=1e3) - robot.addObject('RestShapeSpringsForceField', name='fixed3', points="@boxROI3.indices", - external_rest_shape="@RestPositionLeg2/meca2", stiffness=1e3) + robot.addObject('FixedWeakConstraint', name='fixed1', indices="@boxROI1.indices", stiffness=1e3) + robot.addObject('FixedWeakConstraint', name='fixed2', indices="@boxROI2.indices", stiffness=1e3) + robot.addObject('FixedWeakConstraint', name='fixed3', indices="@boxROI3.indices", stiffness=1e3) ############################### # VISUAL MODEL diff --git a/examples/tutorials/PneunetGripper/details/step4-boundaryConditions.py b/examples/tutorials/PneunetGripper/details/step4-boundaryConditions.py index bbe188b2..3c0ef196 100644 --- a/examples/tutorials/PneunetGripper/details/step4-boundaryConditions.py +++ b/examples/tutorials/PneunetGripper/details/step4-boundaryConditions.py @@ -26,7 +26,7 @@ def createScene(rootNode): finger.addObject('UniformMass', totalMass=0.04) boxROISubTopo = finger.addObject('BoxROI', name='boxROISubTopo', box=[-100, 22.5, -8, -19, 28, 8], strict=False) boxROI = finger.addObject('BoxROI', name='boxROI', box=[-10, 0, -20, 0, 30, 20], drawBoxes=True) - finger.addObject('RestShapeSpringsForceField', points=boxROI.indices.linkpath, stiffness=1e12, angularStiffness=1e12) + finger.addObject('FixedWeakConstraint', indices=boxROI.indices.linkpath, stiffness=1e12, angularStiffness=1e12) modelSubTopo = finger.addChild('SubTopology') modelSubTopo.addObject('MeshTopology', position='@loader.position', name='container', diff --git a/examples/tutorials/PneunetGripper/details/step5-timeIntegrationAndMatrixSolver.py b/examples/tutorials/PneunetGripper/details/step5-timeIntegrationAndMatrixSolver.py index 089b2a22..782ed65d 100644 --- a/examples/tutorials/PneunetGripper/details/step5-timeIntegrationAndMatrixSolver.py +++ b/examples/tutorials/PneunetGripper/details/step5-timeIntegrationAndMatrixSolver.py @@ -32,7 +32,7 @@ def createScene(rootNode): finger.addObject('UniformMass', totalMass=0.04) boxROISubTopo = finger.addObject('BoxROI', name='boxROISubTopo', box=[-100, 22.5, -8, -19, 28, 8], strict=False) boxROI = finger.addObject('BoxROI', name='boxROI', box=[-10, 0, -20, 0, 30, 20], drawBoxes=True) - finger.addObject('RestShapeSpringsForceField', points=boxROI.indices.linkpath, stiffness=1e12, angularStiffness=1e12) + finger.addObject('FixedWeakConstraint', indices=boxROI.indices.linkpath, stiffness=1e12, angularStiffness=1e12) modelSubTopo = finger.addChild('SubTopology') modelSubTopo.addObject('MeshTopology', position='@loader.position', tetrahedra=boxROISubTopo.tetrahedraInROI.linkpath, diff --git a/examples/tutorials/PneunetGripper/details/step6-pneumaticActuatorAndPythonScriptController.py b/examples/tutorials/PneunetGripper/details/step6-pneumaticActuatorAndPythonScriptController.py index f8ae1416..c297fd02 100644 --- a/examples/tutorials/PneunetGripper/details/step6-pneumaticActuatorAndPythonScriptController.py +++ b/examples/tutorials/PneunetGripper/details/step6-pneumaticActuatorAndPythonScriptController.py @@ -38,7 +38,7 @@ def createScene(rootNode): finger.addObject('UniformMass', totalMass=0.04) boxROISubTopo = finger.addObject('BoxROI', name='boxROISubTopo', box=[-100, 22.5, -8, -19, 28, 8], strict=False) boxROI = finger.addObject('BoxROI', name='boxROI', box=[-10, 0, -20, 0, 30, 20], drawBoxes=True) - finger.addObject('RestShapeSpringsForceField', points=boxROI.indices.linkpath, stiffness=1e12, angularStiffness=1e12) + finger.addObject('FixedWeakConstraint', indices=boxROI.indices.linkpath, stiffness=1e12, angularStiffness=1e12) finger.addObject('GenericConstraintCorrection') modelSubTopo = finger.addChild('SubTopology') diff --git a/examples/tutorials/PneunetGripper/details/step7-grabTheCube.py b/examples/tutorials/PneunetGripper/details/step7-grabTheCube.py index 831d5fd0..426e2ce2 100644 --- a/examples/tutorials/PneunetGripper/details/step7-grabTheCube.py +++ b/examples/tutorials/PneunetGripper/details/step7-grabTheCube.py @@ -114,8 +114,8 @@ def createScene(rootNode): if i == 0: boxROI = finger.addObject('BoxROI', name='boxROI', box=[-10, 0, -20, 0, 30, 20], doUpdate=False) boxROISubTopo = finger.addObject('BoxROI', name='boxROISubTopo', box=[-100, 22.5, -8, -19, 28, 8], strict=False) - finger.addObject('RestShapeSpringsForceField', - points=boxROI.indices.linkpath, + finger.addObject('FixedWeakConstraint', + indices=boxROI.indices.linkpath, stiffness=1e12, angularStiffness=1e12) finger.addObject('GenericConstraintCorrection') diff --git a/examples/tutorials/PneunetGripper/details/step7-withSTLIB.py b/examples/tutorials/PneunetGripper/details/step7-withSTLIB.py index 5d3d5971..5b6aabb6 100644 --- a/examples/tutorials/PneunetGripper/details/step7-withSTLIB.py +++ b/examples/tutorials/PneunetGripper/details/step7-withSTLIB.py @@ -75,7 +75,7 @@ def createScene(rootNode): finger.integration.rayleighMass = 0.1 finger.addObject('BoxROI', name='boxROI', box=fingersParameters[i]['ROIBox'], drawBoxes=True, doUpdate=False) - finger.addObject('RestShapeSpringsForceField', points='@../Finger1/boxROI.indices', stiffness=1e12, + finger.addObject('FixedWeakConstraint', indices='@../Finger1/boxROI.indices', stiffness=1e12, angularStiffness=1e12) PneumaticCavity(surfaceMeshFileName=fingersCavitySurfaceMesh, diff --git a/examples/tutorials/PneunetGripper/pneunetgripper-tuto.html b/examples/tutorials/PneunetGripper/pneunetgripper-tuto.html index 099151bc..bc2a557f 100644 --- a/examples/tutorials/PneunetGripper/pneunetgripper-tuto.html +++ b/examples/tutorials/PneunetGripper/pneunetgripper-tuto.html @@ -105,9 +105,9 @@

Stiff layer

modelSubTopo.addObject('TetrahedronFEMForceField', template='Vec3d', name='FEM', method='large', poissonRatio=0.3, youngModulus=1500)

Step3

Boundary Conditions

-

To fix the finger in space, it is necessary to define boundary conditions on some parts of the object. This can be done in several ways in SOFA. In this case, we use the component RestShapeSpringsForceField, which creates springs between the current position of a part of the body and its initial position. The stiffness of these springs can be adjusted. In particular, setting a very large stiffness will be equivalent to fixing the points in space. To easily define the indices of the points which will be fixed, we use the boxROI component:

+

To fix the finger in space, it is necessary to define boundary conditions on some parts of the object. This can be done in several ways in SOFA. In this case, we use the component FixedWeakConstraint, which creates springs between the current position of a part of the body and its initial position. The stiffness of these springs can be adjusted. In particular, setting a very large stiffness will be equivalent to fixing the points in space. To easily define the indices of the points which will be fixed, we use the boxROI component:

finger.addObject('BoxROI', name='boxROI', box=[-10, 0, -20, 0, 30, 20])
-finger.addObject('RestShapeSpringsForceField', points='@boxROI.indices', stiffness=1e12, angularStiffness=1e12)
+finger.addObject('FixedWeakConstraint', indices='@boxROI.indices', stiffness=1e12, angularStiffness=1e12)

Step4

Implicit Time Integration and Matrix Solver

Now that all the minimal elements of the scene have been described, it is already possible to simulate the deformation of the finger. To do that, we need to define a time integration scheme, which will define the system to be solved at each time step of the simulation, as well as a matrix solver, to solve that system and compute the updated velocities and positions of the nodes of the robot. In this case, we choose to use an Implicit Euler Scheme and a sparse direct Solver base on an LDL matrix decomposition:

@@ -271,9 +271,9 @@

Appendix

finger.addObject('BoxROI', name='boxROI', box=[-10, 0, -20, 0, 30, 20]) finger.addObject('BoxROI', name='boxROISubTopo', box=[-100, 22.5, -8, -19, 28, 8], strict=False) if i == 0: - finger.addObject('RestShapeSpringsForceField', points='@boxROI.indices', stiffness=1e12, angularStiffness=1e12) + finger.addObject('FixedWeakConstraint', indices='@boxROI.indices', stiffness=1e12, angularStiffness=1e12) else: - finger.addObject('RestShapeSpringsForceField', points='@../finger1/boxROI.indices', stiffness=1e12, angularStiffness=1e12) + finger.addObject('FixedWeakConstraint', indices='@../finger1/boxROI.indices', stiffness=1e12, angularStiffness=1e12) finger.addObject('LinearSolverConstraintCorrection', solverName='preconditioner') diff --git a/examples/tutorials/PneunetGripper/pneunetgripper-tuto.md b/examples/tutorials/PneunetGripper/pneunetgripper-tuto.md index 060053bf..02304e73 100644 --- a/examples/tutorials/PneunetGripper/pneunetgripper-tuto.md +++ b/examples/tutorials/PneunetGripper/pneunetgripper-tuto.md @@ -57,12 +57,12 @@ modelSubTopo.addObject('TetrahedronFEMForceField', template='Vec3d', name='FEM', ## Boundary Conditions -To fix the finger in space, it is necessary to define boundary conditions on some parts of the object. This can be done in several ways in SOFA. In this case, we use the component RestShapeSpringsForceField, which creates springs between the current position of a part of the body and its initial position. The stiffness of these springs can be adjusted. In particular, setting a very large stiffness will be equivalent to fixing the points in space. +To fix the finger in space, it is necessary to define boundary conditions on some parts of the object. This can be done in several ways in SOFA. In this case, we use the component FixedWeakConstraint, which creates springs between the current position of a part of the body and its initial position. The stiffness of these springs can be adjusted. In particular, setting a very large stiffness will be equivalent to fixing the points in space. To easily define the indices of the points which will be fixed, we use the boxROI component: ```python finger.addObject('BoxROI', name='boxROI', box=[-10, 0, -20, 0, 30, 20]) -finger.addObject('RestShapeSpringsForceField', points='@boxROI.indices', stiffness=1e12, angularStiffness=1e12) +finger.addObject('FixedWeakConstraint', indices='@boxROI.indices', stiffness=1e12, angularStiffness=1e12) ``` [Step4](details/step4-boundaryConditions.py) @@ -286,9 +286,9 @@ def createScene(rootNode): finger.addObject('BoxROI', name='boxROI', box=[-10, 0, -20, 0, 30, 20]) finger.addObject('BoxROI', name='boxROISubTopo', box=[-100, 22.5, -8, -19, 28, 8], strict=False) if i == 0: - finger.addObject('RestShapeSpringsForceField', points='@boxROI.indices', stiffness=1e12, angularStiffness=1e12) + finger.addObject('FixedWeakConstraint', indices='@boxROI.indices', stiffness=1e12, angularStiffness=1e12) else: - finger.addObject('RestShapeSpringsForceField', points='@../finger1/boxROI.indices', stiffness=1e12, angularStiffness=1e12) + finger.addObject('FixedWeakConstraint', indices='@../finger1/boxROI.indices', stiffness=1e12, angularStiffness=1e12) finger.addObject('LinearSolverConstraintCorrection', solverName='preconditioner') diff --git a/examples/tutorials/SoftArmGripper/scene.py b/examples/tutorials/SoftArmGripper/scene.py index c0d11a4f..d014bc0b 100644 --- a/examples/tutorials/SoftArmGripper/scene.py +++ b/examples/tutorials/SoftArmGripper/scene.py @@ -39,7 +39,7 @@ def addArm(node): arm.addObject('MechanicalObject', template='Rigid3', name='dofs', showObject=True, showObjectScale=10) arm.addObject('UniformMass', indices=[4 * i + 1 for i in range(size)], totalMass=0.003 * size, showAxisSizeFactor=0.03) # set mass of each piece that connect the ribs - arm.addObject('RestShapeSpringsForceField', stiffness=1e12, angularStiffness=1e12, points=0) # fix base of the arm + arm.addObject('FixedWeakConstraint', stiffness=1e12, angularStiffness=1e12, indices=0) # fix base of the arm # sub topology to allow different ribs thickness for each section for i in range(params.Arm.nbSection): @@ -84,7 +84,7 @@ def addFinger(node, fingerId, translation, rotation): finger.addObject('TetrahedronFEMForceField', template='Vec3', name='FEM', method='large', poissonRatio=0.3, youngModulus=1.8e6) finger.addObject('BoxROI', name='boxROI', box=[-100, -20, -50, 100, 20, 50], drawBoxes=True) - finger.addObject('RestShapeSpringsForceField', points=finger.boxROI.indices.getLinkPath(), stiffness=1e12) + finger.addObject('FixedWeakConstraint', indices=finger.boxROI.indices.getLinkPath(), stiffness=1e12) visu[fingerId] = finger.addChild('Visualization') visu[fingerId].addObject('MeshSTLLoader', name="loader", filename=params.Simulation.path + "/mesh/finger.stl", diff --git a/examples/tutorials/SoftFingerDesign/details/fixing_box.py b/examples/tutorials/SoftFingerDesign/details/fixing_box.py index 4db1b924..53786b1c 100644 --- a/examples/tutorials/SoftFingerDesign/details/fixing_box.py +++ b/examples/tutorials/SoftFingerDesign/details/fixing_box.py @@ -20,6 +20,6 @@ def __init__(self, parent, target, name='FixingBox', c = self.node.addChild('Constraint') target.addChild(c) - c.addObject('RestShapeSpringsForceField', - points=self.node.BoxROI.getData('indices').getLinkPath(), + c.addObject('FixedWeakConstraint', + indices=self.node.BoxROI.getData('indices').getLinkPath(), stiffness=1e12) diff --git a/examples/tutorials/SoftFingerDesign/details/s90_servo.py b/examples/tutorials/SoftFingerDesign/details/s90_servo.py index 0c7a81c0..fd4e443e 100644 --- a/examples/tutorials/SoftFingerDesign/details/s90_servo.py +++ b/examples/tutorials/SoftFingerDesign/details/s90_servo.py @@ -74,7 +74,7 @@ def init(self): angle = self.addChild('Articulation') angle.addObject('MechanicalObject', name='dofs', template='Vec1', position=[[self.getData('angleIn')]], rest_position=self.getData('angleIn').getLinkPath()) - angle.addObject('RestShapeSpringsForceField', points=0, stiffness=1e9) + angle.addObject('FixedWeakConstraint', indices=0, stiffness=1e9) angle.addObject('UniformMass', totalMass=0.01) servoWheel = angle.addChild('ServoWheel') diff --git a/examples/tutorials/Tripod/details/closedLoopController.py b/examples/tutorials/Tripod/details/closedLoopController.py index 7b0c2c42..a220d028 100644 --- a/examples/tutorials/Tripod/details/closedLoopController.py +++ b/examples/tutorials/Tripod/details/closedLoopController.py @@ -172,7 +172,7 @@ def onKeypressedEvent(self, event): key = event['key'] if key == Key.I: for i in range(3): - self.nodeTripod.actuatedarms[i].ServoMotor.Articulation.RestShapeSpringsForceField.stiffness.value = [ + self.nodeTripod.actuatedarms[i].ServoMotor.Articulation.FixedWeakConstraint.stiffness.value = [ 0.] self.activate = True for node in self.nodesInverseComponents: diff --git a/examples/tutorials/Tripod/details/fixingbox.py b/examples/tutorials/Tripod/details/fixingbox.py index 5eb73d56..a8bba702 100644 --- a/examples/tutorials/Tripod/details/fixingbox.py +++ b/examples/tutorials/Tripod/details/fixingbox.py @@ -17,7 +17,7 @@ def FixingBox(parent, target, name='FixingBox', c = self.addChild('Constraint') target.addChild(c) - c.addObject('RestShapeSpringsForceField', - points=self.BoxROI.getData('indices').getLinkPath(), + c.addObject('FixedWeakConstraint', + indices=self.BoxROI.getData('indices').getLinkPath(), stiffness=1e12) return self diff --git a/examples/tutorials/Tripod/details/maze.py b/examples/tutorials/Tripod/details/maze.py index b751b25e..9062df5b 100644 --- a/examples/tutorials/Tripod/details/maze.py +++ b/examples/tutorials/Tripod/details/maze.py @@ -78,7 +78,7 @@ def createScene(rootNode): effector.addObject('CGLinearSolver', iterations=100, threshold=1e-5, tolerance=1e-5) effector.addObject('MechanicalObject', template='Rigid3', name='goalMO', position=[0, 40, 0, 0, 0, 0, 1], showObject=True, showObjectScale=10) - effector.addObject('RestShapeSpringsForceField', points=0, angularStiffness=1e5, stiffness=1e5) + effector.addObject('FixedWeakConstraint', indices=0, angularStiffness=1e5, stiffness=1e5) effector.addObject('UncoupledConstraintCorrection', compliance='1e-10 1e-10 0 0 1e-10 0 1e-10 ') # Open maze planning from JSON file diff --git a/examples/tutorials/Tripod/details/s90servo.py b/examples/tutorials/Tripod/details/s90servo.py index 42ef2332..ca7c6fdc 100644 --- a/examples/tutorials/Tripod/details/s90servo.py +++ b/examples/tutorials/Tripod/details/s90servo.py @@ -75,7 +75,7 @@ def __init__(self, *args, **kwargs): angle = self.addChild('Articulation') angle.addObject('MechanicalObject', name='dofs', template='Vec1', position=[[0]], rest_position=self.angleIn.getLinkPath()) - angle.addObject('RestShapeSpringsForceField', points=0, stiffness=1e9) + angle.addObject('FixedWeakConstraint', indices=0, stiffness=1e9) angle.addObject('UniformMass', totalMass=0.01) servoWheel = angle.addChild('ServoWheel') diff --git a/examples/tutorials/Tripod/details/step8-maze.py b/examples/tutorials/Tripod/details/step8-maze.py index 29feccd9..ce821e17 100644 --- a/examples/tutorials/Tripod/details/step8-maze.py +++ b/examples/tutorials/Tripod/details/step8-maze.py @@ -16,7 +16,7 @@ def EffectorGoal(node, position): goal.addObject('EulerImplicitSolver', firstOrder=True) goal.addObject('CGLinearSolver', iterations=100, threshold=1e-12, tolerance=1e-10) goal.addObject('MechanicalObject', name='goalMO', template='Rigid3', position=position+[0., 0., 0., 1.], showObject=True, showObjectScale=10) - goal.addObject('RestShapeSpringsForceField', points=0, angularStiffness=1e5, stiffness=1e5) + goal.addObject('FixedWeakConstraint', indices=0, angularStiffness=1e5, stiffness=1e5) goal.addObject('UncoupledConstraintCorrection', compliance=[1e-10] * 7) return goal diff --git a/examples/tutorials/Tripod/details/tripodcontroller.py b/examples/tutorials/Tripod/details/tripodcontroller.py index 8a18563a..bb9fce98 100644 --- a/examples/tutorials/Tripod/details/tripodcontroller.py +++ b/examples/tutorials/Tripod/details/tripodcontroller.py @@ -183,7 +183,7 @@ def onKeypressedEvent(self, event): key = event['key'] if key == Key.I: for i in range(3): - self.nodeTripod.actuatedarms[i].ServoMotor.Articulation.RestShapeSpringsForceField.stiffness.value = [ + self.nodeTripod.actuatedarms[i].ServoMotor.Articulation.FixedWeakConstraint.stiffness.value = [ 0.] self.activate = True for node in self.nodesInverseComponents: diff --git a/examples/tutorials/Tripod/myproject/closedLoopController.py b/examples/tutorials/Tripod/myproject/closedLoopController.py index 9d9f05b0..92e7d0b5 100644 --- a/examples/tutorials/Tripod/myproject/closedLoopController.py +++ b/examples/tutorials/Tripod/myproject/closedLoopController.py @@ -161,7 +161,7 @@ def onKeypressedEvent(self, event): key = event['key'] if key == Key.I: for i in range(3): - self.nodeTripod.actuatedarms[i].ServoMotor.Articulation.RestShapeSpringsForceField.stiffness.value = [ + self.nodeTripod.actuatedarms[i].ServoMotor.Articulation.FixedWeakConstraint.stiffness.value = [ 0.] self.activate = True for node in self.nodesInverseComponents: diff --git a/examples/tutorials/Tripod/myproject/fixingbox.py b/examples/tutorials/Tripod/myproject/fixingbox.py index 5eb73d56..a8bba702 100644 --- a/examples/tutorials/Tripod/myproject/fixingbox.py +++ b/examples/tutorials/Tripod/myproject/fixingbox.py @@ -17,7 +17,7 @@ def FixingBox(parent, target, name='FixingBox', c = self.addChild('Constraint') target.addChild(c) - c.addObject('RestShapeSpringsForceField', - points=self.BoxROI.getData('indices').getLinkPath(), + c.addObject('FixedWeakConstraint', + indices=self.BoxROI.getData('indices').getLinkPath(), stiffness=1e12) return self diff --git a/examples/tutorials/Tripod/myproject/maze.py b/examples/tutorials/Tripod/myproject/maze.py index b751b25e..9062df5b 100644 --- a/examples/tutorials/Tripod/myproject/maze.py +++ b/examples/tutorials/Tripod/myproject/maze.py @@ -78,7 +78,7 @@ def createScene(rootNode): effector.addObject('CGLinearSolver', iterations=100, threshold=1e-5, tolerance=1e-5) effector.addObject('MechanicalObject', template='Rigid3', name='goalMO', position=[0, 40, 0, 0, 0, 0, 1], showObject=True, showObjectScale=10) - effector.addObject('RestShapeSpringsForceField', points=0, angularStiffness=1e5, stiffness=1e5) + effector.addObject('FixedWeakConstraint', indices=0, angularStiffness=1e5, stiffness=1e5) effector.addObject('UncoupledConstraintCorrection', compliance='1e-10 1e-10 0 0 1e-10 0 1e-10 ') # Open maze planning from JSON file diff --git a/examples/tutorials/Tripod/myproject/parts/fixingbox.py b/examples/tutorials/Tripod/myproject/parts/fixingbox.py index 6d42783a..6f61268a 100644 --- a/examples/tutorials/Tripod/myproject/parts/fixingbox.py +++ b/examples/tutorials/Tripod/myproject/parts/fixingbox.py @@ -19,7 +19,7 @@ def FixingBox(parent, target, name='FixingBox', c = self.addChild('Constraint') target.addChild(c) - c.addObject('RestShapeSpringsForceField', - points=self.BoxROI.getData('indices').getLinkPath(), + c.addObject('FixedWeakConstraint', + indices=self.BoxROI.getData('indices').getLinkPath(), stiffness=1e12) return self diff --git a/examples/tutorials/Tripod/myproject/parts/maze.py b/examples/tutorials/Tripod/myproject/parts/maze.py index 9dba6ffc..284f61ec 100644 --- a/examples/tutorials/Tripod/myproject/parts/maze.py +++ b/examples/tutorials/Tripod/myproject/parts/maze.py @@ -56,7 +56,7 @@ def createScene(rootNode): effector.addObject('CGLinearSolver', iterations=100, threshold=1e-5, tolerance=1e-5) effector.addObject('MechanicalObject', template='Rigid3', name='goalMO', position=[0, 40, 0, 0, 0, 0, 1], showObject=True, showObjectScale=10) - effector.addObject('RestShapeSpringsForceField', points=0, angularStiffness=1e5, stiffness=1e5) + effector.addObject('FixedWeakConstraint', indices=0, angularStiffness=1e5, stiffness=1e5) effector.addObject('UncoupledConstraintCorrection', compliance='1e-10 1e-10 0 0 1e-10 0 1e-10 ') # Open maze planning from JSON file diff --git a/examples/tutorials/Tripod/myproject/parts/s90servo.py b/examples/tutorials/Tripod/myproject/parts/s90servo.py index 6f7b900d..360f94a7 100644 --- a/examples/tutorials/Tripod/myproject/parts/s90servo.py +++ b/examples/tutorials/Tripod/myproject/parts/s90servo.py @@ -75,7 +75,7 @@ def init(self): angle = self.addChild('Articulation') angle.addObject('MechanicalObject', name='dofs', template='Vec1', position=[[0]], rest_position=self.getData('angleIn').getLinkPath()) - angle.addObject('RestShapeSpringsForceField', points=0, stiffness=1e9) + angle.addObject('FixedWeakConstraint', indices=0, stiffness=1e9) angle.addObject('UniformMass', totalMass=0.01) servoWheel = angle.addChild('ServoWheel') diff --git a/examples/tutorials/Tripod/myproject/parts/tripodcontroller.py b/examples/tutorials/Tripod/myproject/parts/tripodcontroller.py index a6c3b005..5c43c69c 100644 --- a/examples/tutorials/Tripod/myproject/parts/tripodcontroller.py +++ b/examples/tutorials/Tripod/myproject/parts/tripodcontroller.py @@ -177,7 +177,7 @@ def onKeypressedEvent(self, event): key = event['key'] if key == Key.I: for i in range(3): - self.nodeTripod.actuatedarms[i].ServoMotor.Articulation.RestShapeSpringsForceField.stiffness.value = [0.] + self.nodeTripod.actuatedarms[i].ServoMotor.Articulation.FixedWeakConstraint.stiffness.value = [0.] self.activate = True for node in self.nodesInverseComponents: node.activated = bool(self.activate) diff --git a/examples/tutorials/Tripod/myproject/s90servo.py b/examples/tutorials/Tripod/myproject/s90servo.py index 42ef2332..ca7c6fdc 100644 --- a/examples/tutorials/Tripod/myproject/s90servo.py +++ b/examples/tutorials/Tripod/myproject/s90servo.py @@ -75,7 +75,7 @@ def __init__(self, *args, **kwargs): angle = self.addChild('Articulation') angle.addObject('MechanicalObject', name='dofs', template='Vec1', position=[[0]], rest_position=self.angleIn.getLinkPath()) - angle.addObject('RestShapeSpringsForceField', points=0, stiffness=1e9) + angle.addObject('FixedWeakConstraint', indices=0, stiffness=1e9) angle.addObject('UniformMass', totalMass=0.01) servoWheel = angle.addChild('ServoWheel') diff --git a/examples/tutorials/Tripod/myproject/step8-maze.py b/examples/tutorials/Tripod/myproject/step8-maze.py index 40891e15..ae6c0883 100644 --- a/examples/tutorials/Tripod/myproject/step8-maze.py +++ b/examples/tutorials/Tripod/myproject/step8-maze.py @@ -16,7 +16,7 @@ def EffectorGoal(node, position): goal.addObject('EulerImplicitSolver', firstOrder=True) goal.addObject('CGLinearSolver', iterations=100, threshold=1e-12, tolerance=1e-10) goal.addObject('MechanicalObject', name='goalMO', template='Rigid3', position=position+[0., 0., 0., 1.], showObject=True, showObjectScale=10) - goal.addObject('RestShapeSpringsForceField', points=0, angularStiffness=1e5, stiffness=1e5) + goal.addObject('FixedWeakConstraint', indices=0, angularStiffness=1e5, stiffness=1e5) goal.addObject('UncoupledConstraintCorrection', compliance=[1e-10] * 7) return goal diff --git a/examples/tutorials/Tripod/myproject/tripodcontroller.py b/examples/tutorials/Tripod/myproject/tripodcontroller.py index 8a18563a..bb9fce98 100644 --- a/examples/tutorials/Tripod/myproject/tripodcontroller.py +++ b/examples/tutorials/Tripod/myproject/tripodcontroller.py @@ -183,7 +183,7 @@ def onKeypressedEvent(self, event): key = event['key'] if key == Key.I: for i in range(3): - self.nodeTripod.actuatedarms[i].ServoMotor.Articulation.RestShapeSpringsForceField.stiffness.value = [ + self.nodeTripod.actuatedarms[i].ServoMotor.Articulation.FixedWeakConstraint.stiffness.value = [ 0.] self.activate = True for node in self.nodesInverseComponents: diff --git a/examples/tutorials/Tripod/tripod-tuto.html b/examples/tutorials/Tripod/tripod-tuto.html index e9a25f94..52d08a7d 100644 --- a/examples/tutorials/Tripod/tripod-tuto.html +++ b/examples/tutorials/Tripod/tripod-tuto.html @@ -425,7 +425,7 @@

At the end of this ste

Exploring the scene