|
TinyRobotics
|
Generic Dijkstra shortest path algorithm for graphs/maps with callback-based cost and validity. More...
#include <Dijkstra.h>
Public Types | |
| using | CostCallback = std::function< float(const Coordinate< T > &, const Coordinate< T > &, void *ref)> |
| using | ValidCallback = std::function< bool(const Coordinate< T > &, void *ref)> |
Public Member Functions | |
| void | setCostCallback (CostCallback cb) |
| void | setValidCallback (ValidCallback cb) |
| provide a callback to determine if a node is valid (e.g., not an obstacle) | |
| void | setReference (void *reference) |
| Path< Coordinate< T > > | findPath (const IMapNeighbors< T > &map, const Coordinate< T > &start, const Coordinate< T > &goal) |
| Finds the shortest path from start to goal. | |
Static Protected Member Functions | |
| static float | defaultCost (const Coordinate< T > &from, const Coordinate< T > &to, void *ref) |
| static bool | defaultValid (const Coordinate< T > &node, void *ref) |
Protected Attributes | |
| CostCallback | cost_cb = defaultCost |
| ValidCallback | valid_cb = defaultValid |
| void * | ref = this |
Generic Dijkstra shortest path algorithm for graphs/maps with callback-based cost and validity.
| MapType | Must provide:
|
|
inline |
Finds the shortest path from start to goal.
| start | The starting node. |
| goal | The goal node. |
|
inline |
provide a callback to determine the cost of moving from one node to another
|
inline |
provide reference for callbacks (e.g., to access map data or other context)