gfs_simplegui.cpp
Go to the documentation of this file.
1 /*****************************************************************
2  *
3  * This file is part of the GMAPPING project
4  *
5  * GMAPPING Copyright (c) 2004 Giorgio Grisetti,
6  * Cyrill Stachniss, and Wolfram Burgard
7  *
8  * This software is licensed under the "Creative Commons
9  * License (Attribution-NonCommercial-ShareAlike 2.0)"
10  * and is copyrighted by Giorgio Grisetti, Cyrill Stachniss,
11  * and Wolfram Burgard.
12  *
13  * Further information on this license can be found at:
14  * http://creativecommons.org/licenses/by-nc-sa/2.0/
15  *
16  * GMAPPING is distributed in the hope that it will be useful,
17  * but WITHOUT ANY WARRANTY; without even the implied
18  * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
19  * PURPOSE.
20  *
21  *****************************************************************/
22 
23 
24 #include "qparticleviewer.h"
25 #include "qgraphpainter.h"
26 #include <qapplication.h>
27 #include <qframe.h>
28 #include <qlabel.h>
29 #include <qlayout.h>
30 #include <QVBoxLayout>
31 #include <qmainwindow.h>
32 
33 class GFSMainWindow: public QMainWindow{
34 public:
36  gsp_thread=t;
37  QVBoxLayout* layout=new QVBoxLayout(this);
38  pviewer=new QParticleViewer(this,0,0,gsp_thread);
39  pviewer->setGeometry(0,0,500,500);
40  pviewer->setFocusPolicy(Qt::ClickFocus);
41  layout->addWidget(pviewer);
42 
43  gpainter=new QGraphPainter(this);
44  gpainter->setFixedHeight(100);
45  layout->addWidget(gpainter);
46  gpainter->setRange(0,1);
47  gpainter->setTitle("Neff");
48 
49  help = new QLabel(QString("+/- - zoom | b - show/hide best path | p - show/hide all paths | c - center robot "),this);
50  help->setMaximumHeight(30);
51  layout->addWidget(help);
52 
53  QObject::connect( pviewer, SIGNAL(neffChanged(double) ), gpainter, SLOT(valueAdded(double)) );
54  setTabOrder(pviewer, pviewer);
55  }
56 
57  void start(int c){
58  pviewer->start(c);
59  gpainter->start(c);
60  }
61 
62 protected:
64  QVBoxLayout* layout;
67  QLabel* help;
68 };
69 
70 
71 int main (int argc, char ** argv){
72  cerr << "GMAPPING copyright 2004 by Giorgio Grisetti, Cyrill Stachniss," << endl ;
73  cerr << "and Wolfram Burgard. To be published under the CreativeCommons license," << endl;
74  cerr << "see: http://creativecommons.org/licenses/by-nc-sa/2.0/" << endl << endl;
75 
76 
78  if (gsp->init(argc, argv)){
79  cerr << "GridFastSlam: Initialization Error!" << endl;
80  cerr << "(Did you specified an input file for reading?)" << endl;
81  return -1;
82  }
83  if (gsp->loadFiles()){
84  cerr <<"Error reading file!"<< endl;
85  return -2;
86  }
87  cerr <<"File successfully loaded!"<< endl;
88  QApplication app(argc, argv);
89  GFSMainWindow* mainWin=new GFSMainWindow(gsp);
90  mainWin->show();
91  gsp->setEventBufferSize(10000);
92  gsp->start();
93  mainWin->start(1000);
94  return app.exec();
95 }
96 
int init(int argc, const char *const *argv)
Definition: gsp_thread.cpp:37
GFSMainWindow(GridSlamProcessorThread *t)
int main(int argc, char **argv)
int loadFiles(const char *fn=0)
Definition: gsp_thread.cpp:154
void setRange(double min, double max)
QVBoxLayout * layout
QGraphPainter * gpainter
unsigned int c
Definition: gfs2stream.cpp:41
GridSlamProcessorThread * gsp_thread
void start(int c)
void setTitle(const char *title)
void setEventBufferSize(unsigned int length)
Definition: gsp_thread.cpp:631
QParticleViewer * pviewer
void start(int period)


openslam_gmapping
Author(s): Giorgio Grisetti, Cyrill Stachniss, Wolfram Burgard
autogenerated on Mon Jun 10 2019 14:04:22