11import Sofa
22
3- GeomagicActive = False
3+ GeomagicActive = True
44
55g_needleLength = 0.200 #(m)
66g_needleNumberOfElems = 40 #(# of edges)
@@ -65,7 +65,12 @@ def createScene(root):
6565 root .addObject ("ConstraintAttachButtonSetting" )
6666 root .addObject ("VisualStyle" , displayFlags = "showVisualModels hideBehaviorModels showCollisionModels hideMappings hideForceFields showWireframe showInteractionForceFields" )
6767 root .addObject ("FreeMotionAnimationLoop" )
68- root .addObject ("GenericConstraintSolver" , tolerance = 0.00001 , maxIt = 5000 , regularizationTerm = 0.001 )
68+ root .addObject ("CollisionPipeline" , name = 'pipeline' , depth = '6' , verbose = '0' )
69+ root .addObject ("BruteForceBroadPhase" )
70+ root .addObject ("BVHNarrowPhase" )
71+ root .addObject ("CollisionResponse" , name = 'response' , response = 'FrictionContactConstraint' )
72+ root .addObject ("LocalMinDistance" , name = 'proximity' , alarmDistance = '0.1' , contactDistance = '0.02' )
73+ root .addObject ("ProjectedGaussSeidelConstraintSolver" , tolerance = 0.00001 , maxIt = 5000 )#, regularizationTerm=0.001)
6974 root .addObject ("CollisionLoop" )
7075
7176 toolController = root .addChild ("ToolController" )
@@ -124,6 +129,8 @@ def createScene(root):
124129 needleBodyCollision .addObject ("MechanicalObject" ,name = "mstate_body" , template = "Vec3d" , drawMode = 0 , showObject = False , showObjectScale = 10 )
125130 needleBodyCollision .addObject ("EdgeGeometry" ,name = "geom_body" ,mstate = "@mstate_body" , topology = "@Container_body" )
126131 needleBodyCollision .addObject ("EdgeNormalHandler" , name = "NeedleBeams" , geometry = "@geom_body" )
132+ #needleBodyCollision.addObject("LineCollisionModel", name="volLineColi")
133+ #needleBodyCollision.addObject("PointCollisionModel", name="volPtColi")
127134 needleBodyCollision .addObject ("IdentityMapping" )
128135
129136 needleTipCollision = needle .addChild ("tipCollision" )
@@ -157,11 +164,11 @@ def createScene(root):
157164 FFCollision = FF .addChild ("Collision" )
158165 FFCollision .addObject ("EdgeSetTopologyContainer" , name = "Container" , src = "@../../Needle/bodyCollision/Container_body" )
159166 FFCollision .addObject ("MechanicalObject" , name = "mstate_coli" , constraint = "@../../Needle/bodyCollision/mstate_body.constraint" )
160- FFCollision .addObject ("RigidMapping" )
161- FFTip = FF .addChild ("Tip" )
162- FFTip .addObject ("PointSetTopologyContainer" , name = "Container" , src = "@../../Needle/tipCollision/Container_tip" )
163- FFTip .addObject ("MechanicalObject" , name = "mstate_coli" , constraint = "@../../Needle/tipCollision/mstate_tip.constraint" )
164- FFTip .addObject ("RigidMapping" )
167+ FFCollision .addObject ("RigidMapping" , globalToLocalCoords = True )
168+ # FFTip = FF.addChild("Tip")
169+ # FFTip.addObject("PointSetTopologyContainer", name="Container", src="@../../Needle/tipCollision/Container_tip")
170+ # FFTip.addObject("MechanicalObject", name="mstate_coli", constraint="@../../Needle/tipCollision/mstate_tip.constraint")
171+ # FFTip.addObject("RigidMapping", globalToLocalCoords=True )
165172
166173 volume = root .addChild ("Volume" )
167174 volume .addObject ("EulerImplicitSolver" )
@@ -189,6 +196,9 @@ def createScene(root):
189196 volumeCollision .addObject ("TriangleGeometry" , name = "geom_tri" , mstate = "@mstate_gelColi" , topology = "@TriContainer" ,draw = False )
190197 volumeCollision .addObject ("PhongTriangleNormalHandler" , name = "SurfaceTriangles" , geometry = "@geom_tri" )
191198 volumeCollision .addObject ("AABBBroadPhase" , name = "AABBTriangles" , thread = 1 , nbox = [2 ,2 ,3 ], method = 2 )
199+ #volumeCollision.addObject("TriangleCollisionModel", name="volTriColi")
200+ #volumeCollision.addObject("LineCollisionModel", name="volLineColi")
201+ #volumeCollision.addObject("PointCollisionModel", name="volPtColi")
192202
193203 volumeCollision .addObject ("IdentityMapping" , name = "identityMappingToCollision" , input = "@../mstate_gel" , output = "@mstate_gelColi" , isMechanical = True )
194204
@@ -213,13 +223,19 @@ def createScene(root):
213223 shaftGeom = "@Needle/bodyCollision/geom_body" ,
214224 volGeom = "@Volume/geom_tetra" ,
215225 punctureForceThreshold = 1. ,
216- tipDistThreshold = 0.01 ,
226+ tipDistThreshold = 0.02 ,
217227 drawcollision = True ,
218228 drawPointsScale = 0.0001
219229 )
220230 root .addObject ("DistanceFilter" ,algo = "@InsertionAlgo" ,distance = 0.02 )
221231 root .addObject ("SecondDirection" ,name = "punctureDirection" ,handler = "@Volume/collision/SurfaceTriangles" )
222232 root .addObject ("ConstraintUnilateral" ,input = "@InsertionAlgo.collisionOutput" ,directions = "@punctureDirection" ,draw_scale = 0.001 , mu = 0.001 )
223-
224233 root .addObject ("FirstDirection" ,name = "bindDirection" , handler = "@Needle/bodyCollision/NeedleBeams" )
225- root .addObject ("ConstraintInsertion" ,input = "@InsertionAlgo.insertionOutput" , directions = "@bindDirection" ,draw_scale = "0.01" , frictionCoeff = 0.000 )
234+ root .addObject ("ConstraintInsertion" ,
235+ input = "@InsertionAlgo.insertionOutput" ,
236+ directions = "@bindDirection" ,
237+ draw_scale = "0.01" ,
238+ frictionCoeff = 0.01 ,
239+ slipForce = 0.4 ,
240+ popForce = 0.10
241+ )
0 commit comments