15 #include "nav2_behavior_tree/plugins/action/concatenate_paths_action.hpp"
17 namespace nav2_behavior_tree
21 const std::string & name,
22 const BT::NodeConfiguration & conf)
23 : BT::ActionNodeBase(name, conf)
27 inline BT::NodeStatus ConcatenatePaths::tick()
29 setStatus(BT::NodeStatus::RUNNING);
31 nav_msgs::msg::Path input_path1, input_path2;
32 getInput(
"input_path1", input_path1);
33 getInput(
"input_path2", input_path2);
35 if (input_path1.poses.empty() && input_path2.poses.empty()) {
37 config().blackboard->get<rclcpp::Node::SharedPtr>(
"node")->get_logger(),
38 "No input paths provided to concatenate. Both paths are empty.");
39 return BT::NodeStatus::FAILURE;
42 nav_msgs::msg::Path output_path;
43 output_path = input_path1;
44 if (input_path1.header != std_msgs::msg::Header()) {
45 output_path.header = input_path1.header;
46 }
else if (input_path2.header != std_msgs::msg::Header()) {
47 output_path.header = input_path2.header;
50 output_path.poses.insert(
51 output_path.poses.end(),
52 input_path2.poses.begin(),
53 input_path2.poses.end());
55 setOutput(
"output_path", output_path);
56 return BT::NodeStatus::SUCCESS;
61 #include "behaviortree_cpp/bt_factory.h"
62 BT_REGISTER_NODES(factory)
A BT::ActionNodeBase to shorten path by some distance.
ConcatenatePaths(const std::string &xml_tag_name, const BT::NodeConfiguration &conf)
A nav2_behavior_tree::ConcatenatePaths constructor.