15 #ifndef NAV2_CONTROLLER__PLUGINS__ADAPTIVE_TOLERANCE_GOAL_CHECKER_HPP_
16 #define NAV2_CONTROLLER__PLUGINS__ADAPTIVE_TOLERANCE_GOAL_CHECKER_HPP_
23 #include "rclcpp/logger.hpp"
24 #include "rclcpp/node_interfaces/node_parameters_interface.hpp"
25 #include "rclcpp/parameter.hpp"
26 #include "nav2_ros_common/lifecycle_node.hpp"
27 #include "nav2_core/goal_checker.hpp"
28 #include "rcl_interfaces/msg/set_parameters_result.hpp"
30 namespace nav2_controller
61 const nav2::LifecycleNode::WeakPtr & parent,
62 const std::string & plugin_name,
63 const std::shared_ptr<nav2_costmap_2d::Costmap2DROS> costmap_ros)
override;
68 void reset()
override;
79 const geometry_msgs::msg::Pose & query_pose,
80 const geometry_msgs::msg::Pose & goal_pose,
81 const geometry_msgs::msg::Twist & velocity,
82 const nav_msgs::msg::Path & transformed_global_plan)
override;
93 const geometry_msgs::msg::Pose & query_pose,
94 const geometry_msgs::msg::Pose & goal_pose,
95 const geometry_msgs::msg::Twist & velocity,
96 const nav_msgs::msg::Path & transformed_global_plan)
override;
106 geometry_msgs::msg::Pose & pose_tolerance,
107 geometry_msgs::msg::Twist & vel_tolerance,
108 double & path_length_tolerance)
override;
116 COARSE_TOLERANCE_FINISH_LINE,
117 COARSE_TOLERANCE_STOPPED_STAGNATION,
118 COARSE_TOLERANCE_DISTANCE_STAGNATION
121 nav2::LifecycleNode::WeakPtr node_;
122 rclcpp::Logger logger_{rclcpp::get_logger(
"adaptive_tolerance_goal_checker")};
125 double fine_xy_goal_tolerance_;
126 double fine_xy_goal_tolerance_sq_;
128 double coarse_xy_goal_tolerance_;
129 double coarse_xy_goal_tolerance_sq_;
132 double xy_goal_tolerance_buffer_;
133 double fine_xy_goal_tolerance_reset_sq_, coarse_xy_goal_tolerance_reset_sq_;
135 double yaw_goal_tolerance_;
136 double path_length_tolerance_;
138 bool symmetric_yaw_tolerance_;
141 double trans_stopped_velocity_;
142 double rot_stopped_velocity_;
145 int required_stagnation_cycles_;
149 bool in_tolerance_zone_;
150 int stopped_stagnation_count_;
151 int distance_stagnation_count_;
152 double best_distance_sq_;
159 rclcpp::node_interfaces::PostSetParametersCallbackHandle::SharedPtr post_set_params_handler_;
160 rclcpp::node_interfaces::OnSetParametersCallbackHandle::SharedPtr on_set_params_handler_;
161 std::string plugin_name_;
179 const std::vector<rclcpp::Parameter> & parameters);
Goal Checker plugin with two tolerance tiers: a tight desired tolerance and a looser coarse tolerance...
rcl_interfaces::msg::SetParametersResult validateParameterUpdatesCallback(const std::vector< rclcpp::Parameter > ¶meters)
Validate incoming parameter updates before applying them. This callback is triggered when one or more...
bool isGoalXYReached(const geometry_msgs::msg::Pose &query_pose, const geometry_msgs::msg::Pose &goal_pose, const geometry_msgs::msg::Twist &velocity, const nav_msgs::msg::Path &transformed_global_plan) override
Check if XY goal position has been reached (without considering yaw)
XyAcceptanceReason
Reason that the XY component of the goal was accepted.
bool getTolerances(geometry_msgs::msg::Pose &pose_tolerance, geometry_msgs::msg::Twist &vel_tolerance, double &path_length_tolerance) override
Get the position and velocity tolerances.
void updateParametersCallback(const std::vector< rclcpp::Parameter > ¶meters)
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, const std::shared_ptr< nav2_costmap_2d::Costmap2DROS > costmap_ros) override
Initialize the goal checker.
~AdaptiveToleranceGoalChecker()
Destroy the Progress Goal Checker object.
void reset() override
Reset the goal checker state.
AdaptiveToleranceGoalChecker()
Construct a new Progress Goal Checker object.
static std::string toString(XyAcceptanceReason reason)
Convert XY acceptance reason to string.
bool isGoalReached(const geometry_msgs::msg::Pose &query_pose, const geometry_msgs::msg::Pose &goal_pose, const geometry_msgs::msg::Twist &velocity, const nav_msgs::msg::Path &transformed_global_plan) override
Check if the goal is reached.
Function-object for checking whether a goal has been reached.