step_cost_heuristic.cpp
Go to the documentation of this file.
2 
3 
4 
6 {
8  : HeuristicPlugin("step_cost_heuristic")
9 {
10 }
11 
12 bool StepCostHeuristic::loadParams(const vigir_generic_params::ParameterSet& params)
13 {
14  if (!HeuristicPlugin::loadParams(params))
15  return false;
16 
17  params.getParam("const_step_cost_estimator/step_cost", step_cost_, 0.1);
18  params.getParam("diff_angle_cost", diff_angle_cost_);
19  params.getParam("max_step_dist/x", max_step_dist_x_inv_);
21  params.getParam("max_step_dist/y", max_step_dist_y_inv_);
23  return true;
24 }
25 
26 double StepCostHeuristic::getHeuristicValue(const State& from, const State& to, const State& /*start*/, const State& /*goal*/) const
27 {
28  if (from == to)
29  return 0.0;
30 
31  double expected_steps = 0.0;
32 
33  if (step_cost_ > 0.0)
34  {
35  // expected steps
36  tf::Transform dstep;
37  getDeltaStep(from.getPose(), to.getPose(), dstep);
38  double expected_steps_x = std::abs(dstep.getOrigin().x()) * max_step_dist_x_inv_;
39  double expected_steps_y = std::abs(dstep.getOrigin().y()) * max_step_dist_y_inv_;
40  expected_steps = sqrt(expected_steps_x*expected_steps_x + expected_steps_y*expected_steps_y);
41  }
42 
43  double diff_angle = 0.0;
44  if (diff_angle_cost_ > 0.0)
45  diff_angle = std::abs(angles::shortest_angular_distance(to.getYaw(), from.getYaw()));
46 
47 // ROS_WARN("-------------------------------");
48 // ROS_INFO("x: %f %f %f", step.getOrigin().x(), ivMaxStepDistX, std::abs(step.getOrigin().x()) / ivMaxStepDistX);
49 // ROS_INFO("y: %f %f %f", step.getOrigin().y(), ivMaxStepDistY, std::abs(step.getOrigin().y()) / ivMaxStepDistY);
50 // ROS_INFO("steps: %f, dist: %f, cost: %f", expected_steps, dist, (dist + expected_steps * ivStepCost + diff_angle * ivDiffAngleCost));
51 
52  return expected_steps * step_cost_ + diff_angle * diff_angle_cost_;
53 }
54 }
55 
56 #include <pluginlib/class_list_macros.h>
57 PLUGINLIB_EXPORT_CLASS(vigir_footstep_planning::StepCostHeuristic, vigir_footstep_planning::HeuristicPlugin)
double getHeuristicValue(const State &from, const State &to, const State &start, const State &goal) const override
bool loadParams(const vigir_generic_params::ParameterSet &params=vigir_generic_params::ParameterSet()) override
Determining the heuristic value by the euclidean distance between two states, the expected step costs...


vigir_footstep_planning_default_plugins
Author(s): Alexander Stumpf
autogenerated on Sun Nov 17 2019 03:30:01