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
JPS::GraphSearch Class Reference

GraphSearch class. More...

#include <graph_search.h>

Public Member Functions

 GraphSearch (const char *cMap, int xDim, int yDim, double eps=1, bool verbose=false)
 2D graph search constructor More...
 
 GraphSearch (const char *cMap, int xDim, int yDim, int zDim, double eps=1, bool verbose=false)
 3D graph search constructor More...
 
bool plan (int xStart, int yStart, int xGoal, int yGoal, bool useJps, int maxExpand=-1)
 start 2D planning thread More...
 
bool plan (int xStart, int yStart, int zStart, int xGoal, int yGoal, int zGoal, bool useJps, int maxExpand=-1)
 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

bool plan (StatePtr &currNode_ptr, int max_expand, 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*.
 
void getJpsSucc (const StatePtr &curr, std::vector< int > &succ_ids, std::vector< double > &succ_costs)
 Get successor function for JPS.
 
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.
 
bool isOccupied (int x, int y) const
 Check if (x, y) is occupied.
 
bool isOccupied (int x, int y, int z) const
 Check if (x, y, z) is occupied.
 
double getHeur (int x, int y) const
 Clculate heuristic.
 
double getHeur (int x, int y, int z) const
 Clculate heuristic.
 
bool hasForced (int x, int y, int dx, int dy)
 Determine if (x, y) has forced neighbor with direction (dx, dy)
 
bool hasForced (int x, int y, int z, int dx, int dy, int dz)
 Determine if (x, y, z) has forced neighbor with direction (dx, dy, dz)
 
bool jump (int x, int y, int dx, int dy, int &new_x, int &new_y)
 2D jump, return true iff finding the goal or a jump point
 
bool jump (int x, int y, int z, int dx, int dy, int dz, int &new_x, int &new_y, int &new_z)
 3D jump, return true iff finding the goal or a jump point
 
void init2DJps ()
 Initialize 2D jps arrays.
 

Private Attributes

const char * cMap_
 
int xDim_
 
int yDim_
 
int zDim_
 
double eps_
 
bool verbose_
 
const char val_free_ = 0
 
int xGoal_
 
int yGoal_
 
int zGoal_
 
bool use_2d_
 
bool use_jps_ = false
 
priorityQueue pq_
 
std::vector< StatePtr > hm_
 
std::vector< bool > seen_
 
std::vector< StatePtr > path_
 
std::vector< std::vector< int > > ns_
 
std::shared_ptr< JPS2DNeibjn2d_
 
std::shared_ptr< JPS3DNeibjn3d_
 

Detailed Description

GraphSearch class.

Implement A* and Jump Point Search

Constructor & Destructor Documentation

◆ GraphSearch() [1/2]

GraphSearch::GraphSearch ( const char *  cMap,
int  xDim,
int  yDim,
double  eps = 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
verboseflag for printing debug info, optional, default as false

◆ GraphSearch() [2/2]

GraphSearch::GraphSearch ( const char *  cMap,
int  xDim,
int  yDim,
int  zDim,
double  eps = 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
verboseflag for printing debug info, optional, default as False

Member Function Documentation

◆ plan() [1/2]

bool GraphSearch::plan ( int  xStart,
int  yStart,
int  xGoal,
int  yGoal,
bool  useJps,
int  maxExpand = -1 
)

start 2D planning thread

Parameters
xStartstart x coordinate
yStartstart y coordinate
xGoalgoal x coordinate
yGoalgoal y coordinate
useJpsif true, enable JPS search; else the planner is implementing A*
maxExpandmaximum number of expansion allowed, optional, default is -1, means no limitation

◆ plan() [2/2]

bool GraphSearch::plan ( int  xStart,
int  yStart,
int  zStart,
int  xGoal,
int  yGoal,
int  zGoal,
bool  useJps,
int  maxExpand = -1 
)

start 3D planning thread

Parameters
xStartstart x coordinate
yStartstart y coordinate
zStartstart z coordinate
xGoalgoal x coordinate
yGoalgoal y coordinate
zGoalgoal z coordinate
useJpsif true, enable JPS search; else the planner is implementing A*
maxExpandmaximum number of expansion allowed, optional, default is -1, means no limitation

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