step_cost_estimator.cpp
Go to the documentation of this file.
2 
3 
4 
6 {
9 {
10 }
11 
12 bool StepCostEstimator::loadParams(const vigir_generic_params::ParameterSet& params)
13 {
15  return false;
16 
17  params.getParam("max_risk", max_risk_, 1.0);
18 
19  return true;
20 }
21 
22 bool StepCostEstimator::getCost(const State& left_foot, const State& right_foot, const State& swing_foot, double& cost, double& risk) const
23 {
24  cost = 0.0;
25  double cost_multiplier = 1.0;
26  risk = 0.0;
27  double risk_multiplier = 1.0;
28 
29  //ROS_INFO("-----------------------------------");
31  {
32  if (!plugin)
33  continue;
34 
35  double c, c_m, r, r_m;
36  if (plugin->getCost(left_foot, right_foot, swing_foot, c, c_m, r, r_m))
37  {
38  cost += c;
39  cost_multiplier *= c_m;
40  risk += r;
41  risk_multiplier *= r_m;
42  //ROS_INFO("[%s]: %.3f %.3f %.3f %.3f", step_cost_estimator->getName().c_str(), c, r, c_m, r_m);
43  }
44  else
45  return false;
46  }
47 
48  cost *= cost_multiplier;
49  risk *= risk_multiplier;
50 
51  return risk < max_risk_;
52 }
53 
54 bool StepCostEstimator::getCost(const State& left_foot, const State& right_foot, const State& swing_foot, float& cost, float& risk) const
55 {
56  double cost_d, risk_d;
57  bool result = getCost(left_foot, right_foot, swing_foot, cost_d, risk_d);
58  cost = static_cast<float>(cost_d);
59  risk = static_cast<float>(risk_d);
60  return result;
61 }
62 }
bool getCost(const State &left_foot, const State &right_foot, const State &swing_foot, double &cost, double &risk) const
ROSLIB_DECL void getPlugins(const std::string &package, const std::string &attribute, V_string &plugins, bool force_recrawl=false)
bool loadParams(const vigir_generic_params::ParameterSet &params) override


vigir_footstep_planning_plugins
Author(s): Alexander Stumpf
autogenerated on Mon Jun 10 2019 15:47:39