Skip to content
Open
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: 8 additions & 0 deletions include/behaviortree_cpp/bt_factory.h
Original file line number Diff line number Diff line change
Expand Up @@ -137,6 +137,14 @@ class Tree
*/
void emitWakeUpSignal();

/**
* @brief Returns the shared WakeUpSignal used by this tree.
* This can be used to check for preemption externally, e.g. when
* implementing custom sleep logic with a different clock source.
* Returns nullptr if the tree has not been initialized yet.
*/
[[nodiscard]] std::shared_ptr<WakeUpSignal> wakeUpSignal() const;

~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 @@ -664,6 +664,11 @@ void Tree::emitWakeUpSignal()
wake_up_->emitSignal();
}

std::shared_ptr<WakeUpSignal> Tree::wakeUpSignal() const
{
return wake_up_;
}

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