Skip to content

Commit 029a09b

Browse files
authored
[Scenes] Fix runtime warnings, and consistent behavior between python and xml (#179)
* fix warnings, behavior in scenes * remove nbBeams deprecation msg and nb nodes/edges warnings * fix regression tests * remove info msg about topology
1 parent a3ad75d commit 029a09b

7 files changed

Lines changed: 51 additions & 44 deletions

examples/3instruments.scn

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -19,11 +19,11 @@
1919
<DefaultVisualManagerLoop/>
2020

2121

22-
<!-- ------------------------- INTERVENTIONAL RADIOLOGY INSTRUMENTS (catheter, guidewire, coil) ------------------------------ -->
22+
<!-- INTERVENTIONAL RADIOLOGY INSTRUMENTS (catheter, guidewire, coil) -->
2323

2424
<Node name='topoLines_cath'>
25-
<RodStraightSection name="StraightSection" youngModulus="10000" massDensity='0.00000155' nbEdgesCollis="40" nbEdgesVisu="120" length="600.0" radius='1'/> <!--stiff silicone E = 10000 MPa // 1550 Kg/m3-->
26-
<RodSpireSection name="SpireSection" youngModulus="10000" massDensity='0.00000155' nbEdgesCollis="20" nbEdgesVisu="80" length="400.0" spireDiameter="4000.0" spireHeight="0.0" radius='1'/>
25+
<RodStraightSection name="StraightSection" youngModulus="10000" massDensity='0.00000155' nbBeams="40" nbEdgesCollis="40" nbEdgesVisu="120" length="600.0" radius='1'/> <!--stiff silicone E = 10000 MPa // 1550 Kg/m3-->
26+
<RodSpireSection name="SpireSection" youngModulus="10000" massDensity='0.00000155' nbBeams="20" nbEdgesCollis="20" nbEdgesVisu="80" length="400.0" spireDiameter="4000.0" spireHeight="0.0" radius='1'/>
2727

2828
<WireRestShape template="Rigid3d" name="catheterRestShape" wireMaterials="@StraightSection @SpireSection"/>
2929

@@ -33,8 +33,8 @@
3333
<MechanicalObject template='Rigid3d' name='dofTopo1' />
3434
</Node>
3535
<Node name='topoLines_guide'>
36-
<RodStraightSection name="StraightSection" youngModulus="10000" massDensity='0.00000155' nbEdgesCollis="50" nbEdgesVisu="196" length="980.0" radius='0.9'/> <!--stiff silicone E = 10000 MPa // 1550 Kg/m3-->
37-
<RodSpireSection name="SpireSection" youngModulus="10000" massDensity='0.00000155' nbEdgesCollis="10" nbEdgesVisu="4" length="20.0" spireDiameter="25" spireHeight="0.0" radius='0.9'/>
36+
<RodStraightSection name="StraightSection" youngModulus="10000" massDensity='0.00000155' nbBeams="50" nbEdgesCollis="50" nbEdgesVisu="196" length="980.0" radius='0.9'/> <!--stiff silicone E = 10000 MPa // 1550 Kg/m3-->
37+
<RodSpireSection name="SpireSection" youngModulus="10000" massDensity='0.00000155' nbBeams="10" nbEdgesCollis="10" nbEdgesVisu="4" length="20.0" spireDiameter="25" spireHeight="0.0" radius='0.9'/>
3838

3939
<WireRestShape template="Rigid3d" name="GuideRestShape" wireMaterials="@StraightSection @SpireSection"/>
4040

@@ -44,8 +44,8 @@
4444
<MechanicalObject template='Rigid3d' name='dofTopo2' />
4545
</Node>
4646
<Node name='topoLines_coils'>
47-
<RodStraightSection name="StraightSection" youngModulus="168000" massDensity='0.000021' nbEdgesCollis="30" nbEdgesVisu="360" length="540.0" radius='0.1'/> <!-- platine E = 168000 MPa // 21000 Kg/m3-->
48-
<RodSpireSection name="SpireSection" youngModulus="168000" massDensity='0.000021' nbEdgesCollis="30" nbEdgesVisu="40" length="60.0" spireDiameter="7" spireHeight="5.0" radius='0.1'/>
47+
<RodStraightSection name="StraightSection" youngModulus="168000" massDensity='0.000021' nbBeams="30" nbEdgesCollis="30" nbEdgesVisu="360" length="540.0" radius='0.1'/> <!-- platine E = 168000 MPa // 21000 Kg/m3-->
48+
<RodSpireSection name="SpireSection" youngModulus="168000" massDensity='0.000021' nbBeams="30" nbEdgesCollis="30" nbEdgesVisu="40" length="60.0" spireDiameter="7" spireHeight="5.0" radius='0.1'/>
4949

5050
<WireRestShape template="Rigid3d" name="CoilRestShape" wireMaterials="@StraightSection @SpireSection"/>
5151

@@ -60,7 +60,7 @@
6060
<EulerImplicitSolver rayleighStiffness='0.2' rayleighMass='0.1' printLog='false' />
6161
<BTDLinearSolver subpartSolve='0' verification='0' verbose='0'/>
6262
<RegularGridTopology name='meshLinesCombined'
63-
nx='180' ny='1' nz='1'
63+
nx='181' ny='1' nz='1'
6464
xmin='0.0' xmax='1.0'
6565
ymin='0' ymax='0'
6666
zmin='1' zmax='1'

examples/3instruments_collis.scn

Lines changed: 22 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -35,11 +35,11 @@
3535
<LocalMinDistance name="localmindistance" alarmDistance="2" contactDistance="1" angleCone="0.5" coneFactor="0.5" />
3636
<CollisionResponse name="Response" response="FrictionContactConstraint" />
3737

38-
<!-- ------------------------- INTERVENTIONAL RADIOLOGY INSTRUMENTS (catheter, guidewire, coil) ------------------------------ -->
38+
<!-- INTERVENTIONAL RADIOLOGY INSTRUMENTS (catheter, guidewire, coil) -->
3939

4040
<Node name="topoLines_cath">
41-
<RodStraightSection name="StraightSection" youngModulus="10000" massDensity="0.00000155" radius="1" nbEdgesCollis="40" nbEdgesVisu="220" length="600.0"/><!--stiff silicone E = 10000 MPa // 1550 Kg/m3-->
42-
<RodSpireSection name="SpireSection" youngModulus="10000" massDensity="0.00000155" radius="1" nbEdgesCollis="10" nbEdgesVisu="80" length="400.0" spireDiameter="4000.0" spireHeight="0.0"/>
41+
<RodStraightSection name="StraightSection" youngModulus="10000" massDensity="0.00000155" radius="1" nbBeams="40" nbEdgesCollis="40" nbEdgesVisu="220" length="600.0"/><!--stiff silicone E = 10000 MPa // 1550 Kg/m3-->
42+
<RodSpireSection name="SpireSection" youngModulus="10000" massDensity="0.00000155" radius="1" nbBeams="10" nbEdgesCollis="10" nbEdgesVisu="80" length="400.0" spireDiameter="4000.0" spireHeight="0.0"/>
4343

4444
<WireRestShape template="Rigid3d" name="catheterRestShape" wireMaterials="@StraightSection @SpireSection"/> <!-- silicone -->
4545

@@ -49,8 +49,8 @@
4949
<MechanicalObject template="Rigid3d" name="dofTopo1" />
5050
</Node>
5151
<Node name="topoLines_guide">
52-
<RodStraightSection name="StraightSection" youngModulus="10000" massDensity="0.00000155" radius="0.9" nbEdgesCollis="50" nbEdgesVisu="196" length="980.0"/> <!--stiff silicone E = 10000 MPa // 1550 Kg/m3-->
53-
<RodSpireSection name="SpireSection" youngModulus="10000" massDensity="0.00000155" radius="0.9" nbEdgesCollis="10" nbEdgesVisu="4" length="20.0" spireDiameter="25" spireHeight="0.0"/>
52+
<RodStraightSection name="StraightSection" youngModulus="10000" massDensity="0.00000155" radius="0.9" nbBeams="50" nbEdgesCollis="50" nbEdgesVisu="196" length="980.0"/> <!--stiff silicone E = 10000 MPa // 1550 Kg/m3-->
53+
<RodSpireSection name="SpireSection" youngModulus="10000" massDensity="0.00000155" radius="0.9" nbBeams="10" nbEdgesCollis="10" nbEdgesVisu="4" length="20.0" spireDiameter="25" spireHeight="0.0"/>
5454

5555
<WireRestShape template="Rigid3d" name="GuideRestShape" wireMaterials="@StraightSection @SpireSection"/>
5656

@@ -60,8 +60,8 @@
6060
<MechanicalObject template="Rigid3d" name="dofTopo2" />
6161
</Node>
6262
<Node name="topoLines_coils">
63-
<RodStraightSection name="StraightSection" youngModulus="168000" massDensity="0.000021" radius="0.1" nbEdgesCollis="30" nbEdgesVisu="360" length="540.0"/> <!-- platine E = 168000 MPa // 21000 Kg/m3-->
64-
<RodSpireSection name="SpireSection" youngModulus="168000" massDensity="0.000021" radius="0.1" nbEdgesCollis="30" nbEdgesVisu="40" length="60.0" spireDiameter="7" spireHeight="5.0"/>
63+
<RodStraightSection name="StraightSection" youngModulus="168000" massDensity="0.000021" radius="0.1" nbBeams="30" nbEdgesCollis="30" nbEdgesVisu="360" length="540.0"/> <!-- platine E = 168000 MPa // 21000 Kg/m3-->
64+
<RodSpireSection name="SpireSection" youngModulus="168000" massDensity="0.000021" radius="0.1" nbBeams="30" nbEdgesCollis="30" nbEdgesVisu="40" length="60.0" spireDiameter="7" spireHeight="5.0"/>
6565

6666
<WireRestShape template="Rigid3d" name="CoilRestShape" wireMaterials="@StraightSection @SpireSection"/>
6767

@@ -142,14 +142,21 @@
142142
</Node>
143143
</Node>
144144

145-
<Node name="CollisionModel">
146-
<MeshOBJLoader name="meshLoader" filename="mesh/phantom.obj" triangulate="true" flipNormals="1"/>
147-
<MeshTopology position="@meshLoader.position" triangles="@meshLoader.triangles"/>
148-
<MechanicalObject name="DOFs1" position="0 0 400" scale="3" ry="90"/>
149-
<TriangleCollisionModel simulated="0" moving="0"/>
150-
<LineCollisionModel simulated="0" moving="0"/>
151-
<PointCollisionModel simulated="0" moving="0"/>
152-
<OglModel name="Visual" src="@meshLoader" color="1 0 0 0.3" scale="3" ry="90"/>
145+
<Node name="VesselsPhantom">
146+
<MeshOBJLoader name="meshLoader" filename="mesh/phantom.obj" triangulate="true" flipNormals="1" scale="3" rotation="0 90 0"/>
147+
148+
<Node name="Collision">
149+
<MeshTopology position="@../meshLoader.position" triangles="@meshLoader.triangles"/>
150+
<MechanicalObject name="DOFs1"/>
151+
<TriangleCollisionModel simulated="0" moving="0"/>
152+
<LineCollisionModel simulated="0" moving="0"/>
153+
<PointCollisionModel simulated="0" moving="0"/>
154+
</Node>
155+
156+
<Node name="Visual">
157+
<OglModel name="Visual" src="@../meshLoader" color="1 0 0 0.3" />
158+
</Node>
159+
153160
</Node>
154161

155162
</Node>

examples/SingleBeamDeployment.scn

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,8 @@
1515
<DefaultVisualManagerLoop />
1616

1717
<Node name="EdgeTopology">
18-
<RodStraightSection name="StraightSection" youngModulus="20000" radius="0.9" massDensity="0.00000155" nbEdgesCollis="30" nbEdgesVisu="196" length="980.0"/>
19-
<RodSpireSection name="SpireSection" youngModulus="20000" radius="0.9" massDensity="0.00000155" nbEdgesCollis="5" nbEdgesVisu="4" length="20.0" spireDiameter="25" spireHeight="0.0"/>
18+
<RodStraightSection name="StraightSection" youngModulus="20000" radius="0.9" massDensity="0.00000155" nbBeams="30" nbEdgesCollis="30" nbEdgesVisu="196" length="980.0"/>
19+
<RodSpireSection name="SpireSection" youngModulus="20000" radius="0.9" massDensity="0.00000155" nbBeams="5" nbEdgesCollis="5" nbEdgesVisu="4" length="20.0" spireDiameter="25" spireHeight="0.0"/>
2020

2121
<WireRestShape template="Rigid3d" name="BeamRestShape" printLog="1" wireMaterials="@StraightSection @SpireSection"/>
2222
<EdgeSetTopologyContainer name="meshLinesBeam"/>
@@ -36,7 +36,7 @@
3636
<WireBeamInterpolation name="BeamInterpolation" WireRestShape="@../EdgeTopology/BeamRestShape" />
3737
<AdaptiveBeamForceFieldAndMass name="BeamForceField" interpolation="@BeamInterpolation"/>
3838
<InterventionalRadiologyController name="DeployController" template="Rigid3d" instruments="BeamInterpolation"
39-
startingPos="0 0 0 0 0 0 1" xtip="0 0 0" printLog="1"
39+
topology="@MeshLines" startingPos="0 0 0 0 0 0 1" xtip="0 0 0" printLog="1"
4040
rotationInstrument="0 0 0" step="0.5" speed="0.5"
4141
listening="1" controlledInstrument="0"/>
4242
<FixedProjectiveConstraint name="FixedConstraint" indices="0" />

examples/SingleBeamDeploymentCollision.scn

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -32,8 +32,8 @@
3232

3333

3434
<Node name="EdgeTopology">
35-
<RodStraightSection name="StraightSection" youngModulus="20000" radius="0.9" massDensity="0.00000155" poissonRatio="0.3" nbEdgesCollis="50" nbEdgesVisu="200" length="980.0"/>
36-
<RodSpireSection name="SpireSection" youngModulus="20000" radius="0.9" massDensity="0.00000155" poissonRatio="0.3" nbEdgesCollis="10" nbEdgesVisu="200" length="20.0" spireDiameter="25" spireHeight="0.0"/>
35+
<RodStraightSection name="StraightSection" youngModulus="20000" radius="0.9" massDensity="0.00000155" poissonRatio="0.3" nbBeams="50" nbEdgesCollis="50" nbEdgesVisu="200" length="980.0"/>
36+
<RodSpireSection name="SpireSection" youngModulus="20000" radius="0.9" massDensity="0.00000155" poissonRatio="0.3" nbBeams="10" nbEdgesCollis="10" nbEdgesVisu="200" length="20.0" spireDiameter="25" spireHeight="0.0"/>
3737

3838
<WireRestShape template="Rigid3d" name="BeamRestShape" wireMaterials="@StraightSection @SpireSection"/>
3939

@@ -54,7 +54,7 @@
5454
<WireBeamInterpolation name="BeamInterpolation" WireRestShape="@../EdgeTopology/BeamRestShape"/>
5555
<AdaptiveBeamForceFieldAndMass name="BeamForceField" interpolation="@BeamInterpolation"/>
5656
<InterventionalRadiologyController name="DeployController" template="Rigid3d" instruments="BeamInterpolation"
57-
startingPos="0 0 0 0 0 0 1" xtip="0 0 0" printLog="1"
57+
topology="@MeshLines" startingPos="0 0 0 0 0 0 1" xtip="0 0 0" printLog="1"
5858
rotationInstrument="0 0 0" step="5" speed="5"
5959
listening="1" controlledInstrument="0"/>
6060
<LinearSolverConstraintCorrection wire_optimization="true" printLog="0" />

examples/Tool_from_loader.scn

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -25,8 +25,8 @@
2525
<Node name="GuideCatheter">
2626
<MeshOBJLoader name="loader" filename="mesh/key_tip.obj" />
2727

28-
<RodStraightSection name="StraightSection" youngModulus="1000000" poissonRatio="0.3" radius="0.05" massDensity="0.1" nbEdgesCollis="30" nbEdgesVisu="200" length="980.0"/>
29-
<RodMeshSection name="MeshTipSection" loader="@loader" nbEdgesCollis="300" nbEdgesVisu="300" radius="0.05" massDensity="0.1" youngModulus="1000000" poissonRatio="0.3"/>
28+
<RodStraightSection name="StraightSection" youngModulus="1000000" poissonRatio="0.3" massDensity="0.00000155" radius="0.05" nbBeams="30" nbEdgesCollis="30" nbEdgesVisu="200" length="980.0"/>
29+
<RodMeshSection name="MeshTipSection" loader="@loader" youngModulus="1000000" poissonRatio="0.3" massDensity="0.00000155" radius="0.05" nbBeams="300" nbEdgesCollis="300" nbEdgesVisu="300" />
3030

3131
<WireRestShape template="Rigid3d" name="GC_RestShape" printLog="false" wireMaterials="@StraightSection @MeshTipSection" />
3232

@@ -39,7 +39,7 @@
3939
<Node name="Instrument">
4040
<EulerImplicitSolver rayleighStiffness="0.2" rayleighMass="0.1" />
4141
<BTDLinearSolver />
42-
<RegularGridTopology name="MeshLines" nx="330" ny="1" nz="1"
42+
<RegularGridTopology name="MeshLines" nx="331" ny="1" nz="1"
4343
xmax="0.0" xmin="0.0" ymin="0" ymax="0" zmax="0" zmin="0"
4444
p0="0 0 0" drawEdges="0"/>
4545

examples/python3/SingleBeamDeployment.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -12,14 +12,14 @@ def createScene(rootNode):
1212
topoLines = rootNode.addChild('EdgeTopology')
1313
topoLines.addObject('RodStraightSection', name='StraightSection',
1414
length=980.0, radius=0.9,
15-
nbEdgesCollis=30, nbEdgesVisu=196,
16-
youngModulus=20000)
15+
nbBeams=30, nbEdgesCollis=30, nbEdgesVisu=196,
16+
youngModulus=20000, massDensity=0.00000155)
1717

