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 #include <unistd.h>
00025 #include "gsp_thread.h"
00026
00027 using namespace GMapping;
00028
00029 int main (int argc, char ** argv){
00030 cerr << "GMAPPING copyright 2004 by Giorgio Grisetti, Cyrill Stachniss," << endl ;
00031 cerr << "and Wolfram Burgard. To be published under the CreativeCommons license," << endl ;
00032 cerr << "see: http://creativecommons.org/licenses/by-nc-sa/2.0/" << endl << endl;
00033
00034
00035 GridSlamProcessorThread* gsp= new GridSlamProcessorThread;
00036 if (gsp->init(argc, argv)){
00037 cout << "GSP INIT ERROR" << endl;
00038 return -1;
00039 }
00040 cout <<"GSP INITIALIZED"<< endl;
00041 if (gsp->loadFiles()){
00042 cout <<"GSP READFILE ERROR"<< endl;
00043 return -2;
00044 }
00045 cout <<"FILES LOADED"<< endl;
00046 gsp->setMapUpdateTime(1000000);
00047 gsp->start();
00048 cout <<"THREAD STARTED"<< endl;
00049 bool done=false;
00050 while (!done){
00051 GridSlamProcessorThread::EventDeque events=gsp->getEvents();
00052 for (GridSlamProcessorThread::EventDeque::iterator it=events.begin(); it!=events.end(); it++){
00053 cout << flush;
00054 GridSlamProcessorThread::DoneEvent* doneEvent=dynamic_cast<GridSlamProcessorThread::DoneEvent*>(*it);
00055 if (doneEvent){
00056 done=true;
00057 cout <<"DONE!"<< endl;
00058 gsp->stop();
00059 }
00060 if (*it)
00061 delete(*it);
00062 }
00063 }
00064 }