MRSL JPS3D Library  1.1
An implementaion of Jump Point Search on 3D voxel map
Public Member Functions | Private Member Functions | Private Attributes | List of all members
DMP::GraphSearch Class Reference

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_
 

Detailed Description

GraphSearch class.

Implement A* and Jump Point Search

Constructor & Destructor Documentation

◆ GraphSearch() [1/2]

GraphSearch::GraphSearch ( const int8_t *  cMap,
int  xDim,
int  yDim,
double  eps = 1,
double  cweight = 0.1,
bool  verbose = false 
)

2D graph search constructor

Parameters
cMap1D array stores the occupancy, with the order equal to $x + xDim * y$
xDimmap length
yDimmap width
epsweight of heuristic, optional, default as 1
cweightweight of distance cost, optional, default as 0.1
verboseflag for printing debug info, optional, default as false

◆ GraphSearch() [2/2]

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

Parameters
cMap1D array stores the occupancy, with the order equal to $x + xDim * y + xDim * yDim * z$
xDimmap length
yDimmap width
zDimmap height
epsweight of heuristic, optional, default as 1
cweightweight of distance cost, optional, default as 0.1
verboseflag for printing debug info, optional, default as False

Member Function Documentation

◆ plan() [1/2]

double GraphSearch::plan ( int  xStart,
int  yStart,
int  xGoal,
int  yGoal,
std::vector< bool >  in_region = std::vector<bool>() 
)

start 2D planning thread

Parameters
xStartstart x coordinate
yStartstart y coordinate
xGoalgoal x coordinate
yGoalgoal y coordinate
in_regiona region that is valid for searching, empty means no boundary

return the total path cost, which is infinity if failed

◆ plan() [2/2]

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

Parameters
xStartstart x coordinate
yStartstart y coordinate
zStartstart z coordinate
xGoalgoal x coordinate
yGoalgoal y coordinate
zGoalgoal z coordinate
in_regiona region that is valid for searching, empty means no boundary

return the total path cost, which is infinity if failed


The documentation for this class was generated from the following files: