Nav2 Navigation Stack - lyrical  lyrical
ROS 2 Navigation Stack
Public Member Functions | Protected Member Functions | Protected Attributes | List of all members
nav2_controller::PositionGoalChecker Class Reference

Goal Checker plugin that only checks XY position, ignoring orientation. More...

#include <nav2_controller/include/nav2_controller/plugins/position_goal_checker.hpp>

Inheritance diagram for nav2_controller::PositionGoalChecker:
Inheritance graph
[legend]
Collaboration diagram for nav2_controller::PositionGoalChecker:
Collaboration graph
[legend]

Public Member Functions

 PositionGoalChecker ()
 Construct a new Position Goal Checker object.
 
 ~PositionGoalChecker ()
 Destroy the Position Goal Checker object.
 
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. More...
 
void reset () override
 Reset the goal checker state.
 
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. More...
 
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. 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) More...
 

Protected Member Functions

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 parameters are about to be updated. It checks the validity of parameter values and rejects updates that would lead to invalid or inconsistent configurations. More...
 
void updateParametersCallback (const std::vector< rclcpp::Parameter > &parameters)
 Apply parameter updates after validation This callback is executed when parameters have been successfully updated. It updates the internal configuration of the node with the new parameter values. More...
 

Protected Attributes

nav2::LifecycleNode::WeakPtr node_
 
rclcpp::Logger logger_ {rclcpp::get_logger("position_goal_checker")}
 
double xy_goal_tolerance_
 
double xy_goal_tolerance_buffer_
 
double xy_goal_tolerance_sq_
 
double xy_goal_tolerance_reset_sq_
 
double path_length_tolerance_
 
bool stateful_
 
bool position_reached_
 
std::string plugin_name_
 
std::mutex mutex_
 
rclcpp::node_interfaces::PostSetParametersCallbackHandle::SharedPtr post_set_params_handler_
 
rclcpp::node_interfaces::OnSetParametersCallbackHandle::SharedPtr on_set_params_handler_
 

Additional Inherited Members

- Public Types inherited from nav2_core::GoalChecker
typedef std::shared_ptr< nav2_core::GoalCheckerPtr
 

Detailed Description

Goal Checker plugin that only checks XY position, ignoring orientation.

Definition at line 33 of file position_goal_checker.hpp.

Member Function Documentation

◆ getTolerances()

bool nav2_controller::PositionGoalChecker::getTolerances ( geometry_msgs::msg::Pose &  pose_tolerance,
geometry_msgs::msg::Twist &  vel_tolerance,
double &  path_length_tolerance 
)
overridevirtual

Get the position and velocity tolerances.

Parameters
pose_toleranceOutput parameter for pose tolerance
vel_toleranceOutput parameter for velocity tolerance
path_length_toleranceOutput parameter for path length tolerance
Returns
true if tolerances are available, false otherwise

Implements nav2_core::GoalChecker.

Definition at line 134 of file position_goal_checker.cpp.

◆ initialize()

void nav2_controller::PositionGoalChecker::initialize ( const nav2::LifecycleNode::WeakPtr &  parent,
const std::string &  plugin_name,
const std::shared_ptr< nav2_costmap_2d::Costmap2DROS costmap_ros 
)
overridevirtual

Initialize the goal checker.

Parameters
parentWeak pointer to the lifecycle node
plugin_nameName of the plugin
costmap_rosShared pointer to the costmap

Implements nav2_core::GoalChecker.

Definition at line 53 of file position_goal_checker.cpp.

References updateParametersCallback(), and validateParameterUpdatesCallback().

Here is the call graph for this function:

◆ isGoalReached()

bool nav2_controller::PositionGoalChecker::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 
)
overridevirtual

Check if the goal is reached.

Parameters
query_poseCurrent pose of the robot
goal_poseTarget goal pose
velocityCurrent velocity of the robot
transformed_global_planThe transformed global plan
Returns
true if goal is reached, false otherwise

Implements nav2_core::GoalChecker.

Definition at line 90 of file position_goal_checker.cpp.

References isGoalXYReached().

Here is the call graph for this function:

◆ isGoalXYReached()

bool nav2_controller::PositionGoalChecker::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 
)
overridevirtual

Check if XY goal position has been reached (without considering yaw)

Parameters
query_poseThe pose to check
goal_poseThe pose to check against
velocityThe robot's current velocity
transformed_global_planThe global plan after being processed by the path handler
Returns
True if XY goal is reached (position within tolerance, yaw ignored)

Implements nav2_core::GoalChecker.

Definition at line 97 of file position_goal_checker.cpp.

Referenced by isGoalReached().

Here is the caller graph for this function:

◆ updateParametersCallback()

void nav2_controller::PositionGoalChecker::updateParametersCallback ( const std::vector< rclcpp::Parameter > &  parameters)
protected

Apply parameter updates after validation This callback is executed when parameters have been successfully updated. It updates the internal configuration of the node with the new parameter values.

Parameters
parametersList of parameters that have been updated.

Definition at line 191 of file position_goal_checker.cpp.

Referenced by initialize().

Here is the caller graph for this function:

◆ validateParameterUpdatesCallback()

rcl_interfaces::msg::SetParametersResult nav2_controller::PositionGoalChecker::validateParameterUpdatesCallback ( const std::vector< rclcpp::Parameter > &  parameters)
protected

Validate incoming parameter updates before applying them. This callback is triggered when one or more parameters are about to be updated. It checks the validity of parameter values and rejects updates that would lead to invalid or inconsistent configurations.

Parameters
parametersList of parameters that are being updated.
Returns
rcl_interfaces::msg::SetParametersResult Result indicating whether the update is accepted.

Definition at line 166 of file position_goal_checker.cpp.

Referenced by initialize().

Here is the caller graph for this function:

The documentation for this class was generated from the following files: