EasyNav Plugins
Loading...
Searching...
No Matches
CostmapPlanner Class Reference

A planner implementing the A* algorithm on a Costmap2D grid. More...

#include <CostmapPlanner.hpp>

Inheritance diagram for CostmapPlanner:
Collaboration diagram for CostmapPlanner:

Public Member Functions

 CostmapPlanner ()
 Default constructor.
virtual void on_initialize () override
 Initializes the planner.
void update (NavState &nav_state) override
 Executes a planning cycle using the current navigation state.

Protected Member Functions

std::vector< geometry_msgs::msg::Pose > a_star_path (const Costmap2D &map, const geometry_msgs::msg::Pose &start, const geometry_msgs::msg::Pose &goal)
 Internal A* path planning routine.

Protected Attributes

bool continuous_replan_ {true}
 Wheter replan path at freq time.
double cost_factor_
 Scaling factor applied to cell cost values.
geometry_msgs::msg::Pose current_goal_
 Current goal.
nav_msgs::msg::Path current_path_
 Most recently computed path.
double heuristic_scale_ {1.0}
 Scaling factor applied to the heuristic term in A*.
double inflation_penalty_
 Extra cost penalty for paths near inflated obstacles.
rclcpp::Publisher< nav_msgs::msg::Path >::SharedPtr path_pub_
 Publisher for the computed navigation path (for visualization or monitoring).

Detailed Description

A planner implementing the A* algorithm on a Costmap2D grid.

This class generates a collision-free path using A* search over a 2D costmap. It supports cost-based penalties and anisotropic movement costs.

Constructor & Destructor Documentation

◆ CostmapPlanner()

CostmapPlanner ( )
explicit

Default constructor.

Initializes internal parameters and configuration values.

Member Function Documentation

◆ a_star_path()

std::vector< geometry_msgs::msg::Pose > a_star_path ( const Costmap2D & map,
const geometry_msgs::msg::Pose & start,
const geometry_msgs::msg::Pose & goal )
protected

Internal A* path planning routine.

Computes a path on the given costmap from the start pose to the goal pose.

Movement cost is influenced by:

  • The cost of each cell (retrieved from the costmap).
  • Additional inflation penalties near obstacles.
  • Anisotropic weights for axial vs diagonal movement.
Parameters
mapThe costmap to plan over.
startThe robot's starting pose in world coordinates.
goalThe goal pose in world coordinates.
Returns
A vector of poses representing the planned path.

◆ on_initialize()

void on_initialize ( )
overridevirtual

Initializes the planner.

Loads planner parameters, sets up ROS publishers, and prepares the costmap-based planning environment.

Exceptions
std::runtime_errorif initialization fails.

◆ update()

void update ( NavState & nav_state)
override

Executes a planning cycle using the current navigation state.

Computes a path from the robot's current pose to the goal using A*.

Parameters
nav_stateCurrent shared navigation state (input/output).

Member Data Documentation

◆ continuous_replan_

bool continuous_replan_ {true}
protected

Wheter replan path at freq time.

◆ cost_factor_

double cost_factor_
protected

Scaling factor applied to cell cost values.

◆ current_goal_

geometry_msgs::msg::Pose current_goal_
protected

Current goal.

◆ current_path_

nav_msgs::msg::Path current_path_
protected

Most recently computed path.

◆ heuristic_scale_

double heuristic_scale_ {1.0}
protected

Scaling factor applied to the heuristic term in A*.

◆ inflation_penalty_

double inflation_penalty_
protected

Extra cost penalty for paths near inflated obstacles.

◆ path_pub_

rclcpp::Publisher<nav_msgs::msg::Path>::SharedPtr path_pub_
protected

Publisher for the computed navigation path (for visualization or monitoring).


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