|
Nav2 Navigation Stack - kilted
kilted
ROS 2 Navigation Stack
|
Navigation function class. Holds buffers for costmap, navfn map. Maps are pixel-based. Origin is upper left, x is right, y is down. More...
#include <nav2_navfn_planner/include/nav2_navfn_planner/navfn.hpp>
Public Member Functions | |
| NavFn (int nx, int ny) | |
| Constructs the planner. More... | |
| void | setNavArr (int nx, int ny) |
| Sets or resets the size of the map. More... | |
| void | setCostmap (const COSTTYPE *cmap, bool isROS=true, bool allow_unknown=true) |
| Set up the cost array for the planner, usually from ROS. More... | |
| bool | calcNavFnAstar (std::function< bool()> cancelChecker) |
| Calculates a plan using the A* heuristic, returns true if one is found. More... | |
| bool | calcNavFnDijkstra (std::function< bool()> cancelChecker, bool atStart=false) |
| Calculates the full navigation function using Dijkstra. More... | |
| float * | getPathX () |
| Accessor for the x-coordinates of a path. More... | |
| float * | getPathY () |
| Accessor for the y-coordinates of a path. More... | |
| int | getPathLen () |
| Accessor for the length of a path. More... | |
| float | getLastPathCost () |
| Gets the cost of the path found the last time a navigation function was computed. More... | |
| void | setGoal (int *goal) |
| Sets the goal position for the planner. Note: the navigation cost field computed gives the cost to get to a given point from the goal, not from the start. More... | |
| void | setStart (int *start) |
| Sets the start position for the planner. Note: the navigation cost field computed gives the cost to get to a given point from the goal, not from the start. More... | |
| void | initCost (int k, float v) |
| Initialize cell k with cost v for propagation. More... | |
| void | updateCell (int n) |
| Updates the cell at index n. More... | |
| void | updateCellAstar (int n) |
| Updates the cell at index n using the A* heuristic. More... | |
| void | setupNavFn (bool keepit=false) |
| Set up navigation potential arrays for new propagation. More... | |
| bool | propNavFnDijkstra (int cycles, std::function< bool()> cancelChecker, bool atStart=false) |
| Run propagation for <cycles> iterations, or until start is reached using breadth-first Dijkstra method. More... | |
| bool | propNavFnAstar (int cycles, std::function< bool()> cancelChecker) |
| Run propagation for <cycles> iterations, or until start is reached using the best-first A* method with Euclidean distance heuristic. More... | |
| int | calcPath (int n, int *st=NULL) |
| Calculates the path for at most <n> cycles. More... | |
| float | gradCell (int n) |
| Calculate gradient at a cell. More... | |
Public Attributes | |
| int | nx |
| int | ny |
| int | ns |
| COSTTYPE * | costarr |
| float * | potarr |
| bool * | pending |
| int | nobs |
| int * | pb1 |
| int * | pb2 |
| int * | pb3 |
| int * | curP |
| int * | nextP |
| int * | overP |
| int | curPe |
| int | nextPe |
| int | overPe |
| float | curT |
| float | priInc |
| int | goal [2] |
| int | start [2] |
| float * | gradx |
| float * | grady |
| float * | pathx |
| float * | pathy |
| int | npath |
| int | npathbuf |
| float | last_path_cost_ |
| float | pathStep |
Static Public Attributes | |
| static constexpr int | terminal_checking_interval = 5000 |
Navigation function class. Holds buffers for costmap, navfn map. Maps are pixel-based. Origin is upper left, x is right, y is down.
| nav2_navfn_planner::NavFn::NavFn | ( | int | nx, |
| int | ny | ||
| ) |
| bool nav2_navfn_planner::NavFn::calcNavFnAstar | ( | std::function< bool()> | cancelChecker | ) |
Calculates a plan using the A* heuristic, returns true if one is found.
| cancelChecker | Function to check if the task has been canceled |
Definition at line 311 of file navfn.cpp.
References propNavFnAstar(), and setupNavFn().

