gfs_nogui.cpp
Go to the documentation of this file.
00001 /*****************************************************************
00002  *
00003  * This file is part of the GMAPPING project
00004  *
00005  * GMAPPING Copyright (c) 2004 Giorgio Grisetti, 
00006  * Cyrill Stachniss, and Wolfram Burgard
00007  *
00008  * This software is licensed under the "Creative Commons 
00009  * License (Attribution-NonCommercial-ShareAlike 2.0)" 
00010  * and is copyrighted by Giorgio Grisetti, Cyrill Stachniss, 
00011  * and Wolfram Burgard.
00012  * 
00013  * Further information on this license can be found at:
00014  * http://creativecommons.org/licenses/by-nc-sa/2.0/
00015  * 
00016  * GMAPPING is distributed in the hope that it will be useful,
00017  * but WITHOUT ANY WARRANTY; without even the implied 
00018  * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
00019  * PURPOSE.  
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 }


openslam_gmapping
Author(s): Giorgio Grisetti, Cyrill Stachniss, Wolfram Burgard
autogenerated on Fri Aug 28 2015 11:56:21