Nav2 Navigation Stack - humble
humble
ROS 2 Navigation Stack
|
An A* implementation for planning in a costmap. Templated based on the Node type. More...
#include <nav2_smac_planner/include/nav2_smac_planner/a_star.hpp>
Classes | |
struct | NodeComparator |
Public Types | |
typedef NodeT * | NodePtr |
typedef robin_hood::unordered_node_map< unsigned int, NodeT > | Graph |
typedef std::vector< NodePtr > | NodeVector |
typedef std::pair< float, NodeBasic< NodeT > > | NodeElement |
typedef NodeT::Coordinates | Coordinates |
typedef NodeT::CoordinateVector | CoordinateVector |
typedef NodeVector::iterator | NeighborIterator |
typedef std::function< bool(const unsigned int &, NodeT *&)> | NodeGetter |
typedef std::priority_queue< NodeElement, std::vector< NodeElement >, NodeComparator > | NodeQueue |
Public Member Functions | |
AStarAlgorithm (const MotionModel &motion_model, const SearchInfo &search_info) | |
A constructor for nav2_smac_planner::AStarAlgorithm. | |
~AStarAlgorithm () | |
A destructor for nav2_smac_planner::AStarAlgorithm. | |
void | initialize (const bool &allow_unknown, int &max_iterations, const int &max_on_approach_iterations, const double &max_planning_time, const float &lookup_table_size, const unsigned int &dim_3_size) |
Initialization of the planner with defaults. More... | |
bool | createPath (CoordinateVector &path, int &num_iterations, const float &tolerance) |
Creating path from given costmap, start, and goal. More... | |
void | setCollisionChecker (GridCollisionChecker *collision_checker) |
Sets the collision checker to use. More... | |
void | setGoal (const unsigned int &mx, const unsigned int &my, const unsigned int &dim_3) |
Set the goal for planning, as a node index. More... | |
void | setStart (const unsigned int &mx, const unsigned int &my, const unsigned int &dim_3) |
Set the starting pose for planning, as a node index. More... | |
int & | getMaxIterations () |
Get maximum number of iterations to plan. More... | |
NodePtr & | getStart () |
Get pointer reference to starting node. More... | |
NodePtr & | getGoal () |
Get pointer reference to goal node. More... | |
int & | getOnApproachMaxIterations () |
Get maximum number of on-approach iterations after within threshold. More... | |
float & | getToleranceHeuristic () |
Get tolerance, in node nodes. More... | |
unsigned int & | getSizeX () |
Get size of graph in X. More... | |
unsigned int & | getSizeY () |
Get size of graph in Y. More... | |
unsigned int & | getSizeDim3 () |
Get number of angle quantization bins (SE2) or Z coordinate (XYZ) More... | |
void | initialize (const bool &allow_unknown, int &max_iterations, const int &max_on_approach_iterations, const double &max_planning_time, const float &, const unsigned int &dim_3_size) |
void | setStart (const unsigned int &mx, const unsigned int &my, const unsigned int &dim_3) |
void | setGoal (const unsigned int &mx, const unsigned int &my, const unsigned int &dim_3) |
Protected Member Functions | |
NodePtr | getNextNode () |
Get pointer to next goal in open set. More... | |
void | addNode (const float &cost, NodePtr &node) |
Add a node to the open set. More... | |
NodePtr | addToGraph (const unsigned int &index) |
Adds node to graph. More... | |
bool | isGoal (NodePtr &node) |
Check if this node is the goal node. More... | |
float | getHeuristicCost (const NodePtr &node) |
Get cost of heuristic of node. More... | |
bool | areInputsValid () |
Check if inputs to planner are valid. More... | |
void | clearQueue () |
Clear hueristic queue of nodes to search. | |
void | clearGraph () |
Clear graph of nodes searched. | |
Protected Attributes | |
int | _timing_interval = 5000 |
bool | _traverse_unknown |
bool | _is_initialized |
int | _max_iterations |
int | _max_on_approach_iterations |
double | _max_planning_time |
float | _tolerance |
unsigned int | _x_size |
unsigned int | _y_size |
unsigned int | _dim3_size |
SearchInfo | _search_info |
Coordinates | _goal_coordinates |
NodePtr | _start |
NodePtr | _goal |
Graph | _graph |
NodeQueue | _queue |
MotionModel | _motion_model |
NodeHeuristicPair | _best_heuristic_node |
GridCollisionChecker * | _collision_checker |
nav2_costmap_2d::Costmap2D * | _costmap |
std::unique_ptr< AnalyticExpansion< NodeT > > | _expander |
An A* implementation for planning in a costmap. Templated based on the Node type.
Definition at line 46 of file a_star.hpp.
|
inlineprotected |
Add a node to the open set.
cost | The cost to sort into the open set of the node |
node | Node pointer reference to add to open set |
Definition at line 369 of file a_star.cpp.
References nav2_smac_planner::NodeBasic< NodeT >::populateSearchNode().
|
inlineprotected |
|
inlineprotected |
bool nav2_smac_planner::AStarAlgorithm< NodeT >::createPath | ( | CoordinateVector & | path, |
int & | num_iterations, | ||
const float & | tolerance | ||
) |
Creating path from given costmap, start, and goal.
path | Reference to a vector of indicies of generated path |
num_iterations | Reference to number of iterations to create plan |
tolerance | Reference to tolerance in costmap nodes |
Definition at line 226 of file a_star.cpp.
AStarAlgorithm< NodeT >::NodePtr & nav2_smac_planner::AStarAlgorithm< NodeT >::getGoal |
Get pointer reference to goal node.
Definition at line 354 of file a_star.cpp.
|
inlineprotected |
Get cost of heuristic of node.
node | Node pointer to get heuristic for |
Definition at line 377 of file a_star.cpp.
int & nav2_smac_planner::AStarAlgorithm< NodeT >::getMaxIterations |
Get maximum number of iterations to plan.
Definition at line 407 of file a_star.cpp.
|
inlineprotected |
Get pointer to next goal in open set.
Definition at line 360 of file a_star.cpp.
References nav2_smac_planner::NodeBasic< NodeT >::processSearchNode().
int & nav2_smac_planner::AStarAlgorithm< NodeT >::getOnApproachMaxIterations |
Get maximum number of on-approach iterations after within threshold.
Definition at line 413 of file a_star.cpp.
unsigned int & nav2_smac_planner::AStarAlgorithm< NodeT >::getSizeDim3 |
Get number of angle quantization bins (SE2) or Z coordinate (XYZ)
Definition at line 437 of file a_star.cpp.
unsigned int & nav2_smac_planner::AStarAlgorithm< NodeT >::getSizeX |
unsigned int & nav2_smac_planner::AStarAlgorithm< NodeT >::getSizeY |
AStarAlgorithm< NodeT >::NodePtr & nav2_smac_planner::AStarAlgorithm< NodeT >::getStart |
Get pointer reference to starting node.
Definition at line 348 of file a_star.cpp.
float & nav2_smac_planner::AStarAlgorithm< NodeT >::getToleranceHeuristic |
Get tolerance, in node nodes.
Definition at line 419 of file a_star.cpp.
void nav2_smac_planner::AStarAlgorithm< NodeT >::initialize | ( | const bool & | allow_unknown, |
int & | max_iterations, | ||
const int & | max_on_approach_iterations, | ||
const double & | max_planning_time, | ||
const float & | lookup_table_size, | ||
const unsigned int & | dim_3_size | ||
) |
Initialization of the planner with defaults.
allow_unknown | Allow search in unknown space, good for navigation while mapping |
max_iterations | Maximum number of iterations to use while expanding search |
max_on_approach_iterations | Maximum number of iterations before returning a valid path once within thresholds to refine path comes at more compute time but smoother paths. |
max_planning_time | Maximum time (in seconds) to wait for a plan, createPath returns false after this timeout |
Definition at line 59 of file a_star.cpp.
|
inlineprotected |
Check if this node is the goal node.
node | Node pointer to check if its the goal node |
Definition at line 342 of file a_star.cpp.
void nav2_smac_planner::AStarAlgorithm< NodeT >::setCollisionChecker | ( | GridCollisionChecker * | collision_checker | ) |
Sets the collision checker to use.
collision_checker | Collision checker to use for checking state validity |
Definition at line 103 of file a_star.cpp.
References nav2_costmap_2d::FootprintCollisionChecker< CostmapT >::getCostmap(), and nav2_costmap_2d::Costmap2D::getSizeInCellsX().
void nav2_smac_planner::AStarAlgorithm< NodeT >::setGoal | ( | const unsigned int & | mx, |
const unsigned int & | my, | ||
const unsigned int & | dim_3 | ||
) |
Set the goal for planning, as a node index.
mx | The node X index of the goal |
my | The node Y index of the goal |
dim_3 | The node dim_3 index of the goal |
Definition at line 173 of file a_star.cpp.
void nav2_smac_planner::AStarAlgorithm< NodeT >::setStart | ( | const unsigned int & | mx, |
const unsigned int & | my, | ||
const unsigned int & | dim_3 | ||
) |
Set the starting pose for planning, as a node index.
mx | The node X index of the goal |
my | The node Y index of the goal |
dim_3 | The node dim_3 index of the goal |
Definition at line 145 of file a_star.cpp.