Nav2 Navigation Stack - lyrical  lyrical
ROS 2 Navigation Stack
pose_progress_checker.hpp
1 // Copyright (c) 2023 Dexory
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_CONTROLLER__PLUGINS__POSE_PROGRESS_CHECKER_HPP_
16 #define NAV2_CONTROLLER__PLUGINS__POSE_PROGRESS_CHECKER_HPP_
17 
18 #include <string>
19 #include <vector>
20 #include "rclcpp/rclcpp.hpp"
21 #include "nav2_controller/plugins/simple_progress_checker.hpp"
22 #include "nav2_ros_common/lifecycle_node.hpp"
23 
24 namespace nav2_controller
25 {
33 {
34 public:
38  PoseProgressChecker() = default;
39 
44 
50  void initialize(
51  const nav2::LifecycleNode::WeakPtr & parent,
52  const std::string & plugin_name) override;
53 
59  bool check(geometry_msgs::msg::PoseStamped & current_pose) override;
60 
61 protected:
67  bool isRobotMovedEnough(const geometry_msgs::msg::Pose & pose);
68 
75  static double poseAngleDistance(
76  const geometry_msgs::msg::Pose &,
77  const geometry_msgs::msg::Pose &);
78 
79  double required_movement_angle_;
80 
81  // Dynamic parameters handler
82  std::mutex mutex_;
83  rclcpp::node_interfaces::PostSetParametersCallbackHandle::SharedPtr post_set_params_handler_;
84  rclcpp::node_interfaces::OnSetParametersCallbackHandle::SharedPtr on_set_params_handler_;
85  std::string plugin_name_;
86  nav2::LifecycleNode::WeakPtr node_;
87  rclcpp::Logger logger_{rclcpp::get_logger("pose_progress_checker")};
88 
97  rcl_interfaces::msg::SetParametersResult validateParameterUpdatesCallback(
98  const std::vector<rclcpp::Parameter> & parameters);
99 
106  void updateParametersCallback(const std::vector<rclcpp::Parameter> & parameters);
107 };
108 } // namespace nav2_controller
109 
110 #endif // NAV2_CONTROLLER__PLUGINS__POSE_PROGRESS_CHECKER_HPP_
This plugin is used to check the position and the angle of the robot to make sure that it is actually...
PoseProgressChecker()=default
Construct a new Pose Progress Checker object.
static double poseAngleDistance(const geometry_msgs::msg::Pose &, const geometry_msgs::msg::Pose &)
Calculates angle difference between two poses.
rcl_interfaces::msg::SetParametersResult validateParameterUpdatesCallback(const std::vector< rclcpp::Parameter > &parameters)
Validate incoming parameter updates before applying them. This callback is triggered when one or more...
bool isRobotMovedEnough(const geometry_msgs::msg::Pose &pose)
Calculates robots movement from baseline pose.
~PoseProgressChecker()
Destroy the Pose Progress Checker object.
void updateParametersCallback(const std::vector< rclcpp::Parameter > &parameters)
Apply parameter updates after validation This callback is executed when parameters have been successf...
void initialize(const nav2::LifecycleNode::WeakPtr &parent, const std::string &plugin_name) override
Initialize the goal checker.
bool check(geometry_msgs::msg::PoseStamped &current_pose) override
Checks if the robot has moved compare to previous.
This plugin is used to check the position of the robot to make sure that it is actually progressing t...