From f53b7047f1a936cc8f5a718df6134ca8af27fd73 Mon Sep 17 00:00:00 2001 From: Niklas Halle Date: Mon, 7 Apr 2025 14:06:27 +0000 Subject: [PATCH] dirty hack to terminate executor after hard-coded time --- src/priority_executor/src/priority_executor.cpp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/priority_executor/src/priority_executor.cpp b/src/priority_executor/src/priority_executor.cpp index 6a5e63a..f9eee3e 100755 --- a/src/priority_executor/src/priority_executor.cpp +++ b/src/priority_executor/src/priority_executor.cpp @@ -38,7 +38,10 @@ void TimedExecutor::spin() { } RCLCPP_SCOPE_EXIT(this->spinning.store(false);); - while (rclcpp::ok(this->context_) && spinning.load()) { + using namespace std::chrono_literals; + std::chrono::time_point start = std::chrono::steady_clock::now(); + + while (rclcpp::ok(this->context_) && spinning.load() && (std::chrono::steady_clock::now() - start) <= 5s) { rclcpp::AnyExecutable any_executable; // std::cout<number_of_ready_timers()<name << std::endl;