|
BehaviorTree
Core Library to create and execute Behavior Trees
|
The SqliteLogger is a logger that will store the tree and all the status transitions in a SQLite database (single file). More...
#include <bt_sqlite_logger.h>


Public Types | |
| using | ExtraCallback = std::function< std::string(Duration, const TreeNode &, NodeStatus, NodeStatus)> |
Public Member Functions | |
| SqliteLogger (const Tree &tree, std::filesystem::path const &file, bool append=false) | |
| To correctly read this log with Groot2, you must use the suffix ".db3". Constructor will throw otherwise. | |
| SqliteLogger (const SqliteLogger &)=delete | |
| SqliteLogger & | operator= (const SqliteLogger &)=delete |
| SqliteLogger (SqliteLogger &&)=delete | |
| SqliteLogger & | operator= (SqliteLogger &&)=delete |
| void | setAdditionalCallback (ExtraCallback func) |
| virtual void | callback (Duration timestamp, const TreeNode &node, NodeStatus prev_status, NodeStatus status) override |
| void | execSqlStatement (std::string statement) |
| virtual void | flush () override |
Public Member Functions inherited from BT::StatusChangeLogger | |
| StatusChangeLogger (TreeNode *root_node) | |
| Construct and immediately subscribe to status changes. | |
| StatusChangeLogger (const StatusChangeLogger &other)=delete | |
| StatusChangeLogger & | operator= (const StatusChangeLogger &other)=delete |
| StatusChangeLogger (StatusChangeLogger &&other)=delete | |
| StatusChangeLogger & | operator= (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. | |
The SqliteLogger is a logger that will store the tree and all the status transitions in a SQLite database (single file).
SQL schema
CREATE TABLE IF NOT EXISTS Definitions ( session_id INTEGER PRIMARY KEY AUTOINCREMENT, date TEXT NOT NULL, xml_tree TEXT NOT NULL);
CREATE TABLE IF NOT EXISTS Nodes (" session_id INTEGER NOT NULL, fullpath VARCHAR, " node_uid INTEGER NOT NULL );
CREATE TABLE IF NOT EXISTS Transitions ( timestamp INTEGER PRIMARY KEY NOT NULL, session_id INTEGER NOT NULL, node_uid INTEGER NOT NULL, duration INTEGER, state INTEGER NOT NULL, extra_data VARCHAR );
You can append data to the same file; this allows you to store multiple experiments into the database. Yn that case, each recording has a unique session_id.
This is primarily meant to be used with Groot2, but the content of the tables is sufficiently self-explaining, and you can create your own tools to extract the information.
| BT::SqliteLogger::SqliteLogger | ( | const Tree & | tree, |
| std::filesystem::path const & | file, | ||
| bool | append = false |
||
| ) |
To correctly read this log with Groot2, you must use the suffix ".db3". Constructor will throw otherwise.
| tree | the tree to log |
| filepath | path of the file where info will be stored |
| append | if true, add this recording to the database |
|
overridevirtual |
Implements BT::StatusChangeLogger.
|
overridevirtual |
Implements BT::StatusChangeLogger.