qparticleviewer.h
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 #ifndef QPARTICLEVIEWER_H
24 #define QPARTICLEVIEWER_H
25 
26 #include <qpainter.h>
27 #include <qpixmap.h>
28 #include <qwidget.h>
29 #include <qwmatrix.h>
30 #include <qtextstream.h>
31 #include <vector>
32 #include <assert.h>
33 #include <sstream>
34 #include <iostream>
35 #include <qimage.h>
36 
37 #include <gmapping/utils/point.h>
39 
40 namespace GMapping {
41 
42 class QParticleViewer : public QWidget{
43  Q_OBJECT
44  public:
45  struct StartParameters{
46  //motionmodel
47  double srr, srt, str, stt;
48  //map
49  double xmin, ymin, xmax, ymax, delta;
51  //likelihood
52  double lsigma, lgain;
53  unsigned int lskip;
54  //update
56  //filter
57  unsigned int particles;
58  double resampleThreshold;
59  //mode
61  //output
62  const char * outFileName;
63  };
64 
65  struct MatchingParameters{
66  //ranges
67  double maxrange, urange;
68  //score
69  double ssigma, sreg, scrit;
70  unsigned int ksize;
71  //search
72  double lstep, astep;
73  unsigned int iterations;
74  };
75 
76  void refreshParameters(); //reads the parameters from the thread
77  inline void setGSP( GridSlamProcessorThread* thread){gfs_thread=thread;}
78 
79 
80  typedef std::vector<OrientedPoint> OrientedPointVector;
81  QParticleViewer( QWidget * parent = 0, const char * name = 0, WFlags f = 0, GridSlamProcessorThread* thread=0 );
82  virtual ~QParticleViewer();
83  virtual void timerEvent(QTimerEvent * te);
84  virtual void resizeEvent(QResizeEvent *);
85 
86  void drawFromFile();
87  void drawFromMemory();
88  void drawMap(const ScanMatcherMap& map);
89  void start(int period);
90  QTextIStream* tis;
91 
94 
95  int writeToFile;
96  public slots:
98  void setStartParameters(const StartParameters& mp);
99  void start();
100  void stop();
101  void loadFile(const char *);
102  signals:
103  void neffChanged(double);
104  void poseEntropyChanged(double, double, double);
105  void trajectoryEntropyChanged(double, double, double);
106  void mapsEntropyChanged(double);
107  void mapsIGainChanged(double);
108 
109  protected:
110  ifstream inputStream;
111  ofstream outputStream;
112 
113 
114  protected:
115  inline Point pic2map(const IntPoint& p)
116  {return viewCenter+Point(p.x/mapscale, -p.y/mapscale); }
117  inline IntPoint map2pic(const Point& p)
118  {return IntPoint((int)((p.x-viewCenter.x)*mapscale),(int)((viewCenter.y-p.y)*mapscale)); }
119 
120  int timer;
121  virtual void paintEvent ( QPaintEvent *paintevent );
123  QPixmap* m_pixmap;
124 
125  //thread interaction
128 
129  //mouse movement
130  virtual void mousePressEvent(QMouseEvent*);
131  virtual void mouseReleaseEvent(QMouseEvent*);
132  virtual void mouseMoveEvent(QMouseEvent*);
133  QPoint draggingPos;
134  bool dragging;
135 
136  //particle plotting
137  virtual void keyPressEvent ( QKeyEvent* e );
138 
139  //map painting
140  double mapscale;
144 
145  // view mode
146  bool showPaths;
147  bool showBestPath;
148 
149  // file plotting
151  unsigned int m_particleSize;
152  bool m_refresh;
153  int count;
154 };
155 
156 };
157 
158 #endif
159 
GMapping::QParticleViewer::outputStream
ofstream outputStream
Definition: qparticleviewer.h:149
GMapping::QParticleViewer::StartParameters::lsigma
double lsigma
Definition: qparticleviewer.h:109
GMapping::QParticleViewer::drawFromMemory
void drawFromMemory()
Definition: qparticleviewer.cpp:228
point.h
GMapping::QParticleViewer::m_particleSize
unsigned int m_particleSize
Definition: qparticleviewer.h:189
GMapping::QParticleViewer::matchingParameters
MatchingParameters matchingParameters
Definition: qparticleviewer.h:130
GMapping::QParticleViewer::drawFromFile
void drawFromFile()
Definition: qparticleviewer.cpp:114
GMapping::QParticleViewer::MatchingParameters::iterations
unsigned int iterations
Definition: qparticleviewer.h:111
GMapping::QParticleViewer::MatchingParameters::ksize
unsigned int ksize
Definition: qparticleviewer.h:108
GMapping::QParticleViewer::bestMap
ScanMatcherMap * bestMap
Definition: qparticleviewer.h:181
GMapping::QParticleViewer::StartParameters::drawFromObservation
bool drawFromObservation
Definition: qparticleviewer.h:117
GMapping::QParticleViewer::tis
QTextIStream * tis
Definition: qparticleviewer.h:128
GMapping::QParticleViewer::~QParticleViewer
virtual ~QParticleViewer()
Definition: qparticleviewer.cpp:48
GMapping::QParticleViewer::StartParameters::srr
double srr
Definition: qparticleviewer.h:104
GMapping::QParticleViewer::MatchingParameters
Definition: qparticleviewer.h:103
GMapping::QParticleViewer::setMatchingParameters
void setMatchingParameters(const MatchingParameters &mp)
Definition: qparticleviewer.cpp:430
GMapping::QParticleViewer::StartParameters::lgain
double lgain
Definition: qparticleviewer.h:109
GMapping::QParticleViewer::mouseMoveEvent
virtual void mouseMoveEvent(QMouseEvent *)
Definition: qparticleviewer.cpp:65
GMapping::QParticleViewer::MatchingParameters::ssigma
double ssigma
Definition: qparticleviewer.h:107
GridSlamProcessorThread
Definition: gsp_thread.h:44
GMapping::QParticleViewer::count
int count
Definition: qparticleviewer.h:191
GMapping::QParticleViewer::drawParticleMove
void drawParticleMove(const OrientedPointVector &start, const OrientedPointVector &end)
Definition: qparticleviewer.cpp:100
GMapping::QParticleViewer::draggingPos
QPoint draggingPos
Definition: qparticleviewer.h:171
GMapping::QParticleViewer::drawMap
void drawMap(const ScanMatcherMap &map)
Definition: qparticleviewer.cpp:193
GMapping
Definition: configfile.cpp:34
GMapping::QParticleViewer::stop
void stop()
Definition: qparticleviewer.cpp:438
GMapping::QParticleViewer::StartParameters::delta
double delta
Definition: qparticleviewer.h:106
GMapping::QParticleViewer::m_pixmap
QPixmap * m_pixmap
Definition: qparticleviewer.h:161
GMapping::QParticleViewer::loadFile
void loadFile(const char *)
Definition: qparticleviewer.cpp:442
GMapping::QParticleViewer::showBestPath
bool showBestPath
Definition: qparticleviewer.h:185
GMapping::QParticleViewer::StartParameters::xmax
double xmax
Definition: qparticleviewer.h:106
GMapping::QParticleViewer::keyPressEvent
virtual void keyPressEvent(QKeyEvent *e)
Definition: qparticleviewer.cpp:81
GMapping::QParticleViewer::m_oldPose
QParticleViewer::OrientedPointVector m_oldPose
Definition: qparticleviewer.h:188
GMapping::QParticleViewer::StartParameters::lskip
unsigned int lskip
Definition: qparticleviewer.h:110
GMapping::QParticleViewer::StartParameters::linearUpdate
double linearUpdate
Definition: qparticleviewer.h:112
GMapping::QParticleViewer::StartParameters::initialPose
OrientedPoint initialPose
Definition: qparticleviewer.h:107
GMapping::QParticleViewer::viewCenter
Point viewCenter
Definition: qparticleviewer.h:179
GMapping::QParticleViewer::poseEntropyChanged
void poseEntropyChanged(double, double, double)
GMapping::QParticleViewer::start
void start()
Definition: qparticleviewer.cpp:397
GMapping::QParticleViewer::StartParameters::ymax
double ymax
Definition: qparticleviewer.h:106
GMapping::Map< PointAccumulator, HierarchicalArray2D< PointAccumulator > >
GMapping::QParticleViewer::setStartParameters
void setStartParameters(const StartParameters &mp)
Definition: qparticleviewer.cpp:434
GMapping::QParticleViewer::mapsIGainChanged
void mapsIGainChanged(double)
GMapping::IntPoint
point< int > IntPoint
Definition: point.h:201
GMapping::QParticleViewer::MatchingParameters::maxrange
double maxrange
Definition: qparticleviewer.h:105
GMapping::QParticleViewer::showPaths
bool showPaths
Definition: qparticleviewer.h:184
GMapping::QParticleViewer::StartParameters::particles
unsigned int particles
Definition: qparticleviewer.h:114
GMapping::QParticleViewer::MatchingParameters::astep
double astep
Definition: qparticleviewer.h:110
GMapping::QParticleViewer::StartParameters::stt
double stt
Definition: qparticleviewer.h:104
GMapping::QParticleViewer::OrientedPointVector
std::vector< OrientedPoint > OrientedPointVector
Definition: qparticleviewer.h:118
GMapping::QParticleViewer::MatchingParameters::sreg
double sreg
Definition: qparticleviewer.h:107
GMapping::QParticleViewer::mousePressEvent
virtual void mousePressEvent(QMouseEvent *)
Definition: qparticleviewer.cpp:59
GMapping::QParticleViewer::StartParameters
Definition: qparticleviewer.h:83
GMapping::point::y
T y
Definition: point.h:16
GMapping::QParticleViewer::inputStream
ifstream inputStream
Definition: qparticleviewer.h:148
GMapping::Point
point< double > Point
Definition: point.h:202
GMapping::QParticleViewer::StartParameters::xmin
double xmin
Definition: qparticleviewer.h:106
GMapping::QParticleViewer::MatchingParameters::scrit
double scrit
Definition: qparticleviewer.h:107
GMapping::QParticleViewer::mapsEntropyChanged
void mapsEntropyChanged(double)
GMapping::QParticleViewer::setGSP
void setGSP(GridSlamProcessorThread *thread)
Definition: qparticleviewer.h:115
GMapping::QParticleViewer::neffChanged
void neffChanged(double)
GMapping::QParticleViewer::StartParameters::outFileName
const char * outFileName
Definition: qparticleviewer.h:119
GMapping::QParticleViewer::map2pic
IntPoint map2pic(const Point &p)
Definition: qparticleviewer.h:155
GMapping::QParticleViewer::history
GridSlamProcessorThread::EventDeque history
Definition: qparticleviewer.h:165
GMapping::QParticleViewer::StartParameters::resampleThreshold
double resampleThreshold
Definition: qparticleviewer.h:115
GridSlamProcessorThread::EventDeque
deque< Event * > EventDeque
Definition: gsp_thread.h:74
GMapping::QParticleViewer::dragging
bool dragging
Definition: qparticleviewer.h:172
GMapping::QParticleViewer::startParameters
StartParameters startParameters
Definition: qparticleviewer.h:131
GMapping::QParticleViewer::MatchingParameters::lstep
double lstep
Definition: qparticleviewer.h:110
GMapping::QParticleViewer::resizeEvent
virtual void resizeEvent(QResizeEvent *)
Definition: qparticleviewer.cpp:93
GMapping::QParticleViewer::refreshParameters
void refreshParameters()
Definition: qparticleviewer.cpp:368
GMapping::QParticleViewer::StartParameters::ymin
double ymin
Definition: qparticleviewer.h:106
GMapping::point< double >
GMapping::QParticleViewer::m_refresh
bool m_refresh
Definition: qparticleviewer.h:190
GMapping::QParticleViewer::StartParameters::angularUpdate
double angularUpdate
Definition: qparticleviewer.h:112
GMapping::QParticleViewer::StartParameters::str
double str
Definition: qparticleviewer.h:104
GMapping::QParticleViewer::pic2map
Point pic2map(const IntPoint &p)
Definition: qparticleviewer.h:153
GMapping::QParticleViewer::MatchingParameters::urange
double urange
Definition: qparticleviewer.h:105
GMapping::QParticleViewer::writeToFile
int writeToFile
Definition: qparticleviewer.h:133
gsp_thread.h
GMapping::QParticleViewer
Definition: qparticleviewer.h:61
GMapping::QParticleViewer::paintEvent
virtual void paintEvent(QPaintEvent *paintevent)
Definition: qparticleviewer.cpp:53
GMapping::QParticleViewer::timerEvent
virtual void timerEvent(QTimerEvent *te)
Definition: qparticleviewer.cpp:352
GMapping::QParticleViewer::timer
int timer
Definition: qparticleviewer.h:158
GMapping::orientedpoint< double, double >
GMapping::QParticleViewer::gfs_thread
GridSlamProcessorThread * gfs_thread
Definition: qparticleviewer.h:164
GMapping::QParticleViewer::QParticleViewer
QParticleViewer(QWidget *parent=0, const char *name=0, WFlags f=0, GridSlamProcessorThread *thread=0)
Definition: qparticleviewer.cpp:30
GMapping::QParticleViewer::mouseReleaseEvent
virtual void mouseReleaseEvent(QMouseEvent *)
Definition: qparticleviewer.cpp:75
GMapping::point::x
T x
Definition: point.h:16
GMapping::QParticleViewer::StartParameters::srt
double srt
Definition: qparticleviewer.h:104
GMapping::QParticleViewer::m_newPose
QParticleViewer::OrientedPointVector m_newPose
Definition: qparticleviewer.h:188
GMapping::QParticleViewer::mapscale
double mapscale
Definition: qparticleviewer.h:178
GMapping::QParticleViewer::trajectoryEntropyChanged
void trajectoryEntropyChanged(double, double, double)
GMapping::QParticleViewer::bestParticlePose
Point bestParticlePose
Definition: qparticleviewer.h:180


openslam_gmapping
Author(s): Cyrill Stachniss, Udo Frese, Giorgio Grisetti, Wolfram Burgard
autogenerated on Thu Oct 19 2023 02:25:51