Skip to content
Open
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
4 changes: 3 additions & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,8 @@ set(HEADER_FILES
${MOR_SRC}/component/forcefield/HyperReducedHexahedronFEMForceField.h
${MOR_SRC}/component/forcefield/HyperReducedHexahedronFEMForceField.inl
${MOR_SRC}/component/forcefield/HyperReducedRestShapeSpringsForceField.h
${MOR_SRC}/component/forcefield/HyperReducedRestShapeSpringsForceField.inl
${MOR_SRC}/component/forcefield/HyperReducedFixedWeakConstraint.h
${MOR_SRC}/component/forcefield/HyperReducedFixedWeakConstraint.inl
${MOR_SRC}/component/forcefield/HyperReducedTetrahedralCorotationalFEMForceField.h
${MOR_SRC}/component/forcefield/HyperReducedTetrahedralCorotationalFEMForceField.inl
${MOR_SRC}/component/forcefield/HyperReducedTetrahedronFEMForceField.h
Expand Down Expand Up @@ -58,6 +59,7 @@ set(SOURCE_FILES
${MOR_SRC}/component/forcefield/HyperReducedHelper.cpp
${MOR_SRC}/component/forcefield/HyperReducedHexahedronFEMForceField.cpp
${MOR_SRC}/component/forcefield/HyperReducedRestShapeSpringsForceField.cpp
${MOR_SRC}/component/forcefield/HyperReducedFixedWeakConstraint.cpp
${MOR_SRC}/component/forcefield/HyperReducedTetrahedralCorotationalFEMForceField.cpp
${MOR_SRC}/component/forcefield/HyperReducedTetrahedronFEMForceField.cpp
${MOR_SRC}/component/forcefield/HyperReducedTetrahedronHyperelasticityFEMForceField.cpp
Expand Down
4 changes: 2 additions & 2 deletions examples/organs/liver/liverFineHyperElastic.pyscn
Original file line number Diff line number Diff line change
Expand Up @@ -45,8 +45,8 @@ def createScene(rootNode):
liver.addObject('TetrahedronHyperelasticityFEMForceField',materialName="NeoHookean", ParameterSet=str(mu_) + " " + str(k0_), AnisotropyDirections="")


liver.addObject('RestShapeSpringsForceField', points='@ROI1.indices', stiffness = '1e8')
liver.addObject('RestShapeSpringsForceField' , external_points = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10], points = '@boxROIactuation.indices', name = 'actuatorSpring', stiffness = '1e8', external_rest_shape = '@actuator/actuatorState')
liver.addObject('FixedWeakConstraint', indices='@ROI1.indices', stiffness = '1e8')
liver.addObject('RestShapeSpringsForceField' , externalIndices = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10], indices = '@boxROIactuation.indices', name = 'actuatorSpring', stiffness = '1e8', external_rest_shape = '@actuator/actuatorState')

visu = liver.addChild('visu')
visu.addObject( 'MeshOBJLoader', name= 'loader', filename=meshPath+'liver-smoothUV.obj')
Expand Down
2 changes: 1 addition & 1 deletion examples/organs/liver/liverFine_gravity.py
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ def createScene(rootNode):

liver.addObject('UniformMass', totalMass=0.3)
liver.addObject('TetrahedronFEMForceField', poissonRatio="0.3", youngModulus="5000")
liver.addObject('RestShapeSpringsForceField', points='@ROI1.indices', stiffness = '1e8')
liver.addObject('RestShapeSpringsForceField', indices='@ROI1.indices', stiffness = '1e8')

# Add a visual model
visu = liver.addChild('visu')
Expand Down
4 changes: 2 additions & 2 deletions examples/organs/liver/liverFine_rotationalActuation.py
Original file line number Diff line number Diff line change
Expand Up @@ -47,8 +47,8 @@ def createScene(rootNode):

liver.addObject('UniformMass', totalMass=0.3)
liver.addObject('TetrahedronFEMForceField', poissonRatio="0.3", youngModulus="5000")
liver.addObject('RestShapeSpringsForceField', points='@ROI1.indices', stiffness = '1e8')
liver.addObject('RestShapeSpringsForceField' , external_points = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10], points = '@boxROIactuation.indices', name = 'actuatorSpring', stiffness = '1e8', external_rest_shape = '@actuator/actuatorState')
liver.addObject('RestShapeSpringsForceField', indices='@ROI1.indices', stiffness = '1e8')
liver.addObject('RestShapeSpringsForceField' , externalIndices = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10], indices = '@boxROIactuation.indices', name = 'actuatorSpring', stiffness = '1e8', external_rest_shape = '@actuator/actuatorState')

