Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030 #ifndef VIGIR_FOOTSTEP_PLANNING_FOOTSTEP_PLANNER_ENVIRONMENT_H__
00031 #define VIGIR_FOOTSTEP_PLANNING_FOOTSTEP_PLANNER_ENVIRONMENT_H__
00032
00033 #include <math.h>
00034
00035 #include <vector>
00036
00037 #include <boost/function.hpp>
00038
00039 #include <sbpl/headers.h>
00040
00041 #include <vigir_pluginlib/plugin_manager.h>
00042
00043 #include <vigir_foot_pose_transformer/foot_pose_transformer.h>
00044
00045 #include <vigir_footstep_planning_lib/helper.h>
00046
00047 #include <vigir_footstep_planning_plugins/plugin_aggregators/world_model.h>
00048 #include <vigir_footstep_planning_plugins/plugin_aggregators/step_cost_estimator.h>
00049 #include <vigir_footstep_planning_plugins/plugin_aggregators/heuristic.h>
00050
00051 #include <vigir_footstep_planner/environment_parameters.h>
00052 #include <vigir_footstep_planner/state_space/state_space.h>
00053
00054
00055
00056 namespace vigir_footstep_planning
00057 {
00065 class FootstepPlannerEnvironment
00066 : public DiscreteSpaceInformation
00067 {
00068 public:
00069 FootstepPlannerEnvironment(const EnvironmentParameters& params, const FootPoseTransformer& foot_pose_transformer, boost::function<void (msgs::PlanningFeedback)>& feedback_cb);
00070
00071 virtual ~FootstepPlannerEnvironment();
00072
00073 void setFrameId(const std::string& frame_id);
00074
00075 const StateSpace::Ptr& getStateSpace() { return state_space; }
00076
00078 int getNumExpandedStates() { return ivNumExpandedStates; }
00079
00084 void reset();
00085
00086 void stateExpanded(const PlanningState& s);
00087 void stateVisited(const PlanningState& s);
00088
00089 exp_states_2d_iter_t getExpandedStatesStart()
00090 {
00091 return ivExpandedStates.begin();
00092 }
00093
00094 exp_states_2d_iter_t getExpandedStatesEnd()
00095 {
00096 return ivExpandedStates.end();
00097 }
00098
00103 int GetFromToHeuristic(int FromStateID, int ToStateID);
00104
00109 int GetGoalHeuristic(int stateID);
00110
00115 int GetStartHeuristic(int stateID);
00116
00122 void GetSuccs(int SourceStateID, std::vector<int> *SuccIDV, std::vector<int> *CostV);
00123
00129 void GetPreds(int TargetStateID, std::vector<int> *PredIDV, std::vector<int> *CostV);
00130
00136 virtual void GetRandomSuccsatDistance(int SourceStateID,
00137 std::vector<int>* SuccIDV,
00138 std::vector<int>* CLowV);
00139
00145 virtual void GetRandomPredsatDistance(int TargetStateID,
00146 std::vector<int>* PredIDV,
00147 std::vector<int>* CLowV);
00148
00150 bool AreEquivalent(int StateID1, int StateID2);
00151
00152 bool InitializeEnv(const char *sEnvFile);
00153
00154 bool InitializeMDPCfg(MDPConfig *MDPCfg);
00155
00156 void PrintEnv_Config(FILE *fOut);
00157
00158 void PrintState(int stateID, bool bVerbose, FILE *fOut);
00159
00160 void SetAllActionsandAllOutcomes(CMDPSTATE *state);
00161
00162 void SetAllPreds(CMDPSTATE *state);
00163
00164 int SizeofCreatedEnv();
00165
00171 void updateHeuristicValues();
00172
00173 protected:
00178 int GetFromToHeuristic(const PlanningState& from, const PlanningState& to, const PlanningState& start, const PlanningState& goal);
00179
00181 struct less
00182 {
00183 bool operator()(const PlanningState* a, const PlanningState* b) const;
00184 };
00185
00186 StateSpace::Ptr state_space;
00187
00188
00189 const FootPoseTransformer& foot_pose_transformer;
00190
00191
00192 boost::function<void (msgs::PlanningFeedback)>& feedback_cb;
00193
00195 const EnvironmentParameters& params;
00196
00197 exp_states_2d_t ivExpandedStates;
00198 size_t ivNumExpandedStates;
00199
00200 std::string frame_id;
00201 std::vector<msgs::Step> visited_steps;
00202 ros::Time last_feedback_flush;
00203 };
00204 }
00205
00206 #endif