MRXT: The Multi-Robot eXploration Tool
Multi-Robot autonomous exploration and mapping simulator.
|
00001 /* 00002 * 00003 * Author: Miguel Julia <mjulia@umh.es> 00004 * 00005 * Date: 2008 00006 * 00007 * Class HybridPlanner 00008 * 00009 */ 00010 #pragma once 00011 #ifndef __HYBRID__PLANNER__ 00012 #define __HYBRID__PLANNER__ 00013 00014 #include <iostream> 00015 #include <stdlib.h> 00016 #include "ClThread.h" 00017 #include "ClMutex.h" 00018 #include "stepEvent.h" 00019 #include "slamInterface.h" 00020 #include "treeNode.h" 00021 #include "reactive.h" 00022 #include "planner.h" 00023 #include "ConfigFile.h" 00024 00025 00026 /** 00027 * @brief Implements a Hybrid Deliberative/Reactive Planner 00028 * 00029 */ 00030 00031 class HybridPlanner: public planner{ 00032 00033 private: 00034 00035 /// Gateway cell structure for hybrid planner 00036 typedef struct door{ 00037 float x; 00038 float y; 00039 float scale; 00040 door(): x(0.0f),y(0.0f), scale(0.0f){} 00041 }door; 00042 00043 00044 /////////////////////////////////////////////////////////////////////// 00045 //------------------------- Attributes ------------------------------ 00046 /////////////////////////////////////////////////////////////////////// 00047 00048 protected: 00049 00050 bool badlocalized; // state flags 00051 int state; // state of the planner 00052 bool showPlanner; // Flag that indicates if the planning figure must be displayed 00053 bool endPlanner; // Flag that indicates that the thread must conclude in the next iteration 00054 ClMutex closing; // Mutex for a right stopping of the thread 00055 IplImage* im; 00056 00057 // parameters 00058 int eszdilationradius; 00059 float actionradius; 00060 int min_frontier_length; 00061 int min_gateway_length; 00062 float utility_radius; 00063 00064 //--------------------------------------------------------------------- 00065 /////////////////////////////////////////////////////////////////////// 00066 00067 /////////////////////////////////////////////////////////////////////// 00068 //------------------------- Methods --------------------------------- 00069 /////////////////////////////////////////////////////////////////////// 00070 00071 public: 00072 00073 /// Constructor 00074 HybridPlanner(const ConfigFile& config); 00075 /// Destructor 00076 virtual ~HybridPlanner(); 00077 00078 protected: 00079 00080 int setup(); // Thread setup 00081 void onStop(); // Thread on stop 00082 void execute(); // Thead execution body 00083 00084 /// creates an exploration tree 00085 treeNode* createExplorationTree(int numrobots, const point* robotcells, const point& pos, const gridMapInterface& omap, const binMap& precisemap, const binMap& imprecisemap); 00086 /// seeks for adjacent zones 00087 void seekChildren(int numrobots, const point* robotcells, const binMap& safezone, const binMap& filter, treeNode& node, const gridMapInterface& omap, const binMap& precisemap, const binMap& imprecisemap); 00088 /// clusters a binmap 00089 int cluster(int numrobots, const point* robotcells, const binMap& map, treeNode& parent, int nodetype); 00090 /// recursive clustering 00091 bool clustering(const int &i, const int &j, binMap& aux, const binMap& map, door& cl, std::list<point> &seq, bool backfront); 00092 /// evaluates the exploration tree 00093 void evalTree(treeNode& tree); 00094 /// evals a zone of the tree 00095 void evalZone(int numrobots, const point* robotcells, const binMap& map, treeNode& node, const gridMapInterface& omap, const binMap& precisemap, const binMap& imprecisemap); 00096 00097 00098 //--------------------------------------------------------------------- 00099 /////////////////////////////////////////////////////////////////////// 00100 00101 }; 00102 00103 #endif 00104