footstep_planner_environment.h
Go to the documentation of this file.
1 //=================================================================================================
2 // Copyright (c) 2018, Alexander Stumpf, TU Darmstadt
3 // Based on http://wiki.ros.org/footstep_planner by Johannes Garimort and Armin Hornung
4 // All rights reserved.
5 
6 // Redistribution and use in source and binary forms, with or without
7 // modification, are permitted provided that the following conditions are met:
8 // * Redistributions of source code must retain the above copyright
9 // notice, this list of conditions and the following disclaimer.
10 // * Redistributions in binary form must reproduce the above copyright
11 // notice, this list of conditions and the following disclaimer in the
12 // documentation and/or other materials provided with the distribution.
13 // * Neither the name of the Simulation, Systems Optimization and Robotics
14 // group, TU Darmstadt nor the names of its contributors may be used to
15 // endorse or promote products derived from this software without
16 // specific prior written permission.
17 
18 // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
19 // ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
20 // WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
21 // DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER BE LIABLE FOR ANY
22 // DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
23 // (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
24 // LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
25 // ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
26 // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
27 // SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
28 //=================================================================================================
29 
30 #ifndef VIGIR_FOOTSTEP_PLANNING_FOOTSTEP_PLANNER_ENVIRONMENT_H__
31 #define VIGIR_FOOTSTEP_PLANNING_FOOTSTEP_PLANNER_ENVIRONMENT_H__
32 
33 #include <math.h>
34 
35 #include <vector>
36 
37 #include <boost/function.hpp>
38 
39 #include <sbpl/headers.h>
40 
41 #include <vigir_pluginlib/plugin_manager.h>
42 
44 
45 #include <vigir_footstep_planning_lib/helper.h>
46 
47 #include <vigir_footstep_planning_plugins/plugin_aggregators/world_model.h>
48 #include <vigir_footstep_planning_plugins/plugin_aggregators/step_cost_estimator.h>
49 #include <vigir_footstep_planning_plugins/plugin_aggregators/heuristic.h>
50 
53 
54 
55 
57 {
66  : public DiscreteSpaceInformation
67 {
68 public:
69  FootstepPlannerEnvironment(const EnvironmentParameters& params, const FootPoseTransformer& foot_pose_transformer, boost::function<void (msgs::PlanningFeedback)>& feedback_cb);
70 
72 
73  void setFrameId(const std::string& frame_id);
74 
76 
79 
84  void reset();
85 
86  void stateExpanded(const PlanningState& s);
87  void stateVisited(const PlanningState& s);
88 
90  {
91  return ivExpandedStates.begin();
92  }
93 
95  {
96  return ivExpandedStates.end();
97  }
98 
103  int GetFromToHeuristic(int FromStateID, int ToStateID);
104 
109  int GetGoalHeuristic(int stateID);
110 
115  int GetStartHeuristic(int stateID);
116 
122  void GetSuccs(int SourceStateID, std::vector<int> *SuccIDV, std::vector<int> *CostV);
123 
129  void GetPreds(int TargetStateID, std::vector<int> *PredIDV, std::vector<int> *CostV);
130 
136  virtual void GetRandomSuccsatDistance(int SourceStateID,
137  std::vector<int>* SuccIDV,
138  std::vector<int>* CLowV);
139 
145  virtual void GetRandomPredsatDistance(int TargetStateID,
146  std::vector<int>* PredIDV,
147  std::vector<int>* CLowV);
148 
150  bool AreEquivalent(int StateID1, int StateID2);
151 
152  bool InitializeEnv(const char *sEnvFile);
153 
154  bool InitializeMDPCfg(MDPConfig *MDPCfg);
155 
156  void PrintEnv_Config(FILE *fOut);
157 
158  void PrintState(int stateID, bool bVerbose, FILE *fOut);
159 
160  void SetAllActionsandAllOutcomes(CMDPSTATE *state);
161 
162  void SetAllPreds(CMDPSTATE *state);
163 
164  int SizeofCreatedEnv();
165 
171  void updateHeuristicValues();
172 
173 protected:
178  int GetFromToHeuristic(const PlanningState& from, const PlanningState& to, const PlanningState& start, const PlanningState& goal);
179 
181  struct less
182  {
183  bool operator()(const PlanningState* a, const PlanningState* b) const;
184  };
185 
187 
188  // local instance of foot pose transformer
190 
191  // feedback callback
192  boost::function<void (msgs::PlanningFeedback)>& feedback_cb;
193 
196 
199 
200  std::string frame_id;
201  std::vector<msgs::Step> visited_steps;
203 };
204 }
205 
206 #endif
void updateHeuristicValues()
Update the heuristic values (e.g. after the map has changed). The environment takes care that the upd...
void reset()
Resets the current planning task (i.e. the start and goal poses).
void GetSuccs(int SourceStateID, std::vector< int > *SuccIDV, std::vector< int > *CostV)
Calculates the successor states and the corresponding costs when performing the footstep set on the p...
XmlRpcServer s
bool operator()(const PlanningState *a, const PlanningState *b) const
virtual void GetRandomPredsatDistance(int TargetStateID, std::vector< int > *PredIDV, std::vector< int > *CLowV)
Used for RStar: generate succs/preds at some domain-dependent distance. The number of generated succs...
boost::function< void(msgs::PlanningFeedback)> & feedback_cb
exp_states_2d_t::const_iterator exp_states_2d_iter_t
Definition: state_space.h:78
A class defining a footstep planner environment for humanoid robots used by the SBPL to perform plann...
void GetPreds(int TargetStateID, std::vector< int > *PredIDV, std::vector< int > *CostV)
Calculates the predecessor states and the corresponding costs when reversing the footstep set on the ...
virtual void GetRandomSuccsatDistance(int SourceStateID, std::vector< int > *SuccIDV, std::vector< int > *CLowV)
Used for RStar: generate succs/preds at some domain-dependent distance. The number of generated succs...
void PrintState(int stateID, bool bVerbose, FILE *fOut)
FootstepPlannerEnvironment(const EnvironmentParameters &params, const FootPoseTransformer &foot_pose_transformer, boost::function< void(msgs::PlanningFeedback)> &feedback_cb)
std::tr1::unordered_set< std::pair< int, int >, IntPairHash > exp_states_2d_t
Definition: state_space.h:77


vigir_footstep_planner
Author(s): Alexander Stumpf
autogenerated on Sun Nov 17 2019 03:29:59