MRXT: The Multi-Robot eXploration Tool
Multi-Robot autonomous exploration and mapping simulator.
|
00001 #include <iostream> 00002 #include <stdlib.h> 00003 00004 #include "robot.h" 00005 00006 #include "reactiveGauss.h" 00007 00008 #include "HybridPlanner.h" 00009 #include "FrontierGreedyPlanner.h" 00010 #include "FSAPlanner.h" 00011 #include "CoordinatedPlanner.h" 00012 #include "IGPlanner.h" 00013 #include "MarketPlanner.h" 00014 #include "IntegratedIGPlanner.h" 00015 00016 // constructor 00017 robot::robot(): 00018 number(0), 00019 strlog(0), 00020 mySlam(0), 00021 reac(0), 00022 plan(0), 00023 scene(0), 00024 rbase(0), 00025 config(0) 00026 { 00027 // printf("[ROBOT] Robot created\n"); 00028 } 00029 00030 // constructor 00031 robot::robot(int num, slamInterface& sp, worldModelInterface& s, const ConfigFile& conf): 00032 number(num), 00033 strlog(0), 00034 mySlam(&sp), 00035 reac(0), 00036 plan(0), 00037 scene(&s), 00038 rbase(s.createNewPlatform()), 00039 config(&conf) 00040 { 00041 mySlam->setRobotBase(number,*rbase); 00042 // printf("[ROBOT] Robot created\n"); 00043 } 00044 00045 // destructor 00046 robot::~robot(){ 00047 // printf("[ROBOT] Robot destroyer...\n"); 00048 if (plan){ 00049 plan->stop(); 00050 delete plan; 00051 } 00052 if (reac){ 00053 reac->stop(); 00054 delete reac; 00055 } 00056 if (strlog) delete[] strlog; 00057 if (rbase) delete rbase; 00058 // printf("[ROBOT] Robot destroyed\n"); 00059 } 00060 00061 // initializer 00062 void robot::initialize(int num, slamInterface& sp, worldModelInterface& s, const ConfigFile& conf){ 00063 number = num; 00064 if (strlog) delete[] strlog; 00065 setSlam(sp); 00066 if (plan){ 00067 plan->stop(); 00068 delete plan; 00069 plan = 0; 00070 } 00071 if (reac){ 00072 reac->stop(); 00073 delete reac; 00074 reac = 0; 00075 } 00076 setWorldModel(s); 00077 if (rbase) delete rbase; 00078 rbase = s.createNewPlatform(); 00079 mySlam->setRobotBase(number,*rbase); 00080 config = &conf; 00081 } 00082 00083 // sets the log file name 00084 void robot::setLogName(const char* str){ 00085 if (strlog) delete[] strlog; 00086 strlog = new char[strlen(str)+1]; 00087 strcpy(strlog,str); 00088 } 00089 00090