Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 7 additions & 1 deletion include/behaviortree_cpp/bt_factory.h
Original file line number Diff line number Diff line change
Expand Up @@ -119,14 +119,20 @@ class Tree
[[nodiscard]] TreeNode* rootNode() const;

/**
* @brief Sleep for a certain amount of time. This sleep could be interrupted by the method TreeNode::emitWakeUpSignal()
* @brief Sleep for a certain amount of time. This sleep could be interrupted by the methods
* TreeNode::emitWakeUpSignal() or Tree::emitWakeUpSignal()
*
* @param timeout duration of the sleep
* @return true if the timeout was NOT reached and the signal was received.
*
* */
bool sleep(std::chrono::system_clock::duration timeout);

/**
* @brief Wake up the tree. This will interrupt the sleep() method.
*/
void emitWakeUpSignal();

~Tree();

/// Tick the root of the tree once, even if a node invoked
Expand Down
5 changes: 5 additions & 0 deletions src/bt_factory.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -519,6 +519,11 @@ bool Tree::sleep(std::chrono::system_clock::duration timeout)
std::chrono::duration_cast<std::chrono::milliseconds>(timeout));
}

void Tree::emitWakeUpSignal()
{
wake_up_->emitSignal();
}

Tree::~Tree()
{
haltTree();
Expand Down
Loading