Nav2 Navigation Stack - rolling
main
ROS 2 Navigation Stack
|
NodeLattice implementation for graph, Hybrid-A*. More...
#include <nav2_smac_planner/include/nav2_smac_planner/node_lattice.hpp>
Public Types | |
typedef NodeLattice * | NodePtr |
typedef std::unique_ptr< std::vector< NodeLattice > > | Graph |
typedef std::vector< NodePtr > | NodeVector |
typedef NodeHybrid::Coordinates | Coordinates |
typedef NodeHybrid::CoordinateVector | CoordinateVector |
Public Member Functions | |
NodeLattice (const uint64_t index) | |
A constructor for nav2_smac_planner::NodeLattice. More... | |
~NodeLattice () | |
A destructor for nav2_smac_planner::NodeLattice. | |
bool | operator== (const NodeLattice &rhs) |
operator== for comparisons More... | |
void | setPose (const Coordinates &pose_in) |
setting continuous coordinate search poses (in partial-cells) More... | |
void | reset () |
Reset method for new search. | |
void | setMotionPrimitive (MotionPrimitive *prim) |
Sets the motion primitive used to achieve node in search. More... | |
MotionPrimitive *& | getMotionPrimitive () |
Gets the motion primitive used to achieve node in search. More... | |
float | getAccumulatedCost () |
Gets the accumulated cost at this node. More... | |
void | setAccumulatedCost (const float &cost_in) |
Sets the accumulated cost at this node. More... | |
float | getCost () |
Gets the costmap cost at this node. More... | |
bool | wasVisited () |
Gets if cell has been visited in search. More... | |
void | visited () |
Sets if cell has been visited in search. | |
uint64_t | getIndex () |
Gets cell index. More... | |
void | backwards (bool back=true) |
Sets that this primitive is moving in reverse. | |
bool | isBackward () |
Gets if this primitive is moving in reverse. More... | |
bool | isNodeValid (const bool &traverse_unknown, GridCollisionChecker *collision_checker, MotionPrimitive *primitive=nullptr, bool is_backwards=false) |
Check if this node is valid. More... | |
float | getTraversalCost (const NodePtr &child) |
Get traversal cost of parent node to child node. More... | |
void | getNeighbors (std::function< bool(const uint64_t &, nav2_smac_planner::NodeLattice *&)> &validity_checker, GridCollisionChecker *collision_checker, const bool &traverse_unknown, NodeVector &neighbors) |
Retrieve all valid neighbors of a node. More... | |
bool | backtracePath (CoordinateVector &path) |
Set the starting pose for planning, as a node index. More... | |
void | addNodeToPath (NodePtr current_node, CoordinateVector &path) |
add node to the path More... | |
Static Public Member Functions | |
static uint64_t | getIndex (const unsigned int &x, const unsigned int &y, const unsigned int &angle) |
Get index at coordinates. More... | |
static Coordinates | getCoords (const uint64_t &index, const unsigned int &width, const unsigned int &angle_quantization) |
Get coordinates at index. More... | |
static float | getHeuristicCost (const Coordinates &node_coords, const CoordinateVector &goals_coords) |
Get cost of heuristic of node. More... | |
static void | initMotionModel (const MotionModel &motion_model, unsigned int &size_x, unsigned int &size_y, unsigned int &angle_quantization, SearchInfo &search_info) |
Initialize motion models. More... | |
static void | precomputeDistanceHeuristic (const float &lookup_table_dim, const MotionModel &motion_model, const unsigned int &dim_3_size, const SearchInfo &search_info) |
Compute the SE2 distance heuristic. More... | |
static void | resetObstacleHeuristic (std::shared_ptr< nav2_costmap_2d::Costmap2DROS > costmap_ros, const unsigned int &start_x, const unsigned int &start_y, const unsigned int &goal_x, const unsigned int &goal_y) |
Compute the wavefront heuristic. More... | |
static float | getObstacleHeuristic (const Coordinates &node_coords, const Coordinates &goal_coords, const double &cost_penalty) |
Compute the Obstacle heuristic. More... | |
static float | getDistanceHeuristic (const Coordinates &node_coords, const Coordinates &goal_coords, const float &obstacle_heuristic) |
Compute the Distance heuristic. More... | |
Public Attributes | |
NodeLattice * | parent |
Coordinates | pose |
Static Public Attributes | |
static NAV2_SMAC_PLANNER_COMMON_EXPORT LatticeMotionTable | motion_table |
static NAV2_SMAC_PLANNER_COMMON_EXPORT LookupTable | dist_heuristic_lookup_table |
static NAV2_SMAC_PLANNER_COMMON_EXPORT float | size_lookup = 25 |
NodeLattice implementation for graph, Hybrid-A*.
Definition at line 121 of file node_lattice.hpp.
|
explicit |
A constructor for nav2_smac_planner::NodeLattice.
index | The index of this node for self-reference |
Definition at line 189 of file node_lattice.cpp.
void nav2_smac_planner::NodeLattice::addNodeToPath | ( | NodeLattice::NodePtr | current_node, |
NodeLattice::CoordinateVector & | path | ||
) |
add node to the path
current_node |
Definition at line 586 of file node_lattice.cpp.
References getMotionPrimitive(), and isBackward().
Referenced by backtracePath().
bool nav2_smac_planner::NodeLattice::backtracePath | ( | CoordinateVector & | path | ) |
Set the starting pose for planning, as a node index.
path | Reference to a vector of indices of generated path |
Definition at line 567 of file node_lattice.cpp.
References addNodeToPath().
|
inline |
Gets the accumulated cost at this node.
Definition at line 187 of file node_lattice.hpp.
|
inlinestatic |
Get coordinates at index.
index | Index of point |
width | Width of costmap |
angle_quantization | Theta size of costmap |
Definition at line 299 of file node_lattice.hpp.
|
inline |
Gets the costmap cost at this node.
Definition at line 205 of file node_lattice.hpp.
Referenced by getTraversalCost().
|
static |
Compute the Distance heuristic.
node_coords | Coordinates to get heuristic at |
goal_coords | Coordinates to compute heuristic to |
obstacle_heuristic | Value of the obstacle heuristic to compute additional motion heuristics if required |
Definition at line 379 of file node_lattice.cpp.
References nav2_smac_planner::LatticeMotionTable::getAngleFromBin().
Referenced by getHeuristicCost().
|
static |
Get cost of heuristic of node.
node | Node index current |
node | Node index of new |
Definition at line 346 of file node_lattice.cpp.
References getDistanceHeuristic(), and getObstacleHeuristic().
|
inline |
Gets cell index.
Definition at line 231 of file node_lattice.hpp.
Referenced by nav2_simple_commander.costmap_2d.PyCostmap2D::getCostXY(), getNeighbors(), and nav2_simple_commander.costmap_2d.PyCostmap2D::setCost().
|
inlinestatic |
Get index at coordinates.
x | X coordinate of point |
y | Y coordinate of point |
angle | Theta coordinate of point |
Definition at line 283 of file node_lattice.hpp.
References nav2_smac_planner::NodeHybrid::getIndex().
Referenced by nav2_simple_commander.costmap_2d.PyCostmap2D::getCostXY(), and nav2_simple_commander.costmap_2d.PyCostmap2D::setCost().
|
inline |
Gets the motion primitive used to achieve node in search.
Definition at line 178 of file node_lattice.hpp.
Referenced by addNodeToPath(), and getTraversalCost().
void nav2_smac_planner::NodeLattice::getNeighbors | ( | std::function< bool(const uint64_t &, nav2_smac_planner::NodeLattice *&)> & | validity_checker, |
GridCollisionChecker * | collision_checker, | ||
const bool & | traverse_unknown, | ||
NodeVector & | neighbors | ||
) |
Retrieve all valid neighbors of a node.
validity_checker | Functor for state validity checking |
collision_checker | Collision checker to use |
traverse_unknown | If unknown costs are valid to traverse |
neighbors | Vector of neighbors to be filled |
Definition at line 494 of file node_lattice.cpp.
References backwards(), getIndex(), nav2_smac_planner::LatticeMotionTable::getMotionPrimitives(), isNodeValid(), setMotionPrimitive(), setPose(), and wasVisited().
|
inlinestatic |
Compute the Obstacle heuristic.
node_coords | Coordinates to get heuristic at |
goal_coords | Coordinates to compute heuristic to |
Definition at line 369 of file node_lattice.hpp.
References nav2_smac_planner::NodeHybrid::getObstacleHeuristic().
Referenced by getHeuristicCost().
float nav2_smac_planner::NodeLattice::getTraversalCost | ( | const NodePtr & | child | ) |
Get traversal cost of parent node to child node.
child | Node pointer to child |
Definition at line 296 of file node_lattice.cpp.
References getCost(), getMotionPrimitive(), and isBackward().
|
static |
Initialize motion models.
motion_model | Motion model enum to use |
size_x | Size of X of graph |
size_y | Size of y of graph |
angle_quantization | Size of theta bins of graph |
search_info | Search info to use |
Definition at line 363 of file node_lattice.cpp.
|
inline |
Gets if this primitive is moving in reverse.
Definition at line 248 of file node_lattice.hpp.
Referenced by addNodeToPath(), and getTraversalCost().
bool nav2_smac_planner::NodeLattice::isNodeValid | ( | const bool & | traverse_unknown, |
GridCollisionChecker * | collision_checker, | ||
MotionPrimitive * | primitive = nullptr , |
||
bool | is_backwards = false |
||
) |
Check if this node is valid.
traverse_unknown | If we can explore unknown nodes on the graph |
collision_checker | Collision checker object to aid in validity checking |
primitive | Optional argument if needing to check over a primitive not only a terminal pose |
is_backwards | Optional argument if needed to check if prim expansion is in reverse |
Definition at line 221 of file node_lattice.cpp.
References nav2_smac_planner::LatticeMotionTable::getAngleFromBin(), nav2_smac_planner::GridCollisionChecker::getCost(), nav2_smac_planner::GridCollisionChecker::getPrecomputedAngles(), and nav2_smac_planner::GridCollisionChecker::inCollision().
Referenced by getNeighbors().
|
inline |
operator== for comparisons
NodeLattice | right hand side node reference |
Definition at line 146 of file node_lattice.hpp.
|
static |
Compute the SE2 distance heuristic.
lookup_table_dim | Size, in costmap pixels, of the each lookup table dimension to populate |
motion_model | Motion model to use for state space |
dim_3_size | Number of quantization bins for caching |
search_info | Info containing minimum radius to use |
Definition at line 446 of file node_lattice.cpp.
|
inlinestatic |
Compute the wavefront heuristic.
costmap | Costmap to use |
goal_coords | Coordinates to start heuristic expansion at |
Definition at line 354 of file node_lattice.hpp.
References nav2_smac_planner::NodeHybrid::resetObstacleHeuristic().
|
inline |
Sets the accumulated cost at this node.
reference | to accumulated cost |
Definition at line 196 of file node_lattice.hpp.
|
inline |
Sets the motion primitive used to achieve node in search.
pointer | to motion primitive |
Definition at line 169 of file node_lattice.hpp.
Referenced by getNeighbors().
|
inline |
setting continuous coordinate search poses (in partial-cells)
Pose | pose |
Definition at line 155 of file node_lattice.hpp.
Referenced by getNeighbors().
|
inline |
Gets if cell has been visited in search.
If | cell was visited |
Definition at line 214 of file node_lattice.hpp.
Referenced by getNeighbors().