Skip to content

Commit

Permalink
Use BT.cpp sleep
Browse files Browse the repository at this point in the history
Signed-off-by: Tony Najjar <[email protected]>
  • Loading branch information
tonynajjar committed Nov 22, 2024
1 parent e52ea5d commit ff7858d
Showing 1 changed file with 1 addition and 8 deletions.
9 changes: 1 addition & 8 deletions nav2_behavior_tree/src/behavior_tree_engine.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,6 @@ BehaviorTreeEngine::run(
std::function<bool()> cancelRequested,
std::chrono::milliseconds loopTimeout)
{
rclcpp::WallRate loopRate(loopTimeout);
BT::NodeStatus result = BT::NodeStatus::RUNNING;

// Loop until something happens with ROS or the node completes
Expand All @@ -64,13 +63,7 @@ BehaviorTreeEngine::run(

onLoop();

if (!loopRate.sleep()) {
RCLCPP_DEBUG_THROTTLE(
rclcpp::get_logger("BehaviorTreeEngine"),
*clock_, 1000,
"Behavior Tree tick rate %0.2f was exceeded!",
1.0 / (loopRate.period().count() * 1.0e-9));
}
tree->sleep(loopTimeout);
}
} catch (const std::exception & ex) {
RCLCPP_ERROR(
Expand Down

0 comments on commit ff7858d

Please sign in to comment.