Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[examples] cleaning #279

Merged
merged 1 commit into from
May 2, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,8 @@ def createScene(rootnode):
body.addObject('GenericConstraintCorrection')
body.addObject('BoxROI', name="boxToFixed", box=[0, 0, 0, 0.5, 0.1, 0.1], drawBoxes=True)
body.addObject('BoxROI', name="boxToPull", box=[0, 0.9, 0, 0.5, 1, 0.1], drawBoxes=True)
body.addObject('FixedConstraint', indices=body.boxToFixed.indices.linkpath)
body.addObject('PartialFixedConstraint', indices=body.boxToPull.indices.linkpath, fixedDirections=[1, 0, 1])
body.addObject('FixedProjectiveConstraint', indices=body.boxToFixed.indices.linkpath)
body.addObject('PartialFixedProjectiveConstraint', indices=body.boxToPull.indices.linkpath, fixedDirections=[1, 0, 1])
body.addObject('PositionConstraint', indices=body.boxToPull.indices.linkpath,
valueType="displacement", value=0.5, useDirections=[0, 1, 0])

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ def createScene(rootNode):

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('FixedConstraint', indices='@ROI1.indices')
# accordion.addObject('FixedProjectiveConstraint', indices='@ROI1.indices')

accordion.addObject('LinearSolverConstraintCorrection')

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,6 @@ def createScene(rootNode):
box=[[-30, 80, 70, 30, 140, 130], [-130, -100, 70, -60, -20, 130], [130, -100, 70, 60, -20, 130]],
computeEdges=False, computeTriangles=False, computeTetrahedra=False, computeHexahedra=False, computeQuad=False,
drawBoxes=True)
robot.addObject('FixedConstraint', indices="@boxROI.indices")
robot.addObject('FixedProjectiveConstraint', indices="@boxROI.indices")

return rootNode
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,6 @@ def createScene(rootNode):
robot.addObject('BoxROI', name='boxROI',
box=[[-30, 80, 70, 30, 140, 130], [-130, -100, 70, -60, -20, 130], [130, -100, 70, 60, -20, 130]],
drawBoxes=True)
robot.addObject('FixedConstraint', indices="@boxROI.indices")
robot.addObject('FixedProjectiveConstraint', indices="@boxROI.indices")

return rootNode
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,6 @@ def createScene(rootNode):
robot.addObject('BoxROI', name='boxROI',
box=[[-30, 80, 70, 30, 140, 130], [-130, -100, 70, -60, -20, 130], [130, -100, 70, 60, -20, 130]],
drawBoxes=True)
robot.addObject('FixedConstraint', indices="@boxROI.indices")
robot.addObject('FixedProjectiveConstraint', indices="@boxROI.indices")

return rootNode
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,6 @@ def createScene(rootNode):
robot.addObject('BoxROI', name='boxROI',
box=[[-30, 80, 70, 30, 140, 130], [-130, -100, 70, -60, -20, 130], [130, -100, 70, 60, -20, 130]],
drawBoxes=True)
robot.addObject('FixedConstraint', indices="@boxROI.indices")
robot.addObject('FixedProjectiveConstraint', indices="@boxROI.indices")

return rootNode
Original file line number Diff line number Diff line change
Expand Up @@ -42,11 +42,11 @@ def createScene(rootNode):
youngModulus=600) # 600kPa

robot.addObject('BoxROI', name='boxROI1', box=[-30, 80, 70, 30, 140, 130], drawBoxes=True)
robot.addObject('PartialFixedConstraint', name="pfc1", fixedDirections=[1, 1, 0], indices="@boxROI1.indices")
robot.addObject('PartialFixedProjectiveConstraint', name="pfc1", fixedDirections=[1, 1, 0], indices="@boxROI1.indices")
robot.addObject('BoxROI', name='boxROI2', box=[-130, -100, 70, -60, -20, 130], drawBoxes=True)
robot.addObject('PartialFixedConstraint', name="pfc2", fixedDirections=[1, 1, 0], indices="@boxROI2.indices")
robot.addObject('PartialFixedProjectiveConstraint', name="pfc2", fixedDirections=[1, 1, 0], indices="@boxROI2.indices")
robot.addObject('BoxROI', name='boxROI3', box=[30, -100, 70, 100, -20, 130], drawBoxes=True)
robot.addObject('PartialFixedConstraint', name="pfc3", fixedDirections=[1, 1, 0], indices="@boxROI3.indices")
robot.addObject('PartialFixedProjectiveConstraint', name="pfc3", fixedDirections=[1, 1, 0], indices="@boxROI3.indices")

