1 #ifndef SIMPLE_BT_NODES_H 2 #define SIMPLE_BT_NODES_H 40 BT::SyncActionNode(name, {})
54 :
BT::SyncActionNode(name, config)
64 return{ BT::InputPort<std::string>(
"message") };
76 :
BT::StatefulActionNode(name, config)
82 return{ BT::InputPort<int>(
"msec") };
88 getInput(
"msec", msec);
92 return NodeStatus::SUCCESS;
97 deadline_ = system_clock::now() + milliseconds(msec);
98 return NodeStatus::RUNNING;
105 if ( std::chrono::system_clock::now() >= deadline_ )
107 return NodeStatus::SUCCESS;
110 return NodeStatus::RUNNING;
117 std::cout <<
"SleepNode interrupted" << std::endl;
139 #endif // SIMPLE_BT_NODES_H static BT::PortsList providedPorts()
std::chrono::system_clock::time_point deadline_
void registerNodeType(const std::string &ID)
static BT::PortsList providedPorts()
BT::NodeStatus SaySomethingSimple(BT::TreeNode &self)
NodeStatus onRunning() override
method invoked by an action in the RUNNING state.
BT::NodeStatus SayHello()
The ActionNode is the prefered way to implement asynchronous Actions. It is actually easier to use co...
void RegisterNodes(BT::BehaviorTreeFactory &factory)
The SyncActionNode is an ActionNode that explicitly prevents the status RUNNING and doesn't require a...
The BehaviorTreeFactory is used to create instances of a TreeNode at run-time.
NodeStatus onStart() override
ApproachObject(const std::string &name)
void registerSimpleAction(const std::string &ID, const SimpleActionNode::TickFunctor &tick_functor, PortsList ports={})
registerSimpleAction help you register nodes of type SimpleActionNode.
Abstract base class for Behavior Tree Nodes.
std::unordered_map< std::string, PortInfo > PortsList
SleepNode(const std::string &name, const BT::NodeConfiguration &config)
BT::NodeStatus CheckBattery()
BT::NodeStatus CheckTemperature()
void registerSimpleCondition(const std::string &ID, const SimpleConditionNode::TickFunctor &tick_functor, PortsList ports={})
registerSimpleCondition help you register nodes of type SimpleConditionNode.
SaySomething(const std::string &name, const BT::NodeConfiguration &config)