expand_state_job.cpp
Go to the documentation of this file.
2 
3 #include <vigir_footstep_planning_plugins/plugin_aggregators/robot_model.h>
4 #include <vigir_footstep_planning_plugins/plugin_aggregators/world_model.h>
5 #include <vigir_footstep_planning_plugins/plugin_aggregators/step_cost_estimator.h>
6 #include <vigir_footstep_planning_plugins/plugin_aggregators/post_processor.h>
7 
8 
9 
11 {
12 namespace threading
13 {
14 ExpandStateJob::ExpandStateJob(const Footstep& footstep, const PlanningState& state)
15  : successful(false)
16  , footstep_(footstep)
17  , state_(state)
18 {
19 }
20 
22 {
23 }
24 
26 {
27  successful = false;
28 
30  if (state_.getPredState() == nullptr)
31  return;
32 
33  next.reset(new PlanningState(footstep_.performMeOnThisState(state_)));
34  State& new_state = next->getState();
35 
36  if (*(state_.getPredState()) == *next)
37  return;
38 
39  const State& left_foot = state_.getLeg() == LEFT ? state_.getState() : state_.getPredState()->getState();
40  const State& right_foot = state_.getLeg() == RIGHT ? state_.getState() : state_.getPredState()->getState();
41 
42  // update 3D pose based on world data
43  WorldModel::instance().update3DData(new_state);
44 
45  // apply post processing steps
46  PostProcessor::instance().postProcessForward(left_foot, right_foot, new_state);
47  //PostProcessor::instance().postProcessBackward(left_foot, right_foot, next_state);
48 
49  // check reachability due to discretization
50  if (!RobotModel::instance().isReachable(left_foot, right_foot, new_state))
51  return;
52 
53  // collision check
54  if (!WorldModel::instance().isAccessible(new_state, state_.getState()))
55  return;
56 
57  // lookup costs
58  double cost, risk;
59  if (!StepCostEstimator::instance().getCost(left_foot, right_foot, new_state, cost, risk))
60  return;
61 
62  cost += footstep_.getStepCost();
63 
64  new_state.setCost(cost);
65  new_state.setRisk(risk);
66  successful = true;
67 }
68 }
69 }
ExpandStateJob(const Footstep &footstep_, const PlanningState &state_)


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