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:
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;
59  //mode
61  //output
62  const char * outFileName;
63  };
64 
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 
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 );
122  void drawParticleMove(const OrientedPointVector& start, const OrientedPointVector& end);
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;
148 
149  // file plotting
151  unsigned int m_particleSize;
152  bool m_refresh;
153  int count;
154 };
155 
156 };
157 
158 #endif
159 
void setMatchingParameters(const MatchingParameters &mp)
point< double > Point
Definition: point.h:202
void drawMap(const ScanMatcherMap &map)
MatchingParameters matchingParameters
QParticleViewer::OrientedPointVector m_oldPose
void mapsIGainChanged(double)
point< int > IntPoint
Definition: point.h:201
virtual void resizeEvent(QResizeEvent *)
QParticleViewer::OrientedPointVector m_newPose
std::vector< OrientedPoint > OrientedPointVector
void loadFile(const char *)
double maxrange
Definition: gfs2stream.cpp:22
QParticleViewer(QWidget *parent=0, const char *name=0, WFlags f=0, GridSlamProcessorThread *thread=0)
virtual void mouseReleaseEvent(QMouseEvent *)
StartParameters startParameters
IntPoint map2pic(const Point &p)
void setStartParameters(const StartParameters &mp)
deque< Event * > EventDeque
Definition: gsp_thread.h:74
virtual void paintEvent(QPaintEvent *paintevent)
void drawParticleMove(const OrientedPointVector &start, const OrientedPointVector &end)
virtual void mousePressEvent(QMouseEvent *)
void mapsEntropyChanged(double)
virtual void mouseMoveEvent(QMouseEvent *)
GridSlamProcessorThread * gfs_thread
Point pic2map(const IntPoint &p)
void poseEntropyChanged(double, double, double)
void setGSP(GridSlamProcessorThread *thread)
void trajectoryEntropyChanged(double, double, double)
GridSlamProcessorThread::EventDeque history
virtual void timerEvent(QTimerEvent *te)
virtual void keyPressEvent(QKeyEvent *e)


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