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 "qparticleviewer.h"
00025 #include "qgraphpainter.h"
00026 #include <qapplication.h>
00027 #include <qframe.h>
00028 #include <qlabel.h>
00029 #include <qlayout.h>
00030 #include <qvbox.h>
00031 #include <qmainwindow.h>
00032
00033 class GFSMainWindow: public QMainWindow{
00034 public:
00035 GFSMainWindow(GridSlamProcessorThread* t){
00036 gsp_thread=t;
00037 QVBoxLayout* layout=new QVBoxLayout(this);
00038 pviewer=new QParticleViewer(this,0,0,gsp_thread);
00039 pviewer->setGeometry(0,0,500,500);
00040 pviewer->setFocusPolicy(QParticleViewer::ClickFocus);
00041 layout->addWidget(pviewer);
00042
00043 gpainter=new QGraphPainter(this);
00044 gpainter->setFixedHeight(100);
00045 layout->addWidget(gpainter);
00046 gpainter->setRange(0,1);
00047 gpainter->setTitle("Neff");
00048
00049 help = new QLabel(QString("+/- - zoom | b - show/hide best path | p - show/hide all paths | c - center robot "),this);
00050 help->setMaximumHeight(30);
00051 layout->addWidget(help);
00052
00053 QObject::connect( pviewer, SIGNAL(neffChanged(double) ), gpainter, SLOT(valueAdded(double)) );
00054 setTabOrder(pviewer, pviewer);
00055 }
00056
00057 void start(int c){
00058 pviewer->start(c);
00059 gpainter->start(c);
00060 }
00061
00062 protected:
00063 GridSlamProcessorThread* gsp_thread;
00064 QVBoxLayout* layout;
00065 QParticleViewer* pviewer;
00066 QGraphPainter* gpainter;
00067 QLabel* help;
00068 };
00069
00070
00071 int main (int argc, char ** argv){
00072 cerr << "GMAPPING copyright 2004 by Giorgio Grisetti, Cyrill Stachniss," << endl ;
00073 cerr << "and Wolfram Burgard. To be published under the CreativeCommons license," << endl;
00074 cerr << "see: http://creativecommons.org/licenses/by-nc-sa/2.0/" << endl << endl;
00075
00076
00077 GridSlamProcessorThread* gsp= new GridSlamProcessorThread;
00078 if (gsp->init(argc, argv)){
00079 cerr << "GridFastSlam: Initialization Error!" << endl;
00080 cerr << "(Did you specified an input file for reading?)" << endl;
00081 return -1;
00082 }
00083 if (gsp->loadFiles()){
00084 cerr <<"Error reading file!"<< endl;
00085 return -2;
00086 }
00087 cerr <<"File successfully loaded!"<< endl;
00088 QApplication app(argc, argv);
00089 GFSMainWindow* mainWin=new GFSMainWindow(gsp);
00090 app.setMainWidget(mainWin);
00091 mainWin->show();
00092 gsp->setEventBufferSize(10000);
00093 gsp->start();
00094 mainWin->start(1000);
00095 return app.exec();
00096 }
00097