19 #include "nav2_util/geometry_utils.hpp"
21 #include "nav2_behavior_tree/plugins/action/get_next_few_goals_action.hpp"
23 namespace nav2_behavior_tree
26 GetNextFewGoals::GetNextFewGoals(
27 const std::string & name,
28 const BT::NodeConfiguration & conf)
29 : BT::ActionNodeBase(name, conf)
33 inline BT::NodeStatus GetNextFewGoals::tick()
35 setStatus(BT::NodeStatus::RUNNING);
37 nav_msgs::msg::Goals input_goals, output_goals;
38 unsigned int num_goals;
39 getInput(
"input_goals", input_goals);
40 getInput(
"num_goals", num_goals);
42 if (input_goals.goals.empty()) {
43 return BT::NodeStatus::FAILURE;
46 output_goals.header = input_goals.header;
47 for (
unsigned int i = 0; i < num_goals && i < input_goals.goals.size(); ++i) {
48 output_goals.goals.push_back(input_goals.goals[i]);
50 setOutput(
"output_goals", output_goals);
51 return BT::NodeStatus::SUCCESS;
56 #include "behaviortree_cpp/bt_factory.h"
57 BT_REGISTER_NODES(factory)