Skip to content

Commit

Permalink
fix scene nonLinearCosserat.py (#137)
Browse files Browse the repository at this point in the history
  • Loading branch information
alxbilger authored Nov 29, 2024
1 parent 05d1dd8 commit 65960d0
Showing 1 changed file with 8 additions and 9 deletions.
17 changes: 8 additions & 9 deletions examples/python3/cosserat/nonLinearCosserat.py
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ class NonLinearCosserat(Sofa.Prefab):
Cosserat Mapping // it allow the transfer from the local to the global frame
}
"""
properties = [
prefabParameters = [
{'name': 'name', 'type': 'string', 'help': 'Node name', 'default': 'Cosserat'},
{'name': 'position', 'type': 'Rigid3d::VecCoord', 'help': 'Cosserat base position',
'default': [[0., 0., 0., 0, 0, 0, 1.]]},
Expand All @@ -67,7 +67,7 @@ class NonLinearCosserat(Sofa.Prefab):
'default': 0.0},
{'name': 'attachingToLink', 'type': 'string', 'help': 'a rest shape force field will constraint the object '
'to follow arm position', 'default': '1'},
{'name': 'showObject', 'type': 'string', 'help': ' Draw object arrow ', 'default': '0'}]
{'name': 'showObject', 'type': 'string', 'help': ' Draw object arrow ', 'default': '1'}]

def __init__(self, *args, **kwargs):
Sofa.Prefab.__init__(self, *args, **kwargs)
Expand Down Expand Up @@ -193,11 +193,11 @@ def addCosseratFrame(self, framesF, curv_abs_inputS, curv_abs_outputF):

def createScene(rootNode):
rootNode.addObject('RequiredPlugin', name='plugins', pluginName=[pluginList,
['SofaEngine', 'SofaLoader', 'SofaSimpleFem',
'SofaExporter']])
['Sofa.Component.Visual']])
rootNode.addObject('VisualStyle', displayFlags='showVisualModels showBehaviorModels hideCollisionModels '
'hideBoundingCollisionModels hireForceFields '
'hideBoundingCollisionModels hideForceFields '
'hideInteractionForceFields hideWireframe')
rootNode.addObject('DefaultAnimationLoop')
rootNode.findData('dt').value = 0.01
# rootNode.findData('gravity').value = [0., -9.81, 0.]
rootNode.findData('gravity').value = [0., 0., 0.]
Expand All @@ -213,12 +213,11 @@ def createScene(rootNode):
# solverNode.addObject('CGLinearSolver', tolerance=1.e-12, iterations=1000, threshold=1.e-18)

needCollisionModel = 0 # use this if the collision model if the beam will interact with another object
nonLinearCosserat = solverNode.addChild(
NonLinearCosserat(parent=solverNode, cosseratGeometry=nonLinearConfig, useCollisionModel=needCollisionModel,
name="cosserat", radius=0.1, legendreControlPoints=initialStrain, order=3))
nonLinearCosserat = NonLinearCosserat(parent=solverNode, cosseratGeometry=nonLinearConfig,
useCollisionModel=needCollisionModel, name="cosserat", radius=0.1, legendreControlPoints=initialStrain, order=3)

beamFrame = nonLinearCosserat.cosseratFrame
beamFrame.addObject('ConstantForceField', name='constForce', showArrowSize=1.e-8, indices=12,
force=[0., 0., 0., 0., 0., 450.])
forces=[0., 0., 0., 0., 0., 450.])

return rootNode

0 comments on commit 65960d0

Please sign in to comment.