sleep_node.h
Go to the documentation of this file.
1 #pragma once
2 
5 #include <atomic>
6 
7 namespace BT
8 {
16 {
17 public:
18  SleepNode(const std::string& name, const NodeConfig& config);
19 
20  ~SleepNode() override
21  {
22  halt();
23  }
24 
25  NodeStatus onStart() override;
26 
27  NodeStatus onRunning() override;
28 
29  void onHalted() override;
30 
32  {
33  return { InputPort<unsigned>("msec") };
34  }
35 
36 private:
38  uint64_t timer_id_;
39 
40  std::atomic_bool timer_waiting_ = false;
42 };
43 
44 } // namespace BT
BT
Definition: ex01_wrap_legacy.cpp:29
BT::SleepNode::SleepNode
SleepNode(const std::string &name, const NodeConfig &config)
Definition: sleep_node.cpp:6
BT::TimerQueue
Definition: timer_queue.h:72
BT::SleepNode::onRunning
NodeStatus onRunning() override
method invoked when the action is already in the RUNNING state.
Definition: sleep_node.cpp:39
BT::TreeNode::config
const NodeConfig & config() const
Definition: tree_node.cpp:351
BT::SleepNode::~SleepNode
~SleepNode() override
Definition: sleep_node.h:20
BT::SleepNode::onStart
NodeStatus onStart() override
Definition: sleep_node.cpp:10
BT::SleepNode::onHalted
void onHalted() override
Definition: sleep_node.cpp:44
BT::SleepNode::timer_id_
uint64_t timer_id_
Definition: sleep_node.h:38
BT::SleepNode::providedPorts
static PortsList providedPorts()
Definition: sleep_node.h:31
timer_queue.h
mutex
static pthread_mutex_t mutex
Definition: minitrace.cpp:77
BT::PortsList
std::unordered_map< std::string, PortInfo > PortsList
Definition: basic_types.h:585
action_node.h
BT::TreeNode::name
const std::string & name() const
Name of the instance, not the type.
Definition: tree_node.cpp:302
BT::SleepNode::timer_waiting_
std::atomic_bool timer_waiting_
Definition: sleep_node.h:40
BT::SleepNode
Sleep for a certain amount of time. Consider also using the decorator <Delay>
Definition: sleep_node.h:15
BT::SleepNode::delay_mutex_
std::mutex delay_mutex_
Definition: sleep_node.h:41
BT::NodeConfig
Definition: tree_node.h:73
BT::SleepNode::timer_
TimerQueue timer_
Definition: sleep_node.h:37
BT::NodeStatus
NodeStatus
Definition: basic_types.h:33
BT::StatefulActionNode::halt
void halt() override final
Definition: action_node.cpp:179
BT::StatefulActionNode
The StatefulActionNode is the preferred way to implement asynchronous Actions. It is actually easier ...
Definition: action_node.h:159


behaviortree_cpp_v4
Author(s): Davide Faconti
autogenerated on Fri Dec 13 2024 03:19:17