Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
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
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
#include <memory>
#include <string>
#include <vector>
#include "rclcpp/rclcpp.hpp"

#include "behaviortree_cpp_v3/behavior_tree.h"
#include "behaviortree_cpp_v3/bt_factory.h"
Expand Down Expand Up @@ -61,6 +62,7 @@ class BehaviorTreeEngine
BT::Tree * tree,
std::function<void()> onLoop,
std::function<bool()> cancelRequested,
rclcpp::Logger logger,
std::chrono::milliseconds loopTimeout = std::chrono::milliseconds(10));

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -243,8 +243,11 @@ void BtActionServer<ActionT>::executeCallback()
};

// Execute the BT that was previously created in the configure step
nav2_behavior_tree::BtStatus rc = bt_->run(tree_, on_loop, is_canceling, bt_loop_duration_);
nav2_behavior_tree::BtStatus rc = bt_->run(tree_, on_loop, is_canceling, logger_, bt_loop_duration_);

// send remaining logs
topic_logger_->flush();

// Make sure that the Bt is not in a running state from a previous execution
// note: if all the ControlNodes are implemented correctly, this is not needed.
bt_->haltAllActions(tree_->rootNode());
Expand Down
3 changes: 2 additions & 1 deletion nav2_behavior_tree/src/behavior_tree_engine.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ BehaviorTreeEngine::run(
BT::Tree * tree,
std::function<void()> onLoop,
std::function<bool()> cancelRequested,
rclcpp::Logger logger,
std::chrono::milliseconds loopTimeout)
{
rclcpp::WallRate loopRate(loopTimeout);
Expand All @@ -59,7 +60,7 @@ BehaviorTreeEngine::run(
}
} catch (const std::exception & ex) {
RCLCPP_ERROR(
rclcpp::get_logger("BehaviorTreeEngine"),
logger,
"Behavior tree threw exception: %s. Exiting with failure.", ex.what());
return BtStatus::FAILED;
}
Expand Down