robot.addObject('LinearSolverConstraintCorrection')

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,11 +41,11 @@ Node : { name : "root"
UniformMass : {totalMass : "0.4"}
TetrahedronFEMForceField : {name : "FEM" poissonRatio : "0.45" youngModulus : "600"}
BoxROI : {name : "boxROI1" box : "-30 80 70 30 140 130"}
PartialFixedConstraint : {name : "pfc1" indices : "@boxROI1.indices" fixedDirections : "1 1 0"}
PartialFixedProjectiveConstraint : {name : "pfc1" indices : "@boxROI1.indices" fixedDirections : "1 1 0"}
BoxROI : {name : "boxROI2" box : "-30 80 70 30 140 130"}
PartialFixedConstraint : {name : "pfc2" indices : "@boxROI2.indices" fixedDirections : "1 1 0"}
PartialFixedProjectiveConstraint : {name : "pfc2" indices : "@boxROI2.indices" fixedDirections : "1 1 0"}
BoxROI : {name : "boxROI3" box : "-30 80 70 30 140 130"}
PartialFixedConstraint : {name : "pfc3" indices : "@boxROI3.indices" fixedDirections : "1 1 0"}
PartialFixedProjectiveConstraint : {name : "pfc3" indices : "@boxROI3.indices" fixedDirections : "1 1 0"}
LinearSolverConstraintCorrection : {name : "LinearSolverConstraintCorrection" solverName : "preconditioner"}

###robot/effector
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,11 +54,11 @@ def createScene(rootNode):
youngModulus=600) # 600kPa

robot.addObject('BoxROI', name='boxROI1', box=[-30, 80, 70, 30, 140, 130], drawBoxes=True)
robot.addObject('PartialFixedConstraint', name="pfc1", fixedDirections=[1, 1, 0], indices="@boxROI1.indices")
robot.addObject('PartialFixedProjectiveConstraint', name="pfc1", fixedDirections=[1, 1, 0], indices="@boxROI1.indices")
robot.addObject('BoxROI', name='boxROI2', box=[-130, -100, 70, -60, -20, 130], drawBoxes=True)
robot.addObject('PartialFixedConstraint', name="pfc2", fixedDirections=[1, 1, 0], indices="@boxROI2.indices")
robot.addObject('PartialFixedProjectiveConstraint', name="pfc2", fixedDirections=[1, 1, 0], indices="@boxROI2.indices")
robot.addObject('BoxROI', name='boxROI3', box=[130, -100, 70, 60, -20, 130], drawBoxes=True)
robot.addObject('PartialFixedConstraint', name="pfc3", fixedDirections=[1, 1, 0], indices="@boxROI3.indices")
robot.addObject('PartialFixedProjectiveConstraint', name="pfc3", fixedDirections=[1, 1, 0], indices="@boxROI3.indices")

robot.addObject('LinearSolverConstraintCorrection')

Expand Down
4 changes: 2 additions & 2 deletions examples/tutorials/DiamondRobot/DiamondRobot.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ def createScene(rootNode):
"Sofa.Component.Constraint.Lagrangian.Correction",
# Needed to use components LinearSolverConstraintCorrection
"Sofa.Component.Constraint.Lagrangian.Solver", # Needed to use components GenericConstraintSolver
"Sofa.Component.Constraint.Projective", # Needed to use components FixedConstraint
"Sofa.Component.Constraint.Projective", # Needed to use components FixedProjectiveConstraint
"Sofa.Component.Engine.Select", # Needed to use components BoxROI
"Sofa.Component.IO.Mesh", # Needed to use components MeshVTKLoader
"Sofa.Component.LinearSolver.Direct", # Needed to use components SparseLDLSolver
Expand Down Expand Up @@ -52,7 +52,7 @@ def createScene(rootNode):
robot.addObject('TetrahedronFEMForceField', youngModulus=180, poissonRatio=0.45)
# Fix a part of the model
robot.addObject('BoxROI', name="boxROI", box=[-15, -15, -40, 15, 15, 10], drawBoxes=True)
robot.addObject('FixedConstraint', indices="@boxROI.indices")
robot.addObject('FixedProjectiveConstraint', indices="@boxROI.indices")
robot.addObject('LinearSolverConstraintCorrection')

# Actuators
Expand Down
2 changes: 1 addition & 1 deletion examples/tutorials/SoftFingerDesign/details/s90_servo.py
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ def init(self):
servoBody.addObject('MechanicalObject', name='dofs', template='Rigid3', position=[[0., 0., 0., 0., 0., 0., 1.]],
translation=list(self.translation.value), rotation=list(self.rotation.value),
scale3d=list(self.scale3d.value))
servoBody.addObject('FixedConstraint', indices=0)
servoBody.addObject('FixedProjectiveConstraint', indices=0)
servoBody.addObject('UniformMass', totalMass=0.01)

