MRSL JPS3D Library
1.1
An implementaion of Jump Point Search on 3D voxel map
|
GraphSearch class. More...
#include <graph_search.h>
Public Member Functions | |
GraphSearch (const int8_t *cMap, int xDim, int yDim, double eps=1, double cweight=0.1, bool verbose=false) | |
2D graph search constructor More... | |
GraphSearch (const int8_t *cMap, int xDim, int yDim, int zDim, double eps=1, double cweight=0.1, bool verbose=false) | |
3D graph search constructor More... | |
double | plan (int xStart, int yStart, int xGoal, int yGoal, std::vector< bool > in_region=std::vector< bool >()) |
start 2D planning thread More... | |
double | plan (int xStart, int yStart, int zStart, int xGoal, int yGoal, int zGoal, std::vector< bool > in_region=std::vector< bool >()) |
start 3D planning thread More... | |
std::vector< StatePtr > | getPath () const |
Get the optimal path. | |
std::vector< StatePtr > | getOpenSet () const |
Get the states in open set. | |
std::vector< StatePtr > | getCloseSet () const |
Get the states in close set. | |
std::vector< StatePtr > | getAllSet () const |
Get the states in hash map. | |
Private Member Functions | |
double | plan (StatePtr &currNode_ptr, int start_id, int goal_id) |
Main planning loop. | |
void | getSucc (const StatePtr &curr, std::vector< int > &succ_ids, std::vector< double > &succ_costs) |
Get successor function for A*. | |
std::vector< StatePtr > | recoverPath (StatePtr node, int id) |
Recover the optimal path. | |
int | coordToId (int x, int y) const |
Get subscript. | |
int | coordToId (int x, int y, int z) const |
Get subscript. | |
bool | isFree (int x, int y) const |
Check if (x, y) is free. | |
bool | isFree (int x, int y, int z) const |
Check if (x, y, z) is free. | |
double | getHeur (int x, int y) const |
Clculate heuristic. | |
double | getHeur (int x, int y, int z) const |
Clculate heuristic. | |
Private Attributes | |
const int8_t * | cMap_ |
int | xDim_ |
int | yDim_ |
int | zDim_ |
double | eps_ |
weight of heuristic | |
double | cweight_ |
weight of distance map | |
bool | verbose_ |
const int8_t | val_free_ = 0 |
const int8_t | val_occ_ = 100 |
int | xGoal_ |
int | yGoal_ |
int | zGoal_ |
bool | use_2d_ |
bool | global_ |
priorityQueue | pq_ |
std::vector< StatePtr > | hm_ |
std::vector< bool > | seen_ |
std::vector< bool > | in_region_ |
std::vector< StatePtr > | path_ |
std::vector< std::vector< int > > | ns_ |
GraphSearch class.
Implement A* and Jump Point Search
GraphSearch::GraphSearch | ( | const int8_t * | cMap, |
int | xDim, | ||
int | yDim, | ||
double | eps = 1 , |
||
double | cweight = 0.1 , |
||
bool | verbose = false |
||
) |
2D graph search constructor
cMap | 1D array stores the occupancy, with the order equal to ![]() |
xDim | map length |
yDim | map width |
eps | weight of heuristic, optional, default as 1 |
cweight | weight of distance cost, optional, default as 0.1 |
verbose | flag for printing debug info, optional, default as false |
GraphSearch::GraphSearch | ( | const int8_t * | cMap, |
int | xDim, | ||
int | yDim, | ||
int | zDim, | ||
double | eps = 1 , |
||
double | cweight = 0.1 , |
||
bool | verbose = false |
||
) |
3D graph search constructor
cMap | 1D array stores the occupancy, with the order equal to ![]() |
xDim | map length |
yDim | map width |
zDim | map height |
eps | weight of heuristic, optional, default as 1 |
cweight | weight of distance cost, optional, default as 0.1 |
verbose | flag for printing debug info, optional, default as False |
double GraphSearch::plan | ( | int | xStart, |
int | yStart, | ||
int | xGoal, | ||
int | yGoal, | ||
std::vector< bool > | in_region = std::vector<bool>() |
||
) |
start 2D planning thread
xStart | start x coordinate |
yStart | start y coordinate |
xGoal | goal x coordinate |
yGoal | goal y coordinate |
in_region | a region that is valid for searching, empty means no boundary |
return the total path cost, which is infinity if failed
double GraphSearch::plan | ( | int | xStart, |
int | yStart, | ||
int | zStart, | ||
int | xGoal, | ||
int | yGoal, | ||
int | zGoal, | ||
std::vector< bool > | in_region = std::vector<bool>() |
||
) |
start 3D planning thread
xStart | start x coordinate |
yStart | start y coordinate |
zStart | start z coordinate |
xGoal | goal x coordinate |
yGoal | goal y coordinate |
zGoal | goal z coordinate |
in_region | a region that is valid for searching, empty means no boundary |
return the total path cost, which is infinity if failed