From 4338cfb1f2f6eb77411f7f25cb775539a8621bc3 Mon Sep 17 00:00:00 2001 From: Rainer Kartmann <rainer.kartmann@kit.edu> Date: Thu, 24 Mar 2022 11:09:51 +0100 Subject: [PATCH] Use Clock::WaitFor() --- .../libraries/armem_robot_state/client/common/RobotReader.cpp | 3 +-- .../armem_robot_state/client/common/VirtualRobotReader.cpp | 4 +--- 2 files changed, 2 insertions(+), 5 deletions(-) diff --git a/source/RobotAPI/libraries/armem_robot_state/client/common/RobotReader.cpp b/source/RobotAPI/libraries/armem_robot_state/client/common/RobotReader.cpp index 3c59b2980..7a4305c6f 100644 --- a/source/RobotAPI/libraries/armem_robot_state/client/common/RobotReader.cpp +++ b/source/RobotAPI/libraries/armem_robot_state/client/common/RobotReader.cpp @@ -112,7 +112,6 @@ namespace armarx::armem::robot_state { const auto tsStartFunctionInvokation = armem::Time::Now(); - Clock clock; while (true) { auto state = queryState(obj.description, timestamp); @@ -130,7 +129,7 @@ namespace armarx::armem::robot_state } ARMARX_INFO << "Retrying to query robot state after failure"; - clock.waitFor(sleepAfterFailure); + Clock::WaitFor(sleepAfterFailure); } obj.config = std::move(*state); diff --git a/source/RobotAPI/libraries/armem_robot_state/client/common/VirtualRobotReader.cpp b/source/RobotAPI/libraries/armem_robot_state/client/common/VirtualRobotReader.cpp index b59eaad14..6eeb7e2e9 100644 --- a/source/RobotAPI/libraries/armem_robot_state/client/common/VirtualRobotReader.cpp +++ b/source/RobotAPI/libraries/armem_robot_state/client/common/VirtualRobotReader.cpp @@ -92,8 +92,6 @@ namespace armarx::armem::robot_state const VirtualRobot::RobotIO::RobotDescription& loadMode, const bool blocking) { - Clock clock; - while (blocking) { VirtualRobot::RobotPtr robot = getRobot(name, timestamp, loadMode); @@ -103,7 +101,7 @@ namespace armarx::armem::robot_state } ARMARX_INFO << "Retrying to query robot after failure"; - clock.waitFor(sleepAfterFailure); + Clock::WaitFor(sleepAfterFailure); } ARMARX_WARNING << "Failed to get synchronized robot `" << name << "`"; -- GitLab