Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use BT.CPP Tree::sleep #4761

Merged
merged 8 commits into from
Nov 27, 2024
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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));
}
SteveMacenski marked this conversation as resolved.
Show resolved Hide resolved
tree->sleep(loopTimeout);
}
} catch (const std::exception & ex) {
RCLCPP_ERROR(
Expand Down
Loading