action_test_node.h
Go to the documentation of this file.
1 #ifndef ACTIONTEST_H
2 #define ACTIONTEST_H
3 
5 
6 namespace BT
7 {
9 {
10  public:
11  SyncActionTest(const std::string& name);
12 
13  BT::NodeStatus tick() override;
14 
15  void setExpectedResult(NodeStatus res);
16 
17  int tickCount() const
18  {
19  return tick_count_;
20  }
21 
22  void resetTicks()
23  {
24  tick_count_ = 0;
25  }
26 
27  private:
30 };
31 
33 {
34  public:
35  AsyncActionTest(const std::string& name, BT::Duration deadline_ms = std::chrono::milliseconds(100) );
36 
37  virtual ~AsyncActionTest()
38  {
39  halt();
40  }
41 
42  // The method that is going to be executed by the thread
43  BT::NodeStatus tick() override;
44 
45  void setTime(BT::Duration time);
46 
47  // The method used to interrupt the execution of the node
48  virtual void halt() override;
49 
50  void setExpectedResult(NodeStatus res);
51 
52  int tickCount() const {
53  return tick_count_;
54  }
55 
56  int successCount() const {
57  return success_count_;
58  }
59 
60  int failureCount() const {
61  return failure_count_;
62  }
63 
64  void resetCounters() {
65  success_count_ = 0;
66  failure_count_ = 0;
67  tick_count_ = 0;
68  }
69 
70  private:
71  // using atomic because these variables might be accessed from different threads
73  std::atomic<NodeStatus> expected_result_;
74  std::atomic<int> tick_count_;
77 
78 };
79 }
80 
81 #endif
SyncActionTest(const std::string &name)
const std::string & name() const
Name of the instance, not the type.
Definition: tree_node.cpp:73
int successCount() const
int failureCount() const
The AsyncActionNode uses a different thread, where the action will be executed.
Definition: action_node.h:115
void setExpectedResult(NodeStatus res)
The SyncActionNode is an ActionNode that explicitly prevents the status RUNNING and doesn&#39;t require a...
Definition: action_node.h:53
std::atomic< int > tick_count_
virtual void halt() overridefinal
You don&#39;t need to override this.
Definition: action_node.h:64
BT::NodeStatus tick() override
Method to be implemented by the user.
NodeStatus expected_result_
int tickCount() const
NodeStatus
Definition: basic_types.h:35
std::atomic< NodeStatus > expected_result_
int tickCount() const
std::chrono::high_resolution_clock::duration Duration
Definition: basic_types.h:340


behaviotree_cpp_v3
Author(s): Michele Colledanchise, Davide Faconti
autogenerated on Tue May 4 2021 02:56:24