diff --git a/examples/t11_groot_howto.cpp b/examples/t11_groot_howto.cpp index da974947c..14713cbac 100644 --- a/examples/t11_groot_howto.cpp +++ b/examples/t11_groot_howto.cpp @@ -120,7 +120,7 @@ int main() // Both formats are compatible with Groot2 // Logging with lightweight serialization - BT::FileLogger2 logger2(tree, "t12_logger2.btlog"); + BT::FileLogger2 logger2(tree, "t11_groot_howto.btlog"); BT::MinitraceLogger minilog(tree, "minitrace.json"); while(1) diff --git a/include/behaviortree_cpp/bt_factory.h b/include/behaviortree_cpp/bt_factory.h index ed0cdac76..0b00c7164 100644 --- a/include/behaviortree_cpp/bt_factory.h +++ b/include/behaviortree_cpp/bt_factory.h @@ -118,10 +118,14 @@ class Tree [[nodiscard]] TreeNode* rootNode() const; - /// Sleep for a certain amount of time. - /// This sleep could be interrupted by the method - /// TreeNode::emitWakeUpSignal() - void sleep(std::chrono::system_clock::duration timeout); + /** + * @brief Sleep for a certain amount of time. This sleep could be interrupted by the method TreeNode::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); ~Tree(); diff --git a/src/bt_factory.cpp b/src/bt_factory.cpp index 2533b6033..87bdd1916 100644 --- a/src/bt_factory.cpp +++ b/src/bt_factory.cpp @@ -633,9 +633,10 @@ TreeNode* Tree::rootNode() const return subtree_nodes.empty() ? nullptr : subtree_nodes.front().get(); } -void Tree::sleep(std::chrono::system_clock::duration timeout) +bool Tree::sleep(std::chrono::system_clock::duration timeout) { - wake_up_->waitFor(std::chrono::duration_cast(timeout)); + return wake_up_->waitFor( + std::chrono::duration_cast(timeout)); } Tree::~Tree()