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 () |
Tree & | operator= (const Tree &)=delete |
Tree & | operator= (Tree &&other) |
Blackboard::Ptr | rootBlackboard () |
TreeNode * | rootNode () const |
bool | sleep (std::chrono::system_clock::duration timeout) |
Sleep for a certain amount of time. This sleep could be interrupted by the method TreeNode::emitWakeUpSignal() More... | |
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, TreeNodeManifest > | manifests |
std::vector< Subtree::Ptr > | subtrees |
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< WakeUpSignal > | wake_up_ |
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.
|
private |
Enumerator | |
---|---|
EXACTLY_ONCE | |
ONCE_UNLESS_WOKEN_UP | |
WHILE_RUNNING |
Definition at line 188 of file bt_factory.h.
BT::Tree::Tree | ( | ) |
Definition at line 542 of file bt_factory.cpp.
|
delete |
BT::Tree::Tree | ( | Tree && | other | ) |
Definition at line 545 of file bt_factory.cpp.
BT::Tree::~Tree | ( | ) |
Definition at line 595 of file bt_factory.cpp.
void BT::Tree::applyVisitor | ( | const std::function< void(const TreeNode *)> & | visitor | ) |
Definition at line 624 of file bt_factory.cpp.
void BT::Tree::applyVisitor | ( | const std::function< void(TreeNode *)> & | visitor | ) |
Definition at line 629 of file bt_factory.cpp.
|
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 166 of file bt_factory.h.
uint16_t BT::Tree::getUID | ( | ) |
Definition at line 634 of file bt_factory.cpp.
void BT::Tree::haltTree | ( | ) |
Definition at line 562 of file bt_factory.cpp.
void BT::Tree::initialize | ( | ) |
Definition at line 550 of file bt_factory.cpp.
Definition at line 534 of file bt_factory.cpp.
Blackboard::Ptr BT::Tree::rootBlackboard | ( | ) |
Definition at line 615 of file bt_factory.cpp.
TreeNode * BT::Tree::rootNode | ( | ) | const |
Definition at line 579 of file bt_factory.cpp.
bool 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()
timeout | duration of the sleep |
Definition at line 589 of file bt_factory.cpp.
NodeStatus BT::Tree::tickExactlyOnce | ( | ) |
Tick the root of the tree once, even if a node invoked emitWakeUpSignal()
Definition at line 600 of file bt_factory.cpp.
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 605 of file bt_factory.cpp.
|
private |
Definition at line 640 of file bt_factory.cpp.
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 610 of file bt_factory.cpp.
std::unordered_map<std::string, TreeNodeManifest> BT::Tree::manifests |
Definition at line 105 of file bt_factory.h.
std::vector<Subtree::Ptr> BT::Tree::subtrees |
Definition at line 104 of file bt_factory.h.
|
private |
Definition at line 197 of file bt_factory.h.
|
private |
Definition at line 186 of file bt_factory.h.