travel_time_heuristic.cpp
Go to the documentation of this file.
00001 #include <vigir_footstep_planning_default_plugins/heuristics/travel_time_heuristic.h>
00002 
00003 
00004 
00005 namespace vigir_footstep_planning
00006 {
00007 TravelTimeHeuristic::TravelTimeHeuristic()
00008   : HeuristicPlugin("travel_time_heuristic")
00009 {
00010 }
00011 
00012 bool TravelTimeHeuristic::loadParams(const vigir_generic_params::ParameterSet& params)
00013 {
00014   if (!HeuristicPlugin::loadParams(params))
00015     return false;
00016 
00017   params.getParam("max_step_dist/x", max_step_dist_x_inv_);
00018   max_step_dist_x_inv_ = 1.0/max_step_dist_x_inv_;
00019   params.getParam("max_step_dist/y", max_step_dist_y_inv_);
00020   max_step_dist_y_inv_ = 1.0/max_step_dist_y_inv_;
00021 
00022   params.getParam("travel_time_cost_estimator/sway/parabol_a", a_sway_inv_, 0.0);
00023   a_sway_inv_ = 1.0/a_sway_inv_;
00024   params.getParam("travel_time_cost_estimator/sway/parabol_b", b_sway_inv_, 0.0);
00025   b_sway_inv_ = 1.0/b_sway_inv_;
00026   params.getParam("travel_time_cost_estimator/sway/const_time", const_sway_time_, 0.0);
00027 
00028   params.getParam("travel_time_cost_estimator/swing/parabol_a", a_swing_inv_, 0.0);
00029   a_swing_inv_ = 1.0/a_swing_inv_;
00030   params.getParam("travel_time_cost_estimator/swing/parabol_b", b_swing_inv_, 0.0);
00031   b_swing_inv_ = 1.0/b_swing_inv_;
00032   params.getParam("travel_time_cost_estimator/swing/const_time", const_swing_time_, 0.0);
00033 
00034   return true;
00035 }
00036 
00037 double TravelTimeHeuristic::getHeuristicValue(const State& from, const State& to, const State& /*start*/, const State& /*goal*/) const
00038 {
00039   if (from == to)
00040     return 0.0;
00041 
00042   // expected steps
00043   tf::Transform step = from.getPose().inverse() * to.getPose();
00044   double expected_steps_x = std::abs(step.getOrigin().x()) * max_step_dist_x_inv_;
00045   double expected_steps_y = std::abs(step.getOrigin().y()) * max_step_dist_y_inv_;
00046   double expected_steps = std::max(expected_steps_x, expected_steps_y);
00047 
00048 
00049   //double sway_duration = parabol(sway.getOrigin().x(), sway.getOrigin().y(), a_sway_inv, b_sway_inv) + const_sway_time;
00050   double step_duration = parabol(step.getOrigin().x()/expected_steps, step.getOrigin().y()/expected_steps, a_swing_inv_, b_swing_inv_) + const_swing_time_;
00051 
00052   //ROS_INFO_THROTTLE(1.0, "%f %f, ETA: %f", expected_steps_x, expected_steps_y, expected_steps * min_duration_per_step);
00053 
00054   //double expected_steps = euclidean_distance(from.getX(), from.getY(), from.getZ(), to.getX(), to.getY(), to.getZ()) * max_step_dist_x_inv;
00055 
00056   return expected_steps * (step_duration + const_sway_time_);
00057 }
00058 }
00059 
00060 #include <pluginlib/class_list_macros.h>
00061 PLUGINLIB_EXPORT_CLASS(vigir_footstep_planning::TravelTimeHeuristic, vigir_footstep_planning::HeuristicPlugin)


vigir_footstep_planning_default_plugins
Author(s): Alexander Stumpf
autogenerated on Fri Apr 7 2017 02:59:40