BehaviorTree
Core Library to create and execute Behavior Trees
Loading...
Searching...
No Matches
BT::TreeObserver Class Reference

The TreeObserver is used to collect statistics about which nodes are executed and their returned status. More...

#include <bt_observer.h>

Inheritance diagram for BT::TreeObserver:
Collaboration diagram for BT::TreeObserver:

Classes

struct  NodeStatistics
 

Public Member Functions

 TreeObserver (const BT::Tree &tree)
 
 TreeObserver (const TreeObserver &)=delete
 
TreeObserveroperator= (const TreeObserver &)=delete
 
 TreeObserver (TreeObserver &&)=delete
 
TreeObserveroperator= (TreeObserver &&)=delete
 
virtual void flush () override
 
void resetStatistics ()
 
const NodeStatisticsgetStatistics (const std::string &path) const
 
const NodeStatisticsgetStatistics (uint16_t uid) const
 
const std::unordered_map< uint16_t, NodeStatistics > & statistics () const
 
const std::unordered_map< std::string, uint16_t > & pathToUID () const
 
const std::map< uint16_t, std::string > & uidToPath () const
 
- Public Member Functions inherited from BT::StatusChangeLogger
 StatusChangeLogger (TreeNode *root_node)
 Construct and immediately subscribe to status changes.
 
 StatusChangeLogger (const StatusChangeLogger &other)=delete
 
StatusChangeLoggeroperator= (const StatusChangeLogger &other)=delete
 
 StatusChangeLogger (StatusChangeLogger &&other)=delete
 
StatusChangeLoggeroperator= (StatusChangeLogger &&other)=delete
 
virtual void callback (BT::Duration timestamp, const TreeNode &node, NodeStatus prev_status, NodeStatus status)=0
 
virtual void flush ()=0
 
void setEnabled (bool enabled)
 
void setTimestampType (TimestampType type)
 
bool enabled () const
 
bool showsTransitionToIdle () const
 
void enableTransitionToIdle (bool enable)
 

Additional Inherited Members

- Protected Member Functions inherited from BT::StatusChangeLogger
 StatusChangeLogger ()=default
 Default constructor for deferred subscription. Call subscribeToTreeChanges() when ready.
 
void subscribeToTreeChanges (TreeNode *root_node)
 Subscribe to status changes. Call at end of constructor for deferred subscription.
 

Detailed Description

The TreeObserver is used to collect statistics about which nodes are executed and their returned status.

It is particularly useful to create unit tests, since if allow to determine if a certain transition happened as expected, in a non intrusive way.

Member Function Documentation

◆ flush()

virtual void BT::TreeObserver::flush ( )
inlineoverridevirtual

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