Nav2 Navigation Stack - kilted  kilted
ROS 2 Navigation Stack
get_current_pose_action.hpp
1 // Copyright (c) 2025 Open Navigation LLC
2 //
3 // Licensed under the Apache License, Version 2.0 (the "License");
4 // you may not use this file except in compliance with the License.
5 // You may obtain a copy of the License at
6 //
7 // http://www.apache.org/licenses/LICENSE-2.0
8 //
9 // Unless required by applicable law or agreed to in writing, software
10 // distributed under the License is distributed on an "AS IS" BASIS,
11 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 // See the License for the specific language governing permissions and
13 // limitations under the License.
14 
15 #ifndef NAV2_BEHAVIOR_TREE__PLUGINS__ACTION__GET_CURRENT_POSE_ACTION_HPP_
16 #define NAV2_BEHAVIOR_TREE__PLUGINS__ACTION__GET_CURRENT_POSE_ACTION_HPP_
17 
18 #include <memory>
19 #include <vector>
20 #include <string>
21 
22 #include "nav_msgs/msg/path.hpp"
23 #include "geometry_msgs/msg/pose_stamped.hpp"
24 #include "nav2_util/geometry_utils.hpp"
25 #include "nav2_util/robot_utils.hpp"
26 #include "nav2_behavior_tree/bt_utils.hpp"
27 
28 #include "behaviortree_cpp/action_node.h"
29 
30 namespace nav2_behavior_tree
31 {
32 
36 class GetCurrentPoseAction : public BT::ActionNodeBase
37 {
38 public:
45  const std::string & xml_tag_name,
46  const BT::NodeConfiguration & conf);
47 
52  static BT::PortsList providedPorts()
53  {
54  return {
55  BT::InputPort<std::string>("global_frame", "Global reference frame"),
56  BT::InputPort<std::string>("robot_base_frame", "robot base frame"),
57  BT::OutputPort<geometry_msgs::msg::PoseStamped>("current_pose", "Current pose output"),
58  };
59  }
60 
61 private:
65  void halt() override {}
66 
71  BT::NodeStatus tick() override;
72 
73  std::string global_frame_, robot_base_frame_;
74  std::shared_ptr<tf2_ros::Buffer> tf_;
75  double transform_tolerance_;
76 };
77 
78 } // namespace nav2_behavior_tree
79 
80 #endif // NAV2_BEHAVIOR_TREE__PLUGINS__ACTION__GET_CURRENT_POSE_ACTION_HPP_
A BT::ActionNodeBase to shorten path by some distance.
static BT::PortsList providedPorts()
Creates list of BT ports.
GetCurrentPoseAction(const std::string &xml_tag_name, const BT::NodeConfiguration &conf)
A nav2_behavior_tree::GetCurrentPoseAction constructor.