1818
topoLines.addObject('RodSpireSection', name='SpireSection',
1919
length=20.0, radius=0.9,
20-
nbEdgesCollis=5, nbEdgesVisu=4,
20+
nbBeams=5, nbEdgesCollis=5, nbEdgesVisu=4,
2121
spireDiameter=25, spireHeight=0,
22-
youngModulus=20000)
22+
youngModulus=20000, massDensity=0.00000155)
2323
topoLines.addObject('WireRestShape', name='BeamRestShape', template="Rigid3d",
2424
wireMaterials="@StraightSection @SpireSection")
2525

@@ -34,14 +34,14 @@ def createScene(rootNode):
3434
BeamMechanics.addObject('EulerImplicitSolver', rayleighStiffness=0.2, printLog=False, rayleighMass=0.1)
3535
BeamMechanics.addObject('BTDLinearSolver', verification=False, subpartSolve=False, verbose=False)
3636
BeamMechanics.addObject('RegularGridTopology', name='MeshLines', drawEdges=True,
37-
nx=60, ny=1, nz=1,
37+
nx=61, ny=1, nz=1,
3838
xmax=0.0, xmin=0.0, ymin=0, ymax=0, zmax=0, zmin=0,
3939
p0=[0,0,0])
4040
BeamMechanics.addObject('MechanicalObject', showIndices=False, name='DOFs Container', template='Rigid3d', ry=-90)
4141
BeamMechanics.addObject('WireBeamInterpolation', name='BeamInterpolation', WireRestShape='@../EdgeTopology/BeamRestShape', printLog=False)
4242
BeamMechanics.addObject('AdaptiveBeamForceFieldAndMass', name='BeamForceField', massDensity=0.00000155, interpolation='@BeamInterpolation')
4343
BeamMechanics.addObject('InterventionalRadiologyController', name='DeployController', template='Rigid3d', instruments='BeamInterpolation',
44-
startingPos=[0, 0, 0, 0, 0, 0, 1], xtip=[0, 0, 0], printLog=True,
44+
topology="@MeshLines", startingPos=[0, 0, 0, 0, 0, 0, 1], xtip=[0, 0, 0], printLog=True,
4545
rotationInstrument=[0, 0, 0], step=0.5, speed=0.5,
4646
listening=True, controlledInstrument=0)
4747
BeamMechanics.addObject('FixedProjectiveConstraint', indices=0, name='FixedConstraint')

