15 #ifndef NAV2_CONTROLLER__PLUGINS__ADAPTIVE_TOLERANCE_GOAL_CHECKER_HPP_
16 #define NAV2_CONTROLLER__PLUGINS__ADAPTIVE_TOLERANCE_GOAL_CHECKER_HPP_
23 #include "rclcpp/rclcpp.hpp"
24 #include "nav2_ros_common/lifecycle_node.hpp"
25 #include "nav2_core/goal_checker.hpp"
26 #include "rcl_interfaces/msg/set_parameters_result.hpp"
28 namespace nav2_controller
59 const nav2::LifecycleNode::WeakPtr & parent,
60 const std::string & plugin_name,
61 const std::shared_ptr<nav2_costmap_2d::Costmap2DROS> costmap_ros)
override;
66 void reset()
override;
77 const geometry_msgs::msg::Pose & query_pose,
78 const geometry_msgs::msg::Pose & goal_pose,
79 const geometry_msgs::msg::Twist & velocity,
80 const nav_msgs::msg::Path & transformed_global_plan)
override;
91 const geometry_msgs::msg::Pose & query_pose,
92 const geometry_msgs::msg::Pose & goal_pose,
93 const geometry_msgs::msg::Twist & velocity,
94 const nav_msgs::msg::Path & transformed_global_plan)
override;
104 geometry_msgs::msg::Pose & pose_tolerance,
105 geometry_msgs::msg::Twist & vel_tolerance,
106 double & path_length_tolerance)
override;
114 COARSE_TOLERANCE_FINISH_LINE,
115 COARSE_TOLERANCE_STOPPED_STAGNATION,
116 COARSE_TOLERANCE_DISTANCE_STAGNATION
119 nav2::LifecycleNode::WeakPtr node_;
120 rclcpp::Logger logger_{rclcpp::get_logger(
"adaptive_tolerance_goal_checker")};
123 double fine_xy_goal_tolerance_;
124 double fine_xy_goal_tolerance_sq_;
126 double coarse_xy_goal_tolerance_;
127 double coarse_xy_goal_tolerance_sq_;
130 double xy_goal_tolerance_buffer_;
131 double fine_xy_goal_tolerance_reset_sq_, coarse_xy_goal_tolerance_reset_sq_;
133 double yaw_goal_tolerance_;
134 double path_length_tolerance_;
136 bool symmetric_yaw_tolerance_;
139 double trans_stopped_velocity_;
140 double rot_stopped_velocity_;
143 int required_stagnation_cycles_;
147 bool in_tolerance_zone_;
148 int stopped_stagnation_count_;
149 int distance_stagnation_count_;
150 double best_distance_sq_;
157 rclcpp::node_interfaces::PostSetParametersCallbackHandle::SharedPtr post_set_params_handler_;
158 rclcpp::node_interfaces::OnSetParametersCallbackHandle::SharedPtr on_set_params_handler_;
159 std::string plugin_name_;
177 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.