| bool nav2_navfn_planner::NavFn::calcNavFnDijkstra | ( | std::function< bool()> | cancelChecker, |
| bool | atStart = false |
||
| ) |
Calculates the full navigation function using Dijkstra.
| cancelChecker | Function to check if the task has been canceled |
Definition at line 297 of file navfn.cpp.
References propNavFnDijkstra(), and setupNavFn().

| int nav2_navfn_planner::NavFn::calcPath | ( | int | n, |
| int * | st = NULL |
||
| ) |
Calculates the path for at most <n> cycles.
| n | The maximum number of cycles to run for |
Definition at line 763 of file navfn.cpp.
References gradCell(), gradx, grady, npath, npathbuf, ns, pathStep, pathy, and potarr.

| float nav2_navfn_planner::NavFn::getLastPathCost | ( | ) |
Gets the cost of the path found the last time a navigation function was computed.
Definition at line 745 of file navfn.cpp.
References last_path_cost_.
| int nav2_navfn_planner::NavFn::getPathLen | ( | ) |
| float * nav2_navfn_planner::NavFn::getPathX | ( | ) |
| float * nav2_navfn_planner::NavFn::getPathY | ( | ) |
| float nav2_navfn_planner::NavFn::gradCell | ( | int | n | ) |
| void nav2_navfn_planner::NavFn::initCost | ( | int | k, |
| float | v | ||
| ) |
Initialize cell k with cost v for propagation.
| k | the cell to initialize |
| v | the cost to give to the cell |
Definition at line 401 of file navfn.cpp.
References potarr.
Referenced by setupNavFn().

| bool nav2_navfn_planner::NavFn::propNavFnAstar | ( | int | cycles, |
| std::function< bool()> | cancelChecker | ||
| ) |
Run propagation for <cycles> iterations, or until start is reached using the best-first A* method with Euclidean distance heuristic.
| cycles | The maximum number of iterations to run for |
| cancelChecker | Function to check if the task has been canceled |
Definition at line 660 of file navfn.cpp.
References curT, last_path_cost_, nobs, ns, overP, overPe, pending, potarr, priInc, and updateCellAstar().
Referenced by calcNavFnAstar().


| bool nav2_navfn_planner::NavFn::propNavFnDijkstra | ( | int | cycles, |
| std::function< bool()> | cancelChecker, | ||
| bool | atStart = false |
||
| ) |
Run propagation for <cycles> iterations, or until start is reached using breadth-first Dijkstra method.
| cycles | The maximum number of iterations to run for |
| cancelChecker | Function to check if the task has been canceled |
| atStart | Whether or not to stop when the start point is reached |
Definition at line 575 of file navfn.cpp.
References curT, nobs, ns, overP, overPe, pending, potarr, priInc, and updateCell().
Referenced by calcNavFnDijkstra().


| void nav2_navfn_planner::NavFn::setCostmap | ( | const COSTTYPE * | cmap, |
| bool | isROS = true, |
||
| bool | allow_unknown = true |
||
| ) |
| void nav2_navfn_planner::NavFn::setGoal | ( | int * | goal | ) |
| void nav2_navfn_planner::NavFn::setNavArr | ( | int | nx, |
| int | ny | ||
| ) |
| void nav2_navfn_planner::NavFn::setStart | ( | int * | start | ) |
| void nav2_navfn_planner::NavFn::setupNavFn | ( | bool | keepit = false | ) |
Set up navigation potential arrays for new propagation.
| keepit | whether or not use COST_NEUTRAL |
Definition at line 342 of file navfn.cpp.
References costarr, curT, gradx, grady, initCost(), nobs, ns, overP, overPe, pb1, pb3, pending, and potarr.
Referenced by calcNavFnAstar(), and calcNavFnDijkstra().