visual = servoBody.addChild('VisualModel')
Expand Down
4 changes: 2 additions & 2 deletions examples/tutorials/Tripod/details/s90servo.py
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ def __init__(self, *args, **kwargs):
translation=self.translation.value, rotation=self.rotation.value,
scale3d=self.scale3d.value
)
servoBody.addObject('FixedConstraint', indices=0)
servoBody.addObject('FixedProjectiveConstraint', indices=0)
servoBody.addObject('UniformMass', totalMass=0.01)

visual = servoBody.addChild('VisualModel')
Expand Down Expand Up @@ -110,7 +110,7 @@ def createScene(rootNode):
'Sofa.Component.AnimationLoop', # Needed to use components [FreeMotionAnimationLoop]
'Sofa.Component.Constraint.Lagrangian.Correction', # Needed to use components [GenericConstraintCorrection]
'Sofa.Component.Constraint.Lagrangian.Solver', # Needed to use components [GenericConstraintSolver]
'Sofa.Component.Constraint.Projective', # Needed to use components [FixedConstraint]
'Sofa.Component.Constraint.Projective', # Needed to use components [FixedProjectiveConstraint]
'Sofa.Component.IO.Mesh', # Needed to use components [MeshSTLLoader]
'Sofa.Component.LinearSolver.Direct', # Needed to use components [SparseLDLSolver]
'Sofa.Component.Mapping.NonLinear', # Needed to use components [RigidMapping]
Expand Down
2 changes: 1 addition & 1 deletion examples/tutorials/Tripod/details/step4.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ def createScene(rootNode):
'Sofa.Component.AnimationLoop', # Needed to use components [FreeMotionAnimationLoop]
'Sofa.Component.Constraint.Lagrangian.Correction', # Needed to use components [GenericConstraintCorrection]
'Sofa.Component.Constraint.Lagrangian.Solver', # Needed to use components [GenericConstraintSolver]
'Sofa.Component.Constraint.Projective', # Needed to use components [FixedConstraint]
'Sofa.Component.Constraint.Projective', # Needed to use components [FixedProjectiveConstraint]
'Sofa.Component.Engine.Select', # Needed to use components [BoxROI,SphereROI]
'Sofa.Component.LinearSolver.Direct', # Needed to use components [SparseLDLSolver]
'Sofa.Component.Mapping.Linear', # Needed to use components [BarycentricMapping,SubsetMultiMapping]
Expand Down
2 changes: 1 addition & 1 deletion examples/tutorials/Tripod/details/tripod.py
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,7 @@ def createScene(rootNode):
'Sofa.Component.AnimationLoop', # Needed to use components [FreeMotionAnimationLoop]
'Sofa.Component.Constraint.Lagrangian.Correction', # Needed to use components [GenericConstraintCorrection]
'Sofa.Component.Constraint.Lagrangian.Solver', # Needed to use components [GenericConstraintSolver]
'Sofa.Component.Constraint.Projective', # Needed to use components [FixedConstraint]
'Sofa.Component.Constraint.Projective', # Needed to use components [FixedProjectiveConstraint]
'Sofa.Component.IO.Mesh', # Needed to use components [MeshSTLLoader]
'Sofa.Component.LinearSolver.Direct', # Needed to use components [SparseLDLSolver]
'Sofa.Component.Mapping.NonLinear', # Needed to use components [RigidMapping]
Expand Down
2 changes: 1 addition & 1 deletion examples/tutorials/Tripod/myproject/parts/s90servo.py
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ def init(self):
servoBody.addObject('MechanicalObject', name='dofs', template='Rigid3', position=[[0., 0., 0., 0., 0., 0., 1.]],
translation=list(self.translation.value), rotation=list(self.rotation.value),
scale3d=list(self.scale3d.value))
servoBody.addObject('FixedConstraint', indices=0)
servoBody.addObject('FixedProjectiveConstraint', indices=0)
servoBody.addObject('UniformMass', totalMass=0.01)

visual = servoBody.addChild('VisualModel')
Expand Down
4 changes: 2 additions & 2 deletions examples/tutorials/Tripod/myproject/s90servo.py
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ def __init__(self, *args, **kwargs):
translation=self.translation.value, rotation=self.rotation.value,
scale3d=self.scale3d.value
)
servoBody.addObject('FixedConstraint', indices=0)
servoBody.addObject('FixedProjectiveConstraint', indices=0)
servoBody.addObject('UniformMass', totalMass=0.01)

