|
| 1 | +from re import I |
1 | 2 | import Sofa |
2 | 3 |
|
3 | | -g_needleLength=0.400 #(m) |
4 | | -g_needleNumberOfElems=40 #(# of edges) |
5 | | -g_needleBaseOffset=[0.04,0.25,-0.2] |
| 4 | +g_needleLength=0.200 #(m) |
| 5 | +g_needleNumberOfElems=20 #(# of edges) |
| 6 | +g_needleBaseOffset=[0.04,0.15,-0.2] |
6 | 7 | g_needleRadius = 0.001 #(m) |
7 | 8 | g_needleMechanicalParameters = { |
8 | 9 | "radius":g_needleRadius, |
|
15 | 16 | { |
16 | 17 | "n":[6, 4, 4], |
17 | 18 | "min":[-0.150, -0.050, -0.250], |
18 | | - "max":[0.150, 0.0499, -0.100] |
| 19 | + "max":[0.150, 0.0099, -0.100] |
19 | 20 | }, |
20 | 21 | { |
21 | 22 | "n":[6, 4, 4], |
22 | | - "min":[-0.150, 0.0501, -0.250], |
23 | | - "max":[0.150, 0.150, -0.100] |
| 23 | + "min":[-0.150, 0.0101, -0.250], |
| 24 | + "max":[0.150, 0.060, -0.100] |
24 | 25 | } |
25 | 26 | ] #Again all in mm |
26 | 27 | g_gelMechanicalParameters = { |
|
31 | 32 | g_gelTotalMass = 1 |
32 | 33 | g_cubeColor=[[0.8, 0.34, 0.34, 0.3],[0.6, 0.6, 0, 0.3]] |
33 | 34 | g_wireColor=[[0.8, 0.34, 0.34, 1],[0.6, 0.6, 0, 1]] |
34 | | -g_gelFixedBoxROI=[[-0.155, -0.055, -0.255, -0.145, 0.155, -0.095 ], [0.155, -0.055, -0.255, 0.145, 0.155, -0.095 ]] |
| 35 | +g_gelFixedBoxROI=[[-0.155, -0.055, -0.255, -0.145, 0.065, -0.095 ], [0.155, -0.055, -0.255, 0.145, 0.065, -0.095 ]] |
35 | 36 |
|
36 | 37 | # Function called when the scene graph is being created |
37 | 38 | def createScene(root): |
@@ -78,12 +79,12 @@ def createScene(root): |
78 | 79 |
|
79 | 80 | needleBaseMaster = root.addChild("NeedleBaseMaster") |
80 | 81 | needleBaseMaster.addObject("MechanicalObject", name="mstate_baseMaster", position=[0.04,0.25,-0.2, 0, 0, 0, 1], template="Rigid3d", showObjectScale=0.002, showObject=False, drawMode=1) |
81 | | - needleBaseMaster.addObject("LinearMovementProjectiveConstraint",indices=[0], keyTimes=[0,0.5,1,7,12],movements= |
82 | | - [ [0.04, 0.25,-0.2,0,0,0] |
83 | | - , [0.04, 0.60,-0.2,0,0,0] |
84 | | - , [0.04, 0.60,-0.2,0,0,-3.14/2] |
85 | | - , [0.04, 0.40,-0.2,0,0,-3.14/2] |
86 | | - , [0.05, 0.40,-0.2,0,0,-3.14/2 + 3.14/16] |
| 82 | + needleBaseMaster.addObject("LinearMovementProjectiveConstraint",indices=[0], keyTimes=[0,0.5,1,7,8],movements= |
| 83 | + [ [0.04, 0.15,-0.2,0,0,0] |
| 84 | + , [0.04, 0.30,-0.2,0,0,0] |
| 85 | + , [0.04, 0.30,-0.2,0,0,-3.14/2] |
| 86 | + , [0.04, 0.14,-0.2,0,0,-3.14/2] |
| 87 | + , [0.03, 0.14,-0.2,0,0,-3.14/2 + 3.14/16] |
87 | 88 | ],relativeMovements=False) |
88 | 89 |
|
89 | 90 |
|
@@ -145,7 +146,7 @@ def createScene(root): |
145 | 146 |
|
146 | 147 |
|
147 | 148 |
|
148 | | - for i in range(1,2): |
| 149 | + for i in range(0,2): |
149 | 150 | gelGridTopoName = "GelGridTopo" + str(i) |
150 | 151 | gelTopo = root.addChild(gelGridTopoName) |
151 | 152 | gelTopo.addObject("RegularGridTopology", name="HexaTop", **g_gelRegularGridParameters[i]) |
@@ -206,19 +207,23 @@ def createScene(root): |
206 | 207 | # object1="@Layer0/mstate_gel", object2="@Layer1/mstate_gel") |
207 | 208 |
|
208 | 209 |
|
209 | | - root.addObject("InsertionAlgorithm", name="InsertionAlgo", |
210 | | - tipGeom="@Needle/tipCollision/geom_tip", |
211 | | - surfGeom="@Layer1/collision/geom_tri", |
212 | | - shaftGeom="@Needle/bodyCollision/geom_body", |
213 | | - volGeom="@Layer1/geom_tetra", |
214 | | - punctureForceThreshold=0.8, |
215 | | - tipDistThreshold=0.005, |
216 | | - drawcollision=True, |
217 | | - drawPointsScale=0.0001 |
218 | | - ) |
219 | | - root.addObject("DistanceFilter",algo="@InsertionAlgo",distance=0.01) |
220 | | - root.addObject("SecondDirection",name="punctureDirection",handler="@Layer1/collision/SurfaceTriangles") |
221 | | - root.addObject("ConstraintUnilateral",input="@InsertionAlgo.collisionOutput",directions="@punctureDirection",draw_scale=0.001) |
222 | | - |
223 | | - root.addObject("FirstDirection",name="bindDirection", handler="@Needle/bodyCollision/NeedleBeams") |
224 | | - root.addObject("ConstraintInsertion",input="@InsertionAlgo.insertionOutput", directions="@bindDirection",draw_scale=0.002, frictionCoeff=0.00) |
| 210 | + for i in range(0,2): |
| 211 | + algo = root.addChild("algo"+str(i)) |
| 212 | + algo.addObject("InsertionAlgorithm", name="InsertionAlgo"+str(i), |
| 213 | + tipGeom="@/Needle/tipCollision/geom_tip", |
| 214 | + surfGeom="@/Layer"+str(i)+"/collision/geom_tri", |
| 215 | + shaftGeom="@/Needle/bodyCollision/geom_body", |
| 216 | + volGeom="@/Layer"+str(i)+"/geom_tetra", |
| 217 | + punctureForceThreshold=1.5, |
| 218 | + tipDistThreshold=0.005, |
| 219 | + drawcollision=True, |
| 220 | + drawPointsScale=0.0001 |
| 221 | + ) |
| 222 | + algo.addObject("DistanceFilter", algo="@InsertionAlgo"+str(i), distance=0.01) |
| 223 | + algo.addObject("SecondDirection", name="punctureDirection"+str(i), handler="@../Layer"+str(i)+"/collision/SurfaceTriangles") |
| 224 | + algo.addObject("ConstraintUnilateral", name="cs_Uni"+str(i), input="@InsertionAlgo"+str(i)+".collisionOutput", directions="@punctureDirection"+str(i),draw_scale=0.001) |
| 225 | + algo.addObject("FirstDirection", name="bindDirection"+str(i), handler="@../Needle/bodyCollision/NeedleBeams") |
| 226 | + algo.addObject("ConstraintInsertion", name="cs_Ins"+str(i), input="@InsertionAlgo"+str(i)+".insertionOutput", directions="@bindDirection"+str(i), draw_scale=0.002, frictionCoeff=0.00) |
| 227 | + |
| 228 | + #algo.addObject("SecondDirection",name="punctureDirectionInv",handler="@Layer1/collisionInvert/SurfaceTriangles") |
| 229 | + #algo.addObject("ConstraintUnilateral", name="invCnstr", input="@InsertionAlgo.collisionOutput",directions="@punctureDirectionInv",draw_scale=0.001,mu=0.1) |
0 commit comments