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 3-Clause BSD License
9  * and is copyrighted by Giorgio Grisetti, Cyrill Stachniss,
10  * and Wolfram Burgard.
11  *
12  * Further information on this license can be found at:
13  * https://opensource.org/licenses/BSD-3-Clause
14  *
15  * GMAPPING is distributed in the hope that it will be useful,
16  * but WITHOUT ANY WARRANTY; without even the implied
17  * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
18  * PURPOSE.
19  *
20  *****************************************************************/
21 
22 
25 #include <qapplication.h>
26 #include <qframe.h>
27 #include <qlabel.h>
28 #include <qlayout.h>
29 #include <qvbox.h>
30 #include <qmainwindow.h>
31 
32 class GFSMainWindow: public QMainWindow{
33 public:
35  gsp_thread=t;
36  QVBoxLayout* layout=new QVBoxLayout(this);
37  pviewer=new QParticleViewer(this,0,0,gsp_thread);
38  pviewer->setGeometry(0,0,500,500);
39  pviewer->setFocusPolicy(QParticleViewer::ClickFocus);
40  layout->addWidget(pviewer);
41 
42  gpainter=new QGraphPainter(this);
43  gpainter->setFixedHeight(100);
44  layout->addWidget(gpainter);
45  gpainter->setRange(0,1);
46  gpainter->setTitle("Neff");
47 
48  help = new QLabel(QString("+/- - zoom | b - show/hide best path | p - show/hide all paths | c - center robot "),this);
49  help->setMaximumHeight(30);
50  layout->addWidget(help);
51 
52  QObject::connect( pviewer, SIGNAL(neffChanged(double) ), gpainter, SLOT(valueAdded(double)) );
53  setTabOrder(pviewer, pviewer);
54  }
55 
56  void start(int c){
57  pviewer->start(c);
58  gpainter->start(c);
59  }
60 
61 protected:
63  QVBoxLayout* layout;
66  QLabel* help;
67 };
68 
69 
70 int main (int argc, char ** argv){
71  cerr << "GMAPPING copyright 2004 by Giorgio Grisetti, Cyrill Stachniss," << endl ;
72  cerr << "and Wolfram Burgard. Published under the 3-Clause BSD License," << endl;
73  cerr << "see: https://opensource.org/licenses/BSD-3-Clause" << endl << endl;
74 
75 
77  if (gsp->init(argc, argv)){
78  cerr << "GridFastSlam: Initialization Error!" << endl;
79  cerr << "(Did you specified an input file for reading?)" << endl;
80  return -1;
81  }
82  if (gsp->loadFiles()){
83  cerr <<"Error reading file!"<< endl;
84  return -2;
85  }
86  cerr <<"File successfully loaded!"<< endl;
87  QApplication app(argc, argv);
88  GFSMainWindow* mainWin=new GFSMainWindow(gsp);
89  app.setMainWidget(mainWin);
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:36
GFSMainWindow(GridSlamProcessorThread *t)
int main(int argc, char **argv)
int loadFiles(const char *fn=0)
Definition: gsp_thread.cpp:153
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:630
QParticleViewer * pviewer
void start(int period)


openslam_gmapping
Author(s): Cyrill Stachniss, Udo Frese, Giorgio Grisetti, Wolfram Burgard
autogenerated on Mon Feb 28 2022 22:59:20