VPPlanner.h
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 __VIEW_POINT_PLANNER_
00031 #define __VIEW_POINT_PLANNER_
00032
00036
00038
00039
00040 #ifdef MIP_HOST_APPLE
00041 #include <applePatch.h>
00042 #endif
00043
00044 #include <fstream>
00045 #include <iostream>
00046
00047 #include <vector>
00048 #include <Spaces.h>
00049 #include <assert.h>
00050 #include <math.h>
00051 #include <Scan.h>
00052
00053 #include <algorithm>
00054
00055 #include <Types.h>
00056
00057 #include <Grid.h>
00058
00059 using namespace std;
00060 using namespace MipBaselib;
00061
00063 enum VPPlanners{
00064 FRONTIER_BASED,
00065 RAND_FRONTIER_BASED,
00066 ORTHOGONAL_IG,
00067 LANDSCAPING_IG,
00068 GOAL_BASED,
00069 VP_PLANNERS_NUM
00070 };
00071
00073 static const char* VPPlannersNames[VP_PLANNERS_NUM] = {
00074 "Frontier Based",
00075 "Random Frontier Based",
00076 "Orthogonal Information Gain",
00077 "Landscaping Information Gain",
00078 "Goal Based"
00079 };
00080
00087 class VPPlanner{
00088 private:
00089 VPPlanners _type;
00090 Pose _nextVP;
00091 Position _goal;
00092 public:
00093
00094 VPPlanner(){};
00095
00096
00097 VPPlanner(VPPlanners type){
00098 setType(type);
00099 }
00100
00101 virtual bool findNextVP(Grid* grid)=0;
00102
00103 void setNextVP(Pose nextVP){
00104 _nextVP=nextVP;
00105
00106 }
00107
00108 void setType(VPPlanners type){
00109 _type=type;
00110 }
00111
00112 Pose nextVP(){
00113 return _nextVP;
00114 }
00115
00116 VPPlanners type(){
00117 return _type;
00118 }
00119 void setGoal(Position goal){
00120 _goal=goal;
00121 }
00122 Position getGoal(){
00123 return _goal;
00124 }
00125
00126 string print(){
00127 stringstream s;
00128 s.precision(3);
00129 s.setf(ios::fixed,ios::floatfield);
00130
00131 s<<"View Point Planner\t"<<VPPlannersNames[_type]<<endl;
00132 s<<"View Point\t\t"<<_nextVP.print()<<endl;
00133
00134
00135 return s.str();
00136 }
00137 };
00138
00145 class FrontierBasedVPP:public VPPlanner{
00146 public:
00147
00148 FrontierBasedVPP(){
00149 setType(FRONTIER_BASED);
00150
00151 }
00152
00153
00154 bool findNextVP(Grid* grid);
00155
00156 };
00157
00164 class RandomFrontierBasedVPP:public VPPlanner{
00165 public:
00166
00167 RandomFrontierBasedVPP(){
00168 setType(RAND_FRONTIER_BASED);
00169 }
00170
00171 bool findNextVP(Grid* grid);
00172 };
00173
00180 class OrthogonalIGVPP:public VPPlanner{
00181 public:
00182
00183 OrthogonalIGVPP(){
00184 setType(ORTHOGONAL_IG);
00185 }
00186
00187 bool findNextVP(Grid* grid);
00188 };
00189
00196 class LandscapingIGVPP:public VPPlanner{
00197 public:
00198
00199 LandscapingIGVPP(){
00200 setType(LANDSCAPING_IG);
00201 }
00202
00203 bool findNextVP(Grid* grid);
00204 };
00205
00206
00207
00211
00212
00213 class GoalBasedVPP:public VPPlanner{
00214 public:
00215
00216 GoalBasedVPP(Position goal){
00217 setGoal(goal);
00218 }
00219
00220 bool findNextVP(Grid* grid);
00221
00222 };
00223
00224
00225
00226 #endif
00227
00228
00229
00230