examples/python3/SingleBeamDeploymentCollision.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -20,14 +20,14 @@ def createScene(rootNode):
2020
topoLines = rootNode.addChild('EdgeTopology')
2121
topoLines.addObject('RodStraightSection', name='StraightSection',
2222
length=980.0, radius=0.9,
23-
nbEdgesCollis=50, nbEdgesVisu=200,
24-
youngModulus=20000, massDensity=0.1, poissonRatio=0.3)
23+
nbBeams=50, nbEdgesCollis=50, nbEdgesVisu=200,
24+
youngModulus=20000, massDensity=0.00000155, poissonRatio=0.3)
2525

2626
topoLines.addObject('RodSpireSection', name='SpireSection',
2727
length=20.0, radius=0.9,
28-
nbEdgesCollis=10, nbEdgesVisu=200,
28+
nbBeams=10, nbEdgesCollis=10, nbEdgesVisu=200,
2929
spireDiameter=25, spireHeight=0,
30-
youngModulus=20000, massDensity=0.1, poissonRatio=0.3)
30+
youngModulus=20000, massDensity=0.00000155, poissonRatio=0.3)
3131
topoLines.addObject('WireRestShape', name='BeamRestShape', template="Rigid3d",
3232
wireMaterials="@StraightSection @SpireSection")
3333

