2
3
4
5
6
7
8
9
10
11
12
14#ifndef BEHAVIORTREECORE_ACTIONNODE_H
15#define BEHAVIORTREECORE_ACTIONNODE_H
30
31
32
33
37 ActionNodeBase(
const std::string& name,
const NodeConfig& config);
38 ~ActionNodeBase()
override =
default;
45 virtual NodeType type()
const override final
52
53
54
55
59 SyncActionNode(
const std::string& name,
const NodeConfig& config);
60 ~SyncActionNode()
override =
default;
71 virtual void halt()
override final
78
79
80
81
82
83
84
85
86
87
94 SimpleActionNode(
const std::string& name, TickFunctor tick_functor,
97 ~SimpleActionNode()
override =
default;
107 TickFunctor tick_functor_;
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
133 ThreadedAction(
const std::string& name,
const NodeConfig& config)
137 bool isHaltRequested()
const
139 return halt_requested_.load();
145 virtual void halt()
override;
148 std::exception_ptr exptr_;
149 std::atomic_bool halt_requested_ =
false;
150 std::future<
void> thread_handle_;
154#ifdef USE_BTCPP3_OLD_NAMES
159
160
161
162
163
164
165
166
167
168
169
170
171
172
176 StatefulActionNode(
const std::string& name,
const NodeConfig& config)
191 bool isHaltRequested()
const;
197 void halt()
override final;
200 std::atomic_bool halt_requested_ =
false;
204
205
206
207
208
209
213 CoroActionNode(
const std::string& name,
const NodeConfig& config);
214 ~CoroActionNode()
override;
231
232
233
234
235
236
237
238
239
240
241 void halt()
override;
245 std::unique_ptr<Pimpl> _p;
247 void destroyCoroutine();
The ActionNodeBase is the base class to use to create any kind of action. A particular derived class ...
Definition: action_node.h:35
The CoroActionNode class is an a good candidate for asynchronous actions which need to communicate wi...
Definition: action_node.h:211
void setStatusRunningAndYield()
Use this method to return RUNNING and temporary "pause" the Action.
virtual NodeStatus executeTick() override final
The method that should be used to invoke tick() and setStatus();.
Definition: leaf_node.h:22
The SimpleActionNode provides an easy to use SyncActionNode. The user should simply provide a callbac...
Definition: action_node.h:89
virtual NodeStatus tick() override final
Method to be implemented by the user.
The StatefulActionNode is the preferred way to implement asynchronous Actions. It is actually easier ...
Definition: action_node.h:174
virtual NodeStatus onRunning()=0
method invoked when the action is already in the RUNNING state.
void halt() override final
virtual void onHalted()=0
NodeStatus tick() override final
Method to be implemented by the user.
virtual NodeStatus onStart()=0
The SyncActionNode is an ActionNode that explicitly prevents the status RUNNING and doesn't require a...
Definition: action_node.h:57
virtual void halt() override final
You don't need to override this.
Definition: action_node.h:71
virtual NodeStatus executeTick() override
throws if the derived class return RUNNING.
The ThreadedAction executes the tick in a different thread.
Definition: action_node.h:131
virtual NodeStatus executeTick() override final
The method that should be used to invoke tick() and setStatus();.
virtual void halt() override
Abstract base class for Behavior Tree Nodes.
Definition: tree_node.h:154
void resetStatus()
Set the status to IDLE.
Definition: action_node.h:24
NodeStatus
Definition: basic_types.h:34
NodeType
Enumerates the possible types of nodes.
Definition: basic_types.h:21
Definition: tree_node.h:105