From cf8938773cf6a7083b21c97e03c3ff24c48af362 Mon Sep 17 00:00:00 2001 From: Themis Skamagkis Date: Tue, 16 Dec 2025 16:56:33 +0100 Subject: [PATCH 1/2] [algorithm] Convert impulse to force when checking for puncture --- src/CollisionAlgorithm/algorithm/InsertionAlgorithm.cpp | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/CollisionAlgorithm/algorithm/InsertionAlgorithm.cpp b/src/CollisionAlgorithm/algorithm/InsertionAlgorithm.cpp index fbf761f..3ba2364 100644 --- a/src/CollisionAlgorithm/algorithm/InsertionAlgorithm.cpp +++ b/src/CollisionAlgorithm/algorithm/InsertionAlgorithm.cpp @@ -180,12 +180,15 @@ InsertionAlgorithm::AlgorithmOutput InsertionAlgorithm::puncturePhase() l_tipGeom->getContext()->get(); const auto& lambda = m_constraintSolver->getLambda()[mstate.get()].read()->getValue(); + const auto dt = l_tipGeom->getContext()->getDt(); SReal norm{0_sreal}; for (const auto& l : lambda) { norm += l.norm(); } + // Convert impulse to force + norm /= dt; if (norm > punctureForceThreshold) { From 1652d518921b80222587f7e4e2f2d239d7d0fb24 Mon Sep 17 00:00:00 2001 From: Themis Skamagkis Date: Tue, 16 Dec 2025 17:03:21 +0100 Subject: [PATCH 2/2] [scene] Adjust scenes --- scenes/NeedleInsertion.py | 2 +- scenes/NeedleInsertionCycles.py | 2 +- scenes/NeedleInsertionHaptics.py | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/scenes/NeedleInsertion.py b/scenes/NeedleInsertion.py index 924548f..c813262 100644 --- a/scenes/NeedleInsertion.py +++ b/scenes/NeedleInsertion.py @@ -187,7 +187,7 @@ def createScene(root): surfGeom="@Volume/collision/geom_tri", shaftGeom="@Needle/bodyCollision/geom_body", volGeom="@Volume/geom_tetra", - punctureForceThreshold=16, + punctureForceThreshold=1600, tipDistThreshold=0.003, drawcollision=True, drawPointsScale=0.0001 diff --git a/scenes/NeedleInsertionCycles.py b/scenes/NeedleInsertionCycles.py index 45bde99..2b3cb85 100644 --- a/scenes/NeedleInsertionCycles.py +++ b/scenes/NeedleInsertionCycles.py @@ -204,7 +204,7 @@ def createScene(root): surfGeom="@Volume/collision/geom_tri", shaftGeom="@Needle/bodyCollision/geom_body", volGeom="@Volume/geom_tetra", - punctureForceThreshold=2., + punctureForceThreshold=200, tipDistThreshold=0.003, drawcollision=True, drawPointsScale=0.0001 diff --git a/scenes/NeedleInsertionHaptics.py b/scenes/NeedleInsertionHaptics.py index ca85f1e..e0a43da 100644 --- a/scenes/NeedleInsertionHaptics.py +++ b/scenes/NeedleInsertionHaptics.py @@ -212,7 +212,7 @@ def createScene(root): surfGeom="@Volume/collision/geom_tri", shaftGeom="@Needle/bodyCollision/geom_body", volGeom="@Volume/geom_tetra", - punctureForceThreshold=1., + punctureForceThreshold=100, tipDistThreshold=0.01, drawcollision=True, drawPointsScale=0.0001