We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 6c6aa07 commit 28085abCopy full SHA for 28085ab
1 file changed
behaviortree_ros2/src/tree_execution_server.cpp
@@ -251,13 +251,20 @@ void TreeExecutionServer::execute(
251
goal_handle->publish_feedback(feedback);
252
}
253
254
- const auto now = std::chrono::steady_clock::now();
+ auto now = std::chrono::steady_clock::now();
255
if(now < loop_deadline)
256
{
257
p_->tree.sleep(std::chrono::duration_cast<std::chrono::system_clock::duration>(
258
loop_deadline - now));
259
+ now = std::chrono::steady_clock::now();
260
+ }
261
+ // If sleep was woken early, it will still be before the next deadline
262
+ // so it might still be necessary to wait for it. Only advance to the
263
+ // next deadline if one has passed.
264
+ if(now >= loop_deadline)
265
+ {
266
+ loop_deadline += period;
267
- loop_deadline += period;
268
269
270
catch(const std::exception& ex)
0 commit comments