Classes | Public Member Functions | Public Attributes | Private Types | Private Member Functions | Private Attributes | List of all members
BT::Tree Class Reference

Struct used to store a tree. If this object goes out of scope, the tree is destroyed. More...

#include <bt_factory.h>

Classes

struct  Subtree
 

Public Member Functions

void applyVisitor (const std::function< void(const TreeNode *)> &visitor)
 
void applyVisitor (const std::function< void(TreeNode *)> &visitor)
 
template<typename NodeType = BT::TreeNode>
std::vector< const TreeNode * > getNodesByPath (StringView wildcard_filter) const
 
uint16_t getUID ()
 
void haltTree ()
 
void initialize ()
 
Treeoperator= (const Tree &)=delete
 
Treeoperator= (Tree &&other)
 
Blackboard::Ptr rootBlackboard ()
 
TreeNoderootNode () const
 
void sleep (std::chrono::system_clock::duration timeout)
 
NodeStatus tickExactlyOnce ()
 
NodeStatus tickOnce ()
 by default, tickOnce() sends a single tick, BUT as long as there is at least one node of the tree invoking TreeNode::emitWakeUpSignal(), it will be ticked again. More...
 
NodeStatus tickWhileRunning (std::chrono::milliseconds sleep_time=std::chrono::milliseconds(10))
 
 Tree ()
 
 Tree (const Tree &)=delete
 
 Tree (Tree &&other)
 
 ~Tree ()
 

Public Attributes

std::unordered_map< std::string, TreeNodeManifestmanifests
 
std::vector< Subtree::Ptrsubtrees
 

Private Types

enum  TickOption { EXACTLY_ONCE, ONCE_UNLESS_WOKEN_UP, WHILE_RUNNING }
 

Private Member Functions

NodeStatus tickRoot (TickOption opt, std::chrono::milliseconds sleep_time)
 

Private Attributes

uint16_t uid_counter_ = 0
 
std::shared_ptr< WakeUpSignalwake_up_
 

Detailed Description

Struct used to store a tree. If this object goes out of scope, the tree is destroyed.

Definition at line 91 of file bt_factory.h.

Member Enumeration Documentation

◆ TickOption

enum BT::Tree::TickOption
private
Enumerator
EXACTLY_ONCE 
ONCE_UNLESS_WOKEN_UP 
WHILE_RUNNING 

Definition at line 184 of file bt_factory.h.

Constructor & Destructor Documentation

◆ Tree() [1/3]

BT::Tree::Tree ( )

Definition at line 542 of file bt_factory.cpp.

◆ Tree() [2/3]

BT::Tree::Tree ( const Tree )
delete

◆ Tree() [3/3]

BT::Tree::Tree ( Tree &&  other)

Definition at line 545 of file bt_factory.cpp.

◆ ~Tree()

BT::Tree::~Tree ( )

Definition at line 594 of file bt_factory.cpp.

Member Function Documentation

◆ applyVisitor() [1/2]

void BT::Tree::applyVisitor ( const std::function< void(const TreeNode *)> &  visitor)

Definition at line 623 of file bt_factory.cpp.

◆ applyVisitor() [2/2]

void BT::Tree::applyVisitor ( const std::function< void(TreeNode *)> &  visitor)

Definition at line 628 of file bt_factory.cpp.

◆ getNodesByPath()

template<typename NodeType = BT::TreeNode>
std::vector<const TreeNode*> BT::Tree::getNodesByPath ( StringView  wildcard_filter) const
inline

Get a list of nodes which fullPath() match a wildcard filter and a given path. Example:

move_nodes = tree.getNodesByPath<MoveBaseNode>("move_*");

Definition at line 162 of file bt_factory.h.

◆ getUID()

uint16_t BT::Tree::getUID ( )

Definition at line 633 of file bt_factory.cpp.

◆ haltTree()

void BT::Tree::haltTree ( )

Definition at line 562 of file bt_factory.cpp.

◆ initialize()

void BT::Tree::initialize ( )

Definition at line 550 of file bt_factory.cpp.

◆ operator=() [1/2]

Tree& BT::Tree::operator= ( const Tree )
delete

◆ operator=() [2/2]

Tree & BT::Tree::operator= ( Tree &&  other)

Definition at line 534 of file bt_factory.cpp.

◆ rootBlackboard()

Blackboard::Ptr BT::Tree::rootBlackboard ( )

Definition at line 614 of file bt_factory.cpp.

◆ rootNode()

TreeNode * BT::Tree::rootNode ( ) const

Definition at line 579 of file bt_factory.cpp.

◆ sleep()

void BT::Tree::sleep ( std::chrono::system_clock::duration  timeout)

Sleep for a certain amount of time. This sleep could be interrupted by the method TreeNode::emitWakeUpSignal()

Definition at line 589 of file bt_factory.cpp.

◆ tickExactlyOnce()

NodeStatus BT::Tree::tickExactlyOnce ( )

Tick the root of the tree once, even if a node invoked emitWakeUpSignal()

Definition at line 599 of file bt_factory.cpp.

◆ tickOnce()

NodeStatus BT::Tree::tickOnce ( )

by default, tickOnce() sends a single tick, BUT as long as there is at least one node of the tree invoking TreeNode::emitWakeUpSignal(), it will be ticked again.

Definition at line 604 of file bt_factory.cpp.

◆ tickRoot()

NodeStatus BT::Tree::tickRoot ( TickOption  opt,
std::chrono::milliseconds  sleep_time 
)
private

Definition at line 639 of file bt_factory.cpp.

◆ tickWhileRunning()

NodeStatus BT::Tree::tickWhileRunning ( std::chrono::milliseconds  sleep_time = std::chrono::milliseconds(10))

Call tickOnce until the status is different from RUNNING. Note that between one tick and the following one, a Tree::sleep() is used

Definition at line 609 of file bt_factory.cpp.

Member Data Documentation

◆ manifests

std::unordered_map<std::string, TreeNodeManifest> BT::Tree::manifests

Definition at line 105 of file bt_factory.h.

◆ subtrees

std::vector<Subtree::Ptr> BT::Tree::subtrees

Definition at line 104 of file bt_factory.h.

◆ uid_counter_

uint16_t BT::Tree::uid_counter_ = 0
private

Definition at line 193 of file bt_factory.h.

◆ wake_up_

std::shared_ptr<WakeUpSignal> BT::Tree::wake_up_
private

Definition at line 182 of file bt_factory.h.


The documentation for this class was generated from the following files:


behaviortree_cpp_v4
Author(s): Davide Faconti
autogenerated on Fri Jun 28 2024 02:20:09