delay_node.h
Go to the documentation of this file.
1 #pragma once
2 
4 #include <atomic>
5 #include "timer_queue.h"
6 
7 namespace BT
8 {
22 class DelayNode : public DecoratorNode
23 {
24 public:
25  DelayNode(const std::string& name, unsigned milliseconds);
26 
27  DelayNode(const std::string& name, const NodeConfiguration& config);
28 
29  ~DelayNode() override
30  {
31  halt();
32  }
33 
35  {
36  return {InputPort<unsigned>("delay_msec", "Tick the child after a few milliseconds")};
37  }
38  void halt() override
39  {
40  delay_started_ = false;
41  timer_.cancelAll();
43  }
44 
45 private:
47  uint64_t timer_id_;
48 
49  virtual BT::NodeStatus tick() override;
50 
54  unsigned msec_;
57 };
58 
59 } // namespace BT
bool read_parameter_from_ports_
Definition: delay_node.h:55
DelayNode(const std::string &name, unsigned milliseconds)
Definition: delay_node.cpp:8
virtual BT::NodeStatus tick() override
Method to be implemented by the user.
Definition: delay_node.cpp:26
const NodeConfiguration & config() const
Definition: tree_node.cpp:127
void halt() override
The method used to interrupt the execution of this node.
Definition: delay_node.h:38
TimerQueue timer_
Definition: delay_node.h:46
bool delay_complete_
Definition: delay_node.h:52
static PortsList providedPorts()
Definition: delay_node.h:34
static pthread_mutex_t mutex
Definition: minitrace.cpp:61
virtual void halt() override
The method used to interrupt the execution of this node.
bool delay_aborted_
Definition: delay_node.h:53
const std::string & name() const
Name of the instance, not the type.
Definition: tree_node.cpp:101
bool delay_started_
Definition: delay_node.h:51
unsigned msec_
Definition: delay_node.h:54
size_t cancelAll()
Cancels all timers.
Definition: timer_queue.h:145
std::unordered_map< std::string, PortInfo > PortsList
Definition: basic_types.h:333
The delay node will introduce a delay and then tick the child returning the status of the child as it...
Definition: delay_node.h:22
~DelayNode() override
Definition: delay_node.h:29
std::mutex delay_mutex_
Definition: delay_node.h:56
NodeStatus
Definition: basic_types.h:35
uint64_t timer_id_
Definition: delay_node.h:47


behaviortree_cpp_v3
Author(s): Michele Colledanchise, Davide Faconti
autogenerated on Mon Jul 3 2023 02:50:14