3 #include <pluginlib/class_list_macros.h> 10 : HeuristicPlugin(
"path_cost_heuristic")
25 if (!HeuristicPlugin::loadParams(params))
28 params.getParam(
"collision_check/cell_size",
ivCellSize);
32 params.getParam(
"const_step_cost_estimator/step_cost",
ivStepCost, 0.1);
65 if ((
unsigned int)
ivGoalX != to_x || (
unsigned int)
ivGoalY != to_y)
67 ROS_ERROR(
"PathCostHeuristic::getHValue to a different value than " 68 "precomputed, heuristic values will be wrong. You need to call " 69 "calculateDistances() before!");
71 assert((
unsigned int)
ivGoalX == to_x && (
unsigned int)
ivGoalY == to_y);
73 double dist = double(
ivGridSearchPtr->getlowerboundoncostfromstart_inmm(from_x, from_y)) / 1000.0;
76 double diff_angle = 0.0;
78 diff_angle = std::abs(angles::shortest_angular_distance(to.getYaw(), from.getYaw()));
105 SBPL_2DGRIDSEARCH_TERM_CONDITION_ALLCELLS);
118 unsigned width =
ivMapPtr->getInfo().width;
119 unsigned height =
ivMapPtr->getInfo().height;
127 ivpGrid =
new unsigned char* [width];
129 for (
unsigned x = 0; x < width; ++x)
130 ivpGrid[x] =
new unsigned char [height];
131 for (
unsigned y = 0; y < height; ++y)
133 for (
unsigned x = 0; x < width; ++x)
135 float dist =
ivMapPtr->distanceMapAtCell(x,y);
137 ROS_ERROR(
"Distance map at %d %d out of bounds", x, y);
149 for (
int x = 0; x < size.width; ++x)