visual = servoBody.addChild('VisualModel')
Expand Down Expand Up @@ -110,7 +110,7 @@ def createScene(rootNode):
'Sofa.Component.AnimationLoop', # Needed to use components [FreeMotionAnimationLoop]
'Sofa.Component.Constraint.Lagrangian.Correction', # Needed to use components [GenericConstraintCorrection]
'Sofa.Component.Constraint.Lagrangian.Solver', # Needed to use components [GenericConstraintSolver]
'Sofa.Component.Constraint.Projective', # Needed to use components [FixedConstraint]
'Sofa.Component.Constraint.Projective', # Needed to use components [FixedProjectiveConstraint]
'Sofa.Component.IO.Mesh', # Needed to use components [MeshSTLLoader]
'Sofa.Component.LinearSolver.Direct', # Needed to use components [SparseLDLSolver]
'Sofa.Component.Mapping.NonLinear', # Needed to use components [RigidMapping]
Expand Down
2 changes: 1 addition & 1 deletion examples/tutorials/Tripod/myproject/step4.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ def createScene(rootNode):
'Sofa.Component.AnimationLoop', # Needed to use components [FreeMotionAnimationLoop]
'Sofa.Component.Constraint.Lagrangian.Correction', # Needed to use components [GenericConstraintCorrection]
'Sofa.Component.Constraint.Lagrangian.Solver', # Needed to use components [GenericConstraintSolver]
'Sofa.Component.Constraint.Projective', # Needed to use components [FixedConstraint]
'Sofa.Component.Constraint.Projective', # Needed to use components [FixedProjectiveConstraint]
'Sofa.Component.Engine.Select', # Needed to use components [BoxROI,SphereROI]
'Sofa.Component.LinearSolver.Direct', # Needed to use components [SparseLDLSolver]
'Sofa.Component.Mapping.Linear', # Needed to use components [BarycentricMapping,SubsetMultiMapping]
Expand Down
2 changes: 1 addition & 1 deletion examples/tutorials/Tripod/myproject/tripod.py
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,7 @@ def createScene(rootNode):
'Sofa.Component.AnimationLoop', # Needed to use components [FreeMotionAnimationLoop]
'Sofa.Component.Constraint.Lagrangian.Correction', # Needed to use components [GenericConstraintCorrection]
'Sofa.Component.Constraint.Lagrangian.Solver', # Needed to use components [GenericConstraintSolver]
'Sofa.Component.Constraint.Projective', # Needed to use components [FixedConstraint]
'Sofa.Component.Constraint.Projective', # Needed to use components [FixedProjectiveConstraint]
'Sofa.Component.IO.Mesh', # Needed to use components [MeshSTLLoader]
'Sofa.Component.LinearSolver.Direct', # Needed to use components [SparseLDLSolver]
'Sofa.Component.Mapping.NonLinear', # Needed to use components [RigidMapping]
Expand Down
4 changes: 2 additions & 2 deletions examples/tutorials/Trunk/trunk.py
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,7 @@ def addCollisionModel(self, selfCollision=False):

def fixExtremity(self):
self.node.addObject('BoxROI', name='boxROI', box=[[-20, -20, 0], [20, 20, 20]], drawBoxes=False)
self.node.addObject('PartialFixedConstraint', fixedDirections=[1, 1, 1], indices='@boxROI.indices')
self.node.addObject('PartialFixedProjectiveConstraint', fixedDirections=[1, 1, 1], indices='@boxROI.indices')

def addEffectors(self, target, position=[0., 0., 195.]):
effectors = self.node.addChild('Effectors')
Expand All @@ -151,7 +151,7 @@ def createScene(rootNode):
"Sofa.Component.AnimationLoop", # Needed to use components FreeMotionAnimationLoop
"Sofa.Component.Constraint.Lagrangian.Correction", # Needed to use components GenericConstraintCorrection
"Sofa.Component.Constraint.Lagrangian.Solver", # Needed to use components GenericConstraintSolver
"Sofa.Component.Constraint.Projective", # Needed to use components PartialFixedConstraint
"Sofa.Component.Constraint.Projective", # Needed to use components PartialFixedProjectiveConstraint
"Sofa.Component.Engine.Select", # Needed to use components BoxROI
"Sofa.Component.IO.Mesh", # Needed to use components MeshSTLLoader, MeshVTKLoader
"Sofa.Component.LinearSolver.Direct", # Needed to use components SparseLDLSolver
Expand Down
Loading