Skip to content

Commit fb2a460

Browse files
authored
[algorithm] Convert impulse to force when checking for puncture (#108)
* [scene] Adjust scenes
1 parent a913d9d commit fb2a460

File tree

4 files changed

+6
-3
lines changed

4 files changed

+6
-3
lines changed

scenes/NeedleInsertion.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -187,7 +187,7 @@ def createScene(root):
187187
surfGeom="@Volume/collision/geom_tri",
188188
shaftGeom="@Needle/bodyCollision/geom_body",
189189
volGeom="@Volume/geom_tetra",
190-
punctureForceThreshold=16,
190+
punctureForceThreshold=1600,
191191
tipDistThreshold=0.003,
192192
drawcollision=True,
193193
drawPointsScale=0.0001

scenes/NeedleInsertionCycles.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -204,7 +204,7 @@ def createScene(root):
204204
surfGeom="@Volume/collision/geom_tri",
205205
shaftGeom="@Needle/bodyCollision/geom_body",
206206
volGeom="@Volume/geom_tetra",
207-
punctureForceThreshold=2.,
207+
punctureForceThreshold=200,
208208
tipDistThreshold=0.003,
209209
drawcollision=True,
210210
drawPointsScale=0.0001

scenes/NeedleInsertionHaptics.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -212,7 +212,7 @@ def createScene(root):
212212
surfGeom="@Volume/collision/geom_tri",
213213
shaftGeom="@Needle/bodyCollision/geom_body",
214214
volGeom="@Volume/geom_tetra",
215-
punctureForceThreshold=1.,
215+
punctureForceThreshold=100,
216216
tipDistThreshold=0.01,
217217
drawcollision=True,
218218
drawPointsScale=0.0001

src/CollisionAlgorithm/algorithm/InsertionAlgorithm.cpp

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -180,12 +180,15 @@ InsertionAlgorithm::AlgorithmOutput InsertionAlgorithm::puncturePhase()
180180
l_tipGeom->getContext()->get<MechStateTipType>();
181181
const auto& lambda =
182182
m_constraintSolver->getLambda()[mstate.get()].read()->getValue();
183+
const auto dt = l_tipGeom->getContext()->getDt();
183184
SReal norm{0_sreal};
184185

185186
for (const auto& l : lambda)
186187
{
187188
norm += l.norm();
188189
}
190+
// Convert impulse to force
191+
norm /= dt;
189192

190193
if (norm > punctureForceThreshold)
191194
{

0 commit comments

Comments
 (0)