39 #ifndef NAV2_NAVFN_PLANNER__NAVFN_HPP_
40 #define NAV2_NAVFN_PLANNER__NAVFN_HPP_
48 namespace nav2_navfn_planner
52 #define COST_UNKNOWN_ROS 255
54 #define COST_OBS_ROS 253
66 #define COST_NEUTRAL 50
67 #define COST_FACTOR 0.8
73 #define COSTTYPE unsigned char
77 #define POT_HIGH 1.0e10
80 #define PRIORITYBUFSIZE 10000
94 int create_nav_plan_astar(
95 const COSTTYPE * costmap,
int nx,
int ny,
96 int * goal,
int * start,
97 float * plan,
int nplan);
112 NavFn(
int nx,
int ny);
131 void setCostmap(
const COSTTYPE * cmap,
bool isROS =
true,
bool allow_unknown =
true);
144 bool calcNavFnDijkstra(std::function<
bool()> cancelChecker,
bool atStart =
false);
186 static constexpr
int terminal_checking_interval = 5000;
242 bool propNavFnDijkstra(
int cycles, std::function<
bool()> cancelChecker,
bool atStart =
false);
251 bool propNavFnAstar(
int cycles, std::function<
bool()> cancelChecker);
266 int calcPath(
int n,
int * st = NULL);
Navigation function class. Holds buffers for costmap, navfn map. Maps are pixel-based....
int getPathLen()
Accessor for the length of a path.
float * getPathX()
Accessor for the x-coordinates of a path.
bool calcNavFnAstar(std::function< bool()> cancelChecker)
Calculates a plan using the A* heuristic, returns true if one is found.
float gradCell(int n)
Calculate gradient at a cell.
void updateCell(int n)
Updates the cell at index n.
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 metho...
int calcPath(int n, int *st=NULL)
Calculates the path for at most <n> cycles.
float getLastPathCost()
Gets the cost of the path found the last time a navigation function was computed.
bool calcNavFnDijkstra(std::function< bool()> cancelChecker, bool atStart=false)
Calculates the full navigation function using Dijkstra.
bool propNavFnAstar(int cycles, std::function< bool()> cancelChecker)
Run propagation for <cycles> iterations, or until start is reached using the best-first A* method wit...
void updateCellAstar(int n)
Updates the cell at index n using the A* heuristic.
void initCost(int k, float v)
Initialize cell k with cost v for propagation.
void setNavArr(int nx, int ny)
Sets or resets the size of the map.
NavFn(int nx, int ny)
Constructs the planner.
void setCostmap(const COSTTYPE *cmap, bool isROS=true, bool allow_unknown=true)
Set up the cost array for the planner, usually from ROS.
void setupNavFn(bool keepit=false)
Set up navigation potential arrays for new propagation.
void setGoal(int *goal)
Sets the goal position for the planner. Note: the navigation cost field computed gives the cost to ge...
float * getPathY()
Accessor for the y-coordinates of a path.
void setStart(int *start)
Sets the start position for the planner. Note: the navigation cost field computed gives the cost to g...