@@ -42,14 +42,14 @@ def createScene(rootNode):
4242
BeamMechanics.addObject('EulerImplicitSolver', rayleighStiffness=0.2, rayleighMass=0.1)
4343
BeamMechanics.addObject('BTDLinearSolver', verification=False, subpartSolve=False, verbose=False)
4444
BeamMechanics.addObject('RegularGridTopology', name='MeshLines',
45-
nx=60, ny=1, nz=1,
45+
nx=61, ny=1, nz=1,
4646
xmax=0.0, xmin=0.0, ymin=0, ymax=0, zmax=0, zmin=0,
4747
p0=[0,0,0])
4848
BeamMechanics.addObject('MechanicalObject', showIndices=False, name='DOFs', template='Rigid3d', ry=-90)
4949
BeamMechanics.addObject('WireBeamInterpolation', name='BeamInterpolation', WireRestShape='@../EdgeTopology/BeamRestShape', printLog=False)
5050
BeamMechanics.addObject('AdaptiveBeamForceFieldAndMass', name='BeamForceField', massDensity=0.00000155, interpolation='@BeamInterpolation')
5151
BeamMechanics.addObject('InterventionalRadiologyController', name='DeployController', template='Rigid3d', instruments='BeamInterpolation',
52-
startingPos=[0, 0, 0, 0, 0, 0, 1], xtip=[0, 0, 0], printLog=True,
52+
topology="@MeshLines", startingPos=[0, 0, 0, 0, 0, 0, 1], xtip=[0, 0, 0], printLog=True,
5353
rotationInstrument=[0, 0, 0], step=5., speed=5.,
5454
listening=True, controlledInstrument=0)
5555
BeamMechanics.addObject('LinearSolverConstraintCorrection', wire_optimization='true', printLog=False)

0 commit comments

Comments
 (0)