45 if (status != prev_status)
56 keep_thread_alive_(true),
101 catch (std::exception&)
103 std::cerr <<
"\nUncaught exception from the method tick() of an AsyncActionNode: [" 105 exptr_ = std::current_exception();
124 std::rethrow_exception(
exptr_);
154 _p->pending_destroy =
false;
173 if(
_p->pending_destroy &&
_p->coro != 0 )
177 _p->pending_destroy =
false;
190 if(
_p->pending_destroy ||
195 _p->pending_destroy =
false;
203 _p->pending_destroy =
true;
215 throw LogicError(
"SyncActionNode MUST never return RUNNING");
The ActionNodeBase is the base class to use to create any kind of action. A particular derived class ...
CoroActionNode(const std::string &name, const NodeConfiguration &config)
const std::string & name() const
Name of the instance, not the type.
const NodeConfiguration & config() const
virtual NodeStatus executeTick() overridefinal
The method that should be used to invoke tick() and setStatus();.
SimpleActionNode(const std::string &name, TickFunctor tick_functor, const NodeConfiguration &config)
std::atomic< bool > pending_destroy
void setStatusRunningAndYield()
Use this method to return RUNNING and temporary "pause" the Action.
routine_t create(std::function< void()> f)
void destroy(routine_t id)
SyncActionNode(const std::string &name, const NodeConfiguration &config)
The SyncActionNode is an ActionNode that explicitly prevents the status RUNNING and doesn't require a...
std::unique_ptr< Pimpl > _p
std::atomic< bool > keep_thread_alive_
coroutine::routine_t coro
virtual NodeStatus executeTick() overridefinal
The method that should be used to invoke tick() and setStatus();.
std::function< NodeStatus(TreeNode &)> TickFunctor
virtual NodeStatus executeTick() override
throws if the derived class return RUNNING.
NodeStatus status() const
virtual ~CoroActionNode() override
std::condition_variable start_signal_
ResumeResult resume(routine_t id)
ActionNodeBase(const std::string &name, const NodeConfiguration &config)
std::exception_ptr exptr_
virtual NodeStatus tick() overridefinal
Method to be implemented by the user.
TickFunctor tick_functor_
virtual BT::NodeStatus executeTick()
The method that should be used to invoke tick() and setStatus();.
AsyncActionNode(const std::string &name, const NodeConfiguration &config)
const std::string & registrationName() const
registrationName is the ID used by BehaviorTreeFactory to create an instance.
virtual BT::NodeStatus tick()=0
Method to be implemented by the user.
void setStatus(NodeStatus new_status)
virtual ~AsyncActionNode() override