gui
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
23
#include "
gmapping/gui/qparticleviewer.h
"
24
#include "
gmapping/gui/qgraphpainter.h
"
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
:
34
GFSMainWindow
(
GridSlamProcessorThread
* t){
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
:
62
GridSlamProcessorThread
*
gsp_thread
;
63
QVBoxLayout*
layout
;
64
QParticleViewer
*
pviewer
;
65
QGraphPainter
*
gpainter
;
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
76
GridSlamProcessorThread
* gsp=
new
GridSlamProcessorThread
;
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
c
unsigned int c
Definition:
gfs2stream.cpp:41
GMapping::QParticleViewer::start
void start(int period)
Definition:
qparticleviewer.cpp:364
GridSlamProcessorThread::init
int init(int argc, const char *const *argv)
Definition:
gsp_thread.cpp:36
GridSlamProcessorThread
Definition:
gsp_thread.h:44
GFSMainWindow
Definition:
gfs_simplegui.cpp:32
QGraphPainter::setRange
void setRange(double min, double max)
Definition:
qgraphpainter.cpp:71
QGraphPainter::start
void start(int period)
Definition:
qgraphpainter.cpp:89
qgraphpainter.h
GridSlamProcessorThread::loadFiles
int loadFiles(const char *fn=0)
Definition:
gsp_thread.cpp:153
GFSMainWindow::GFSMainWindow
GFSMainWindow(GridSlamProcessorThread *t)
Definition:
gfs_simplegui.cpp:53
qparticleviewer.h
GridSlamProcessorThread::setEventBufferSize
void setEventBufferSize(unsigned int length)
Definition:
gsp_thread.cpp:630
GFSMainWindow::start
void start(int c)
Definition:
gfs_simplegui.cpp:75
GFSMainWindow::help
QLabel * help
Definition:
gfs_simplegui.cpp:85
main
int main(int argc, char **argv)
Definition:
gfs_simplegui.cpp:70
GFSMainWindow::layout
QVBoxLayout * layout
Definition:
gfs_simplegui.cpp:82
GFSMainWindow::gpainter
QGraphPainter * gpainter
Definition:
gfs_simplegui.cpp:84
GridSlamProcessorThread::start
void start()
Definition:
gsp_thread.cpp:499
QGraphPainter
Definition:
qgraphpainter.h:36
GFSMainWindow::pviewer
QParticleViewer * pviewer
Definition:
gfs_simplegui.cpp:83
QGraphPainter::setTitle
void setTitle(const char *title)
Definition:
qgraphpainter.cpp:67
GMapping::QParticleViewer
Definition:
qparticleviewer.h:61
GFSMainWindow::gsp_thread
GridSlamProcessorThread * gsp_thread
Definition:
gfs_simplegui.cpp:81
openslam_gmapping
Author(s): Cyrill Stachniss, Udo Frese, Giorgio Grisetti, Wolfram Burgard
autogenerated on Thu Oct 19 2023 02:25:51