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

This plugin manages the global plan by clipping it to the local segment, typically bounded by the local costmap size and transforming the resulting path into the odom frame. More...

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

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

Public Member Functions

 FeasiblePathHandler ()=default
 Construct a new Feasible Path Handler object.
 
 ~FeasiblePathHandler ()
 Destroy the Feasible Path Handler object.
 
void initialize (const nav2::LifecycleNode::WeakPtr &parent, const rclcpp::Logger &logger, const std::string &plugin_name, const std::shared_ptr< nav2_costmap_2d::Costmap2DROS > costmap_ros, nav2::TransformBuffer::SharedPtr tf) override
 Initialize parameters. More...
 
void setPlan (const nav_msgs::msg::Path &path) override
 Set new reference plan. More...
 
nav2_core::PathSegment findPlanSegment (const geometry_msgs::msg::PoseStamped &pose) override
 Determines the portion of the global plan to be used for local control. This function locates the start and end iterators of the global plan segment that is relevant for controller computation based on the robot's current pose and local costmap. More...
 
nav_msgs::msg::Path transformLocalPlan (const nav2_core::PathIterator &closest_point, const nav2_core::PathIterator &pruned_plan_end) override
 Transforms a predefined segment of the global plan into the costmap global frame. More...
 
geometry_msgs::msg::PoseStamped getTransformedGoal (const builtin_interfaces::msg::Time &stamp) override
 Get the global goal pose transformed to the costmap global frame. More...
 
nav_msgs::msg::Path getPlan ()
 Gets the global plan. More...
 

Protected Member Functions

geometry_msgs::msg::PoseStamped transformToGlobalPlanFrame (const geometry_msgs::msg::PoseStamped &pose)
 Transform a pose to the global reference frame. More...
 
double getCostmapMaxExtent () const
 
bool isWithinInversionTolerances (const geometry_msgs::msg::PoseStamped &robot_pose)
 Check if the robot pose is within the set inversion tolerances. More...
 
void prunePlan (nav_msgs::msg::Path &plan, const nav2_core::PathIterator end)
 Prune a path to only interesting portions. More...
 
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

std::mutex mutex_
 
rclcpp::node_interfaces::PostSetParametersCallbackHandle::SharedPtr post_set_params_handler_
 
rclcpp::node_interfaces::OnSetParametersCallbackHandle::SharedPtr on_set_params_handler_
 
nav2::LifecycleNode::WeakPtr node_
 
rclcpp::Logger logger_ {rclcpp::get_logger("FeasiblePathHandler")}
 
std::string plugin_name_
 
nav2::TransformBuffer::SharedPtr tf_
 
std::shared_ptr< nav2_costmap_2d::Costmap2DROScostmap_ros_
 
nav_msgs::msg::Path global_plan_
 
nav_msgs::msg::Path global_plan_up_to_constraint_
 
geometry_msgs::msg::PoseStamped global_pose_
 
unsigned int constraint_locale_ {0u}
 
bool reject_unit_path_
 
bool enforce_path_inversion_
 
bool enforce_path_rotation_
 
double max_robot_pose_search_dist_
 
double transform_tolerance_
 
double prune_distance_
 
float inversion_xy_tolerance_
 
float inversion_yaw_tolerance_
 
float minimum_rotation_angle_
 

Additional Inherited Members

- Public Types inherited from nav2_core::PathHandler
typedef std::shared_ptr< nav2_core::PathHandlerPtr
 

Detailed Description

This plugin manages the global plan by clipping it to the local segment, typically bounded by the local costmap size and transforming the resulting path into the odom frame.

Definition at line 37 of file feasible_path_handler.hpp.

Member Function Documentation

◆ findPlanSegment()

nav2_core::PathSegment nav2_controller::FeasiblePathHandler::findPlanSegment ( const geometry_msgs::msg::PoseStamped &  pose)
overridevirtual

Determines the portion of the global plan to be used for local control. This function locates the start and end iterators of the global plan segment that is relevant for controller computation based on the robot's current pose and local costmap.

Parameters
poseRobot pose in odom frame
Returns
PathSegment A pair of iterators defining the start and end of the selected plan segment.

Implements nav2_core::PathHandler.

Definition at line 163 of file feasible_path_handler.cpp.

References transformToGlobalPlanFrame().

Here is the call graph for this function:

◆ getCostmapMaxExtent()

double nav2_controller::FeasiblePathHandler::getCostmapMaxExtent ( ) const
protected

Get the greatest extent of the costmap in meters from the center.

