16 #ifndef NAV2_BEHAVIOR_TREE__BEHAVIOR_TREE_ENGINE_HPP_
17 #define NAV2_BEHAVIOR_TREE__BEHAVIOR_TREE_ENGINE_HPP_
23 #include "behaviortree_cpp_v3/behavior_tree.h"
24 #include "behaviortree_cpp_v3/bt_factory.h"
25 #include "behaviortree_cpp_v3/xml_parsing.h"
26 #include "behaviortree_cpp_v3/loggers/bt_zmq_publisher.h"
28 #include "rclcpp/rclcpp.hpp"
30 namespace nav2_behavior_tree
37 enum class BtStatus { SUCCEEDED, FAILED, CANCELED };
51 const std::vector<std::string> & plugin_libraries);
64 std::function<
void()> onLoop,
65 std::function<
bool()> cancelRequested,
66 std::chrono::milliseconds loopTimeout = std::chrono::milliseconds(10));
75 const std::string & xml_string,
76 BT::Blackboard::Ptr blackboard);
85 const std::string & file_path,
86 BT::Blackboard::Ptr blackboard);
96 BT::BehaviorTreeFactory factory_;
A class to create and handle behavior trees.
BehaviorTreeEngine(const std::vector< std::string > &plugin_libraries)
A constructor for nav2_behavior_tree::BehaviorTreeEngine.
BT::Tree createTreeFromFile(const std::string &file_path, BT::Blackboard::Ptr blackboard)
Function to create a BT from an XML file.
void haltAllActions(BT::TreeNode *root_node)
Function to explicitly reset all BT nodes to initial state.
BT::Tree createTreeFromText(const std::string &xml_string, BT::Blackboard::Ptr blackboard)
Function to create a BT from a XML string.
BtStatus run(BT::Tree *tree, std::function< void()> onLoop, std::function< bool()> cancelRequested, std::chrono::milliseconds loopTimeout=std::chrono::milliseconds(10))
Function to execute a BT at a specific rate.