From c9b41a4e4dfbac2d48ce32e0a0d305aef7f60522 Mon Sep 17 00:00:00 2001 From: robdekon_h2t <robdekon@kit.edu> Date: Fri, 23 Sep 2022 19:02:50 +0200 Subject: [PATCH] Fix leftover stop events leading to immediate return on waitForStop Signed-off-by: Christoph Pohl <christoph.pohl@kit.edu> --- source/armarx/navigation/client/Navigator.cpp | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/source/armarx/navigation/client/Navigator.cpp b/source/armarx/navigation/client/Navigator.cpp index 15fb4bc1..73ab51bc 100644 --- a/source/armarx/navigation/client/Navigator.cpp +++ b/source/armarx/navigation/client/Navigator.cpp @@ -45,6 +45,12 @@ namespace armarx::navigation::client { ARMARX_TRACE; ARMARX_CHECK_NOT_NULL(srv.navigator) << "Navigator service must not be null!"; + { + // TODO: This still leads to a race condition, if extern a stop event is generated before moveTo but arrives + // after the event is reset + std::scoped_lock const l{stoppedInfo.m}; + stoppedInfo.event.reset(); + } srv.navigator->moveTo(waypoints, frame); } @@ -58,6 +64,12 @@ namespace armarx::navigation::client const std::vector<WaypointTarget>& path = builder.path(); validate(path); + { + // TODO: This still leads to a race condition, if extern a stop event is generated before moveTo but arrives + // after the event is reset + std::scoped_lock const l{stoppedInfo.m}; + stoppedInfo.event.reset(); + } srv.navigator->moveTo(path, frame); } @@ -67,6 +79,13 @@ namespace armarx::navigation::client { ARMARX_TRACE; ARMARX_CHECK_NOT_NULL(srv.navigator) << "Navigator service must not be null!"; + + { + // TODO: This still leads to a race condition, if extern a stop event is generated before moveTo but arrives + // after the event is reset + std::scoped_lock const l{stoppedInfo.m}; + stoppedInfo.event.reset(); + } srv.navigator->moveTowards(direction, frame); } -- GitLab