|
inline |
|
inline |
| COSTTYPE* nav2_navfn_planner::NavFn::costarr |
cell arrays cost array in 2D configuration space
Definition at line 171 of file navfn.hpp.
Referenced by NavFn(), setCostmap(), setNavArr(), setupNavFn(), updateCell(), and updateCellAstar().
| float nav2_navfn_planner::NavFn::curT |
block priority thresholds current threshold
Definition at line 182 of file navfn.hpp.
Referenced by propNavFnAstar(), propNavFnDijkstra(), setupNavFn(), updateCell(), and updateCellAstar().
| float* nav2_navfn_planner::NavFn::gradx |
gradient and paths
Definition at line 254 of file navfn.hpp.
Referenced by calcPath(), gradCell(), NavFn(), setNavArr(), and setupNavFn().
| float * nav2_navfn_planner::NavFn::grady |
gradient arrays, size of potential array
Definition at line 254 of file navfn.hpp.
Referenced by calcPath(), gradCell(), NavFn(), setNavArr(), and setupNavFn().
| float nav2_navfn_planner::NavFn::last_path_cost_ |
Holds the cost of the path found the last time A* was called
Definition at line 259 of file navfn.hpp.
Referenced by getLastPathCost(), and propNavFnAstar().
| int nav2_navfn_planner::NavFn::nobs |
number of obstacle cells
Definition at line 174 of file navfn.hpp.
Referenced by propNavFnAstar(), propNavFnDijkstra(), and setupNavFn().
| int nav2_navfn_planner::NavFn::npath |
number of path points
Definition at line 256 of file navfn.hpp.
Referenced by calcPath(), getPathLen(), and NavFn().
| int nav2_navfn_planner::NavFn::npathbuf |
size of pathx, pathy buffers
Definition at line 257 of file navfn.hpp.
Referenced by calcPath(), and NavFn().
| int nav2_navfn_planner::NavFn::ns |
size of grid, in pixels
Definition at line 122 of file navfn.hpp.
Referenced by calcPath(), gradCell(), propNavFnAstar(), propNavFnDijkstra(), setNavArr(), and setupNavFn().
| int * nav2_navfn_planner::NavFn::overP |
priority buffer block ptrs
Definition at line 178 of file navfn.hpp.
Referenced by propNavFnAstar(), propNavFnDijkstra(), and setupNavFn().
| int nav2_navfn_planner::NavFn::overPe |
end points of arrays
Definition at line 179 of file navfn.hpp.
Referenced by propNavFnAstar(), propNavFnDijkstra(), and setupNavFn().
| float nav2_navfn_planner::NavFn::pathStep |
step size for following gradient
Definition at line 275 of file navfn.hpp.
Referenced by calcPath(), and NavFn().
| float * nav2_navfn_planner::NavFn::pathy |
path points, as subpixel cell coordinates
Definition at line 255 of file navfn.hpp.
Referenced by calcPath(), getPathY(), and NavFn().
| int* nav2_navfn_planner::NavFn::pb1 |
block priority buffers
Definition at line 177 of file navfn.hpp.
Referenced by NavFn(), and setupNavFn().
| int * nav2_navfn_planner::NavFn::pb3 |
storage buffers for priority blocks
Definition at line 177 of file navfn.hpp.
Referenced by NavFn(), and setupNavFn().
| bool* nav2_navfn_planner::NavFn::pending |
pending cells during propagation
Definition at line 173 of file navfn.hpp.
Referenced by NavFn(), propNavFnAstar(), propNavFnDijkstra(), setNavArr(), and setupNavFn().
| float* nav2_navfn_planner::NavFn::potarr |
potential array, navigation function potential
Definition at line 172 of file navfn.hpp.
Referenced by calcPath(), gradCell(), initCost(), NavFn(), propNavFnAstar(), propNavFnDijkstra(), setNavArr(), setupNavFn(), updateCell(), and updateCellAstar().
| float nav2_navfn_planner::NavFn::priInc |
priority threshold increment number of cycles between checks for cancellation
Definition at line 183 of file navfn.hpp.
Referenced by NavFn(), propNavFnAstar(), and propNavFnDijkstra().