Nav2 Navigation Stack - kilted
kilted
ROS 2 Navigation Stack
|
A class to create and handle behavior trees. More...
#include <nav2_behavior_tree/include/nav2_behavior_tree/behavior_tree_engine.hpp>
Public Member Functions | |
BehaviorTreeEngine (const std::vector< std::string > &plugin_libraries, rclcpp::Node::SharedPtr node) | |
A constructor for nav2_behavior_tree::BehaviorTreeEngine. More... | |
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. More... | |
BT::Tree | createTreeFromText (const std::string &xml_string, BT::Blackboard::Ptr blackboard) |
Function to create a BT from a XML string. More... | |
BT::Tree | createTreeFromFile (const std::string &file_path, BT::Blackboard::Ptr blackboard) |
Function to create a BT from an XML file. More... | |
void | addGrootMonitoring (BT::Tree *tree, uint16_t server_port) |
Add Groot2 monitor to publish BT status changes. More... | |
void | resetGrootMonitor () |
Reset groot monitor. | |
void | haltAllActions (BT::Tree &tree) |
Function to explicitly reset all BT nodes to initial state. More... | |
Protected Attributes | |
BT::BehaviorTreeFactory | factory_ |
rclcpp::Clock::SharedPtr | clock_ |
std::unique_ptr< BT::Groot2Publisher > | groot_monitor_ |
A class to create and handle behavior trees.
Definition at line 43 of file behavior_tree_engine.hpp.
|
explicit |
A constructor for nav2_behavior_tree::BehaviorTreeEngine.
plugin_libraries | vector of BT plugin library names to load |
Definition at line 31 of file behavior_tree_engine.cpp.
void nav2_behavior_tree::BehaviorTreeEngine::addGrootMonitoring | ( | BT::Tree * | tree, |
uint16_t | server_port | ||
) |
Add Groot2 monitor to publish BT status changes.
tree | BT to monitor |
server_port | Groot2 Server port, first of the pair (server_port, publisher_port) |
Definition at line 105 of file behavior_tree_engine.cpp.
BT::Tree nav2_behavior_tree::BehaviorTreeEngine::createTreeFromFile | ( | const std::string & | file_path, |
BT::Blackboard::Ptr | blackboard | ||
) |
Function to create a BT from an XML file.
file_path | Path to BT XML file |
blackboard | Blackboard for BT |
Definition at line 97 of file behavior_tree_engine.cpp.
BT::Tree nav2_behavior_tree::BehaviorTreeEngine::createTreeFromText | ( | const std::string & | xml_string, |
BT::Blackboard::Ptr | blackboard | ||
) |
Function to create a BT from a XML string.
xml_string | XML string representing BT |
blackboard | Blackboard for BT |
Definition at line 89 of file behavior_tree_engine.cpp.
void nav2_behavior_tree::BehaviorTreeEngine::haltAllActions | ( | BT::Tree & | tree | ) |
Function to explicitly reset all BT nodes to initial state.
tree | Tree to halt |
Definition at line 127 of file behavior_tree_engine.cpp.
BtStatus nav2_behavior_tree::BehaviorTreeEngine::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.
tree | BT to execute |
onLoop | Function to execute on each iteration of BT execution |
cancelRequested | Function to check if cancel was requested during BT execution |
loopTimeout | Time period for each iteration of BT execution |
Definition at line 49 of file behavior_tree_engine.cpp.