Class BehaviorTreeManager

Class Documentation

class BehaviorTreeManager

Class responsible for managing behavior trees.

Public Functions

inline BehaviorTreeManager(const std::string &tree_name, const std::map<std::string, std::any> &initial_blackboard, const unsigned groot_port = 1667)

Constructor for the BehaviorTreeManager class.

Parameters:
  • tree_name – The name of the tree in the BehaviorTree project.

  • initial_blackboard – A list with initial blackboard values for the tree.

  • groot_port – The port used for the Groot2 publisher.

inline ~BehaviorTreeManager()
inline void Initialize(BT::BehaviorTreeFactory &factory)

Creates a BehaviorTree configuration, initializes the tree, and starts the Groot2 publisher.

Parameters:

factory – The factory object used to create the tree.

inline void TickOnce()
inline void TickExactlyOnce()
inline void TickWhileRunning()
inline void HaltTree()
inline BT::NodeStatus GetTreeStatus() const
inline BT::Tree &GetTree()
inline BT::Blackboard::Ptr GetBlackboard() const

Protected Functions

inline BT::NodeConfig CreateBTConfig(const std::map<std::string, std::any> &bb_values) const

Creates a BehaviorTree configuration using a set of predefined blackboard values.

Parameters:

bb_values – A map containing the names of the blackboard entries and their initial values. This map can include different entry types. Supported types are: bool, int, unsigned, float, double, const char*, and string.

Throws:

std::invalid_argument – thrown when the bb_values map contains an invalid blackboard entry type.

Returns:

A BehaviorTree configuration object.