19 #include "nav2_behavior_tree/plugins/control/nonblocking_sequence.hpp"
21 namespace nav2_behavior_tree
25 : BT::ControlNode(name, {})
30 const std::string & name,
31 const BT::NodeConfiguration & conf)
32 : BT::ControlNode(name, conf)
38 bool all_success =
true;
40 for (std::size_t i = 0; i < children_nodes_.size(); ++i) {
41 auto status = children_nodes_[i]->executeTick();
43 case BT::NodeStatus::FAILURE:
44 ControlNode::haltChildren();
47 case BT::NodeStatus::SUCCESS:
49 case BT::NodeStatus::RUNNING:
53 std::stringstream error_msg;
54 error_msg <<
"Invalid node status. Received status " << status <<
55 "from child " << children_nodes_[i]->name();
56 throw std::runtime_error(error_msg.str());
62 ControlNode::haltChildren();
63 return BT::NodeStatus::SUCCESS;
66 return BT::NodeStatus::RUNNING;
71 BT_REGISTER_NODES(factory)
Type of sequence node that keeps tickinng through all the children until all children return SUCCESS.
NonblockingSequence(const std::string &name)
A constructor for nav2_behavior_tree::NonblockingSequence.
BT::NodeStatus tick() override
The main override required by a BT action.