visu = liver.addChild('visu')
visu.addObject( 'MeshOBJLoader', name= 'loader', filename=meshPath+'liver-smoothUV.obj')
Expand Down
4 changes: 2 additions & 2 deletions examples/organs/liver/reduced/liver/reduced_liverFine.py
Original file line number Diff line number Diff line change
Expand Up @@ -77,8 +77,8 @@ def Reduced_test(
liver.addObject('BoxROI' , name= 'boxROIactuation' , orientedBox= newBox([[-5.0, 0.5, -0.5], [-5.0, 0.0, -0.5], [-4.0, 0.0, -0.5]] , [0.0, 0.0, 0.0],translation,rotation,[0, 0, 0.5],scale) + multiply(scale[2],[1.0]).tolist(),drawBoxes=True)
liver.addObject('UniformMass' , totalMass = 0.3)
liver.addObject('HyperReducedTetrahedronFEMForceField' , poissonRatio = '0.3', youngModulus = '5000', name = 'reducedFF_liver_0', nbModes = nbrOfModes, performECSW = hyperReduction, modesPath = path + r'/data/modes.txt', RIDPath = path + r'/data/reducedFF_liver_0_RID.txt', weightsPath = path + r'/data/reducedFF_liver_0_weight.txt')
liver.addObject('HyperReducedRestShapeSpringsForceField' , points = '@ROI1.indices', stiffness = '1e8', name = 'reducedFF_liver_1', nbModes = nbrOfModes, performECSW = hyperReduction, modesPath = path + r'/data/modes.txt', RIDPath = path + r'/data/reducedFF_liver_1_RID.txt', weightsPath = path + r'/data/reducedFF_liver_1_weight.txt')
liver.addObject('HyperReducedRestShapeSpringsForceField' , external_points = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10], points = '@boxROIactuation.indices', name = 'reducedFF_liver_2', stiffness = '1e8', external_rest_shape = '@actuator/actuatorState', nbModes = nbrOfModes, performECSW = hyperReduction, modesPath = path + r'/data/modes.txt', RIDPath = path + r'/data/reducedFF_liver_2_RID.txt', weightsPath = path + r'/data/reducedFF_liver_2_weight.txt')
liver.addObject('HyperReducedFixedWeakConstraint' , indices = '@ROI1.indices', stiffness = '1e8', name = 'reducedFF_liver_1', nbModes = nbrOfModes, performECSW = hyperReduction, modesPath = path + r'/data/modes.txt', RIDPath = path + r'/data/reducedFF_liver_1_RID.txt', weightsPath = path + r'/data/reducedFF_liver_1_weight.txt')
liver.addObject('HyperReducedRestShapeSpringsForceField' , externalIndices = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10], indices = '@boxROIactuation.indices', name = 'reducedFF_liver_2', stiffness = '1e8', external_rest_shape = '@actuator/actuatorState', nbModes = nbrOfModes, performECSW = hyperReduction, modesPath = path + r'/data/modes.txt', RIDPath = path + r'/data/reducedFF_liver_2_RID.txt', weightsPath = path + r'/data/reducedFF_liver_2_weight.txt')
liver.addObject('ModelOrderReductionMapping' , input = '@../MechanicalObject', modesPath = path + r'/data/modes.txt', output = '@./MechanicalObject')


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -77,8 +77,8 @@ def Reduced_test(
liver.addObject('BoxROI' , name= 'boxROIactuation' , orientedBox= newBox([[-5.0, 0.5, -0.5], [-5.0, 0.0, -0.5], [-4.0, 0.0, -0.5]] , [0.0, 0.0, 0.0],translation,rotation,[0, 0, 0.5],scale) + multiply(scale[2],[1.0]).tolist(),drawBoxes=True)
liver.addObject('UniformMass' , totalMass = 0.3)
liver.addObject('HyperReducedTetrahedronHyperelasticityFEMForceField' , materialName = 'NeoHookean', ParameterSet = '1923.076923076923 4166.666666666666', AnisotropyDirections = '', name = 'reducedFF_liver_0', nbModes = nbrOfModes, performECSW = hyperReduction, modesPath = path + r'/data/modes.txt', RIDPath = path + r'/data/reducedFF_liver_0_RID.txt', weightsPath = path + r'/data/reducedFF_liver_0_weight.txt')
liver.addObject('HyperReducedRestShapeSpringsForceField' , points = '@ROI1.indices', stiffness = '1e8', name = 'reducedFF_liver_1', nbModes = nbrOfModes, performECSW = hyperReduction, modesPath = path + r'/data/modes.txt', RIDPath = path + r'/data/reducedFF_liver_1_RID.txt', weightsPath = path + r'/data/reducedFF_liver_1_weight.txt')
liver.addObject('HyperReducedRestShapeSpringsForceField' , external_points = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10], points = '@boxROIactuation.indices', name = 'reducedFF_liver_2', stiffness = '1e8', external_rest_shape = '@actuator/actuatorState', nbModes = nbrOfModes, performECSW = hyperReduction, modesPath = path + r'/data/modes.txt', RIDPath = path + r'/data/reducedFF_liver_2_RID.txt', weightsPath = path + r'/data/reducedFF_liver_2_weight.txt')
liver.addObject('HyperReducedFixedWeakConstraint' , indices = '@ROI1.indices', stiffness = '1e8', name = 'reducedFF_liver_1', nbModes = nbrOfModes, performECSW = hyperReduction, modesPath = path + r'/data/modes.txt', RIDPath = path + r'/data/reducedFF_liver_1_RID.txt', weightsPath = path + r'/data/reducedFF_liver_1_weight.txt')
liver.addObject('HyperReducedRestShapeSpringsForceField' , externalIndices = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10], indices = '@boxROIactuation.indices', name = 'reducedFF_liver_2', stiffness = '1e8', external_rest_shape = '@actuator/actuatorState', nbModes = nbrOfModes, performECSW = hyperReduction, modesPath = path + r'/data/modes.txt', RIDPath = path + r'/data/reducedFF_liver_2_RID.txt', weightsPath = path + r'/data/reducedFF_liver_2_weight.txt')
liver.addObject('ModelOrderReductionMapping' , input = '@../MechanicalObject', modesPath = path + r'/data/modes.txt', output = '@./MechanicalObject')


Expand Down
2 changes: 1 addition & 1 deletion examples/others/hexaBeam/hexaBeam.pyscn
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ def createScene(rootNode):
M1.addObject('MechanicalObject')
M1.addObject('UniformMass', totalMass="0.1")
M1.addObject('RegularGridTopology', nx="4", ny="4", nz="20", xmin="-9", xmax="-6", ymin="0", ymax="3", zmin="0", zmax="19")
M1.addObject('RestShapeSpringsForceField', points="0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15", stiffness=1e12)
M1.addObject('FixedWeakConstraint', indices="0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15", stiffness=1e12)
M1.addObject('HexahedronFEMForceField', name="FEM", youngModulus="4000", poissonRatio="0.3", method="large")
M1.addObject('GenericConstraintCorrection')

Expand Down
2 changes: 1 addition & 1 deletion examples/others/hexaBeam/reduced/reduced_hexaBeam.py
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ def Reduced_test(
M1.addObject('MechanicalObject')
M1.addObject('UniformMass' , totalMass = '0.1')
M1.addObject('RegularGridTopology' , nx = '4', ny = '4', nz = '20', xmin = '-9', xmax = '-6', ymin = '0', ymax = '3', zmin = '0', zmax = '19')
M1.addObject('HyperReducedRestShapeSpringsForceField' , points = '0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15', stiffness = 1000000000000.0, name = 'reducedFF_M1_0', nbModes = nbrOfModes, performECSW = hyperReduction, modesPath = path + r'/data/modes.txt', RIDPath = path + r'/data/reducedFF_M1_0_RID.txt', weightsPath = path + r'/data/reducedFF_M1_0_weight.txt')
M1.addObject('HyperReducedFixedWeakConstraint' , indices = '0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15', stiffness = 1000000000000.0, name = 'reducedFF_M1_0', nbModes = nbrOfModes, performECSW = hyperReduction, modesPath = path + r'/data/modes.txt', RIDPath = path + r'/data/reducedFF_M1_0_RID.txt', weightsPath = path + r'/data/reducedFF_M1_0_weight.txt')
M1.addObject('HyperReducedHexahedronFEMForceField' , name = 'reducedFF_M1_1', youngModulus = '4000', poissonRatio = '0.3', method = 'large', nbModes = nbrOfModes, performECSW = hyperReduction, modesPath = path + r'/data/modes.txt', RIDPath = path + r'/data/reducedFF_M1_1_RID.txt', weightsPath = path + r'/data/reducedFF_M1_1_weight.txt')
M1.addObject('ModelOrderReductionMapping' , input = '@../MechanicalObject', modesPath = path + r'/data/modes.txt', output = '@./MechanicalObject')

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ def Reduced_test(

FixedBox = modelNode.addChild('FixedBox')
FixedBox.addObject('BoxROI' , name= 'BoxROI' , orientedBox= newBox([[-15, 15, -40], [-15, -15, -40], [15, -15, -40]] , [0.0, 0.0, 35],translation,rotation,[0, 0, 25.0],scale) + multiply(scale[2],[50]).tolist(),drawBoxes=True)
FixedBox.addObject('HyperReducedRestShapeSpringsForceField' , points = '@BoxROI.indices', stiffness = 1000000000000.0, name = 'reducedFF_FixedBox_1', nbModes = nbrOfModes, performECSW = hyperReduction, modesPath = path + r'/data/modes.txt', RIDPath = path + r'/data/reducedFF_FixedBox_1_RID.txt', weightsPath = path + r'/data/reducedFF_FixedBox_1_weight.txt')
FixedBox.addObject('HyperReducedFixedWeakConstraint' , indices = '@BoxROI.indices', stiffness = 1000000000000.0, name = 'reducedFF_FixedBox_1', nbModes = nbrOfModes, performECSW = hyperReduction, modesPath = path + r'/data/modes.txt', RIDPath = path + r'/data/reducedFF_FixedBox_1_RID.txt', weightsPath = path + r'/data/reducedFF_FixedBox_1_weight.txt')


north = modelNode.addChild('north')
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ def Reduced_test(

FixedBox = modelNode.addChild('FixedBox')
FixedBox.addObject('BoxROI' , name= 'BoxROI' , orientedBox= newBox([[-15, 15, -40], [-15, -15, -40], [15, -15, -40]] , [0.0, 0.0, 35],translation,rotation,[0, 0, 25.0],scale) + multiply(scale[2],[50]).tolist(),drawBoxes=True)
FixedBox.addObject('HyperReducedRestShapeSpringsForceField' , points = '@BoxROI.indices', stiffness = 1000000000000.0, name = 'reducedFF_FixedBox_1', nbModes = nbrOfModes, performECSW = hyperReduction, modesPath = path + r'/data/modes.txt', RIDPath = path + r'/data/reducedFF_FixedBox_1_RID.txt', weightsPath = path + r'/data/reducedFF_FixedBox_1_weight.txt')
FixedBox.addObject('HyperReducedFixedWeakConstraint' , indices = '@BoxROI.indices', stiffness = 1000000000000.0, name = 'reducedFF_FixedBox_1', nbModes = nbrOfModes, performECSW = hyperReduction, modesPath = path + r'/data/modes.txt', RIDPath = path + r'/data/reducedFF_FixedBox_1_RID.txt', weightsPath = path + r'/data/reducedFF_FixedBox_1_weight.txt')


north = modelNode.addChild('north')
Expand Down
4 changes: 2 additions & 2 deletions examples/softRobots/finger/finger.pyscn
Original file line number Diff line number Diff line change
Expand Up @@ -62,9 +62,9 @@ def createScene(rootNode):
# Or "SphereROI"...
# finger.addObject('SphereROI', name='ROI', centers='0 0 0', radii='5')

# RestShapeSpringsForceField is one way in Sofa to implement fixed point constraint.
# FixedWeakConstraint 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 #
Expand Down
2 changes: 1 addition & 1 deletion examples/softRobots/finger/reduced/reduced_finger.py
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ def Reduced_test(
finger.addObject('UniformMass' , totalMass = 0.05)
finger.addObject('HyperReducedTetrahedronFEMForceField' , poissonRatio = '0.45', youngModulus = '600', name = 'reducedFF_finger_0', nbModes = nbrOfModes, performECSW = hyperReduction, modesPath = path + r'/data/modes.txt', RIDPath = path + r'/data/reducedFF_finger_0_RID.txt', weightsPath = path + r'/data/reducedFF_finger_0_weight.txt')
finger.addObject('BoxROI' , name= 'ROI1' , orientedBox= newBox([[-15, 10, 0], [-15, 0, 0], [5, 0, 0]] , [0.0, 0.0, 0.0],translation,rotation,[0, 0, 7.5],scale) + multiply(scale[2],[15]).tolist(),drawBoxes=True)
finger.addObject('HyperReducedRestShapeSpringsForceField' , points = '@ROI1.indices', stiffness = 1000000000000.0, name = 'reducedFF_finger_1', nbModes = nbrOfModes, performECSW = hyperReduction, modesPath = path + r'/data/modes.txt', RIDPath = path + r'/data/reducedFF_finger_1_RID.txt', weightsPath = path + r'/data/reducedFF_finger_1_weight.txt')
finger.addObject('HyperReducedFixedWeakConstraint' , indices = '@ROI1.indices', stiffness = 1000000000000.0, name = 'reducedFF_finger_1', nbModes = nbrOfModes, performECSW = hyperReduction, modesPath = path + r'/data/modes.txt', RIDPath = path + r'/data/reducedFF_finger_1_RID.txt', weightsPath = path + r'/data/reducedFF_finger_1_weight.txt')
finger.addObject('ModelOrderReductionMapping' , input = '@../MechanicalObject', modesPath = path + r'/data/modes.txt', output = '@./MechanicalObject')


Expand Down
4 changes: 2 additions & 2 deletions examples/softRobots/sofiaLeg/reduced/reduced_sofiaLeg.py
Original file line number Diff line number Diff line change
Expand Up @@ -76,10 +76,10 @@ def Reduced_SofiaLeg(
SofiaLeg.addObject('UniformMass' , totalMass = 0.01)
SofiaLeg.addObject('HyperReducedTetrahedronFEMForceField' , youngModulus = 300, poissonRatio = 0.45, name = 'reducedFF_SofiaLeg_0', nbModes = nbrOfModes, performECSW = hyperReduction, modesPath = path + r'/data/modes.txt', RIDPath = path + r'/data/reducedFF_SofiaLeg_0_RID.txt', weightsPath = path + r'/data/reducedFF_SofiaLeg_0_weight.txt')
SofiaLeg.addObject('BoxROI' , name = 'boxROITop', orientedBox = [[-12.0, 53.0, 0.0], [12.0, 53.0, 0.0], [12.0, 64.0, 0.0], 16.0], drawBoxes = True)
SofiaLeg.addObject('HyperReducedRestShapeSpringsForceField' , name = 'reducedFF_SofiaLeg_1', points = '@boxROITop.indices', stiffness = '1e8', nbModes = nbrOfModes, performECSW = hyperReduction, modesPath = path + r'/data/modes.txt', RIDPath = path + r'/data/reducedFF_SofiaLeg_1_RID.txt', weightsPath = path + r'/data/reducedFF_SofiaLeg_1_weight.txt')
SofiaLeg.addObject('HyperReducedFixedWeakConstraint' , name = 'reducedFF_SofiaLeg_1', indices = '@boxROITop.indices', stiffness = '1e8', nbModes = nbrOfModes, performECSW = hyperReduction, modesPath = path + r'/data/modes.txt', RIDPath = path + r'/data/reducedFF_SofiaLeg_1_RID.txt', weightsPath = path + r'/data/reducedFF_SofiaLeg_1_weight.txt')
SofiaLeg.addObject('BoxROI' , name = 'boxROICollision', orientedBox = [[-25.0, -41.0, -7.0], [25.0, -42.0, -7.0], [25.0, -39.0, -7.0], 2.0, [-25.0, -42.0, 7.0], [25.0, -42.0, 7.0], [25.0, -39.0, 7.0], 2.0], drawPoints = '0', computeEdges = '0', computeTriangles = '0', computeTetrahedra = '0', computeHexahedra = '0', computeQuad = '0', drawSize = 5, drawBoxes = True)
SofiaLeg.addObject('BoxROI' , name = 'boxROIMiddle', orientedBox = [[-2.5, -8.5, 0.0], [2.5, -8.5, 0.0], [2.5, -3.5, 0.0], 18.0], drawBoxes = True)
SofiaLeg.addObject('HyperReducedRestShapeSpringsForceField' , external_points = [0, 1, 2], points = '@boxROIMiddle.indices', name = 'reducedFF_SofiaLeg_2', stiffness = '1e8', external_rest_shape = '@../../SofiaLeg_actuator/actuatorState', nbModes = nbrOfModes, performECSW = hyperReduction, modesPath = path + r'/data/modes.txt', RIDPath = path + r'/data/reducedFF_SofiaLeg_2_RID.txt', weightsPath = path + r'/data/reducedFF_SofiaLeg_2_weight.txt')
SofiaLeg.addObject('HyperReducedRestShapeSpringsForceField' , externalIndices = [0, 1, 2], indices = '@boxROIMiddle.indices', name = 'reducedFF_SofiaLeg_2', stiffness = '1e8', external_rest_shape = '@../../SofiaLeg_actuator/actuatorState', nbModes = nbrOfModes, performECSW = hyperReduction, modesPath = path + r'/data/modes.txt', RIDPath = path + r'/data/reducedFF_SofiaLeg_2_RID.txt', weightsPath = path + r'/data/reducedFF_SofiaLeg_2_weight.txt')
SofiaLeg.addObject('ModelOrderReductionMapping' , input = '@../MechanicalObject', modesPath = path + r'/data/modes.txt', output = '@./tetras')


Expand Down
4 changes: 2 additions & 2 deletions examples/softRobots/sofiaLeg/sofiaLeg.py
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ def SofiaLeg(

#To fix the Top part of the leg
leg.addObject('BoxROI' , name= 'boxROITop' , orientedBox= newBox([[-12.0, 53.0, 0], [12.0, 53.0, 0], [12.0, 64.0, 0]] , [0.0, 0.0, 0.0],translation,rotation,[0, 0, 0.0],scale) + multiply(scale[2],[16.0]).tolist(),drawBoxes=True)
leg.addObject('RestShapeSpringsForceField', name = 'fixedTopForceField', points = '@boxROITop.indices', stiffness = '1e8')
leg.addObject('RestShapeSpringsForceField', name = 'fixedTopForceField', indices = '@boxROITop.indices', stiffness = '1e8')

#Box to add collisions only on the tip of the leg
leg.addObject('BoxROI', name='boxROICollision', orientedBox= newBox(
Expand All @@ -87,7 +87,7 @@ def SofiaLeg(

#To Actuate our leg we select some elements in the middle of our leg, add a Spring to them, then add an external_rest_shape that will allow us
leg.addObject('BoxROI' , name= 'boxROIMiddle' , orientedBox= newBox([[-2.5, -8.5, 0], [2.5, -8.5, 0], [2.5, -3.5, 0]] , [0.0, 0.0, 0.0],translation,rotation,[0, 0, 0.0],scale) + multiply(scale[2],[18.0]).tolist(),drawBoxes=True)
leg.addObject('RestShapeSpringsForceField' , external_points =[i for i in range(3)], points = '@boxROIMiddle.indices', name = 'actuatorSpring', stiffness = '1e8', external_rest_shape = '@../'+name+'_actuator/actuatorState')
leg.addObject('RestShapeSpringsForceField' , externalIndices =[i for i in range(3)], indices = '@boxROIMiddle.indices', name = 'actuatorSpring', stiffness = '1e8', external_rest_shape = '@../'+name+'_actuator/actuatorState')

SofiaLeg_actuator = attachedTo.addChild(name+'_actuator')
SofiaLeg_actuator.addObject('MechanicalObject' , name = 'actuatorState', position = '@../'+name+'/boxROIMiddle.pointsInROI', template = 'Vec3d', showObject = True, showObjectScale=5)
Expand Down
3 changes: 2 additions & 1 deletion python/mor/utility/sceneCreation.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,8 @@
'HyperReducedHexahedronFEMForceField':'hexahedra',
'HyperReducedTetrahedronFEMForceField':'tetrahedra',
'HyperReducedTriangleFEMForceField':'triangles',
'HyperReducedRestShapeSpringsForceField':'points'
'HyperReducedRestShapeSpringsForceField':'indices',
'FixedWeakConstraint':'indices'
}

import Sofa
Expand Down
Loading
Loading