Returns
max of distance from center in meters to edge of costmap

Definition at line 99 of file feasible_path_handler.cpp.

Referenced by initialize().

Here is the caller graph for this function:

◆ getPlan()

nav_msgs::msg::Path nav2_controller::FeasiblePathHandler::getPlan ( )
inline

Gets the global plan.

Returns
The global plan

Definition at line 104 of file feasible_path_handler.hpp.

◆ getTransformedGoal()

geometry_msgs::msg::PoseStamped nav2_controller::FeasiblePathHandler::getTransformedGoal ( const builtin_interfaces::msg::Time &  stamp)
overridevirtual

Get the global goal pose transformed to the costmap global frame.

Parameters
stampTime to get the goal pose at
Returns
Transformed goal pose

Implements nav2_core::PathHandler.

Definition at line 256 of file feasible_path_handler.cpp.

◆ initialize()

void nav2_controller::FeasiblePathHandler::initialize ( const nav2::LifecycleNode::WeakPtr &  parent,
const rclcpp::Logger &  logger,
const std::string &  plugin_name,
const std::shared_ptr< nav2_costmap_2d::Costmap2DROS costmap_ros,
nav2::TransformBuffer::SharedPtr  tf 
)
overridevirtual

Initialize parameters.

Parameters
parentLifecycle node pointer
loggerNode logging interface
plugin_nameName of the plugin
costmap_rosCostmap2DROS object
tfShared ptr of TF2 buffer

Implements nav2_core::PathHandler.

Definition at line 47 of file feasible_path_handler.cpp.

References getCostmapMaxExtent(), updateParametersCallback(), and validateParameterUpdatesCallback().

Here is the call graph for this function:

◆ isWithinInversionTolerances()

bool nav2_controller::FeasiblePathHandler::isWithinInversionTolerances ( const geometry_msgs::msg::PoseStamped &  robot_pose)
protected

Check if the robot pose is within the set inversion tolerances.

Parameters
robot_poseRobot's current pose to check
Returns
bool If the robot pose is within the set inversion tolerances

Definition at line 112 of file feasible_path_handler.cpp.

Referenced by transformLocalPlan().

Here is the caller graph for this function:

◆ prunePlan()

void nav2_controller::FeasiblePathHandler::prunePlan ( nav_msgs::msg::Path &  plan,
const nav2_core::PathIterator  end 
)
protected

Prune a path to only interesting portions.

Parameters
planPlan to prune
endFinal path iterator

Definition at line 107 of file feasible_path_handler.cpp.

Referenced by transformLocalPlan().

Here is the caller graph for this function:

◆ setPlan()

void nav2_controller::FeasiblePathHandler::setPlan ( const nav_msgs::msg::Path &  path)
overridevirtual

Set new reference plan.

Parameters
PathPath to use

Implements nav2_core::PathHandler.

Definition at line 129 of file feasible_path_handler.cpp.

◆ transformLocalPlan()

nav_msgs::msg::Path nav2_controller::FeasiblePathHandler::transformLocalPlan ( const nav2_core::PathIterator &  closest_point,
const nav2_core::PathIterator &  pruned_plan_end 
)
overridevirtual

Transforms a predefined segment of the global plan into the costmap global frame.

Parameters
closest_pointIterator to the starting pose of the path segment.
pruned_plan_endIterator to the ending pose of the path segment.
Returns
nav_msgs::msg::Path The transformed local plan segment in the costmap global frame.

Implements nav2_core::PathHandler.

Definition at line 203 of file feasible_path_handler.cpp.

References isWithinInversionTolerances(), and prunePlan().

Here is the call graph for this function:

◆ transformToGlobalPlanFrame()

geometry_msgs::msg::PoseStamped nav2_controller::FeasiblePathHandler::transformToGlobalPlanFrame ( const geometry_msgs::msg::PoseStamped &  pose)
protected

Transform a pose to the global reference frame.

Parameters
poseCurrent pose
Returns
output poose in global reference frame

Definition at line 140 of file feasible_path_handler.cpp.

Referenced by findPlanSegment().

Here is the caller graph for this function:

◆ updateParametersCallback()

void nav2_controller::FeasiblePathHandler::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 300 of file feasible_path_handler.cpp.

Referenced by initialize().

Here is the caller graph for this function:

◆ validateParameterUpdatesCallback()

rcl_interfaces::msg::SetParametersResult nav2_controller::FeasiblePathHandler::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 275 of file feasible_path_handler.cpp.

Referenced by initialize().

Here is the caller graph for this function:

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