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 "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 #ifndef QPARTICLEVIEWER_H
25 #define QPARTICLEVIEWER_H
26 
27 #include <qpainter.h>
28 #include <qpixmap.h>
29 #include <qwidget.h>
30 #include <qmatrix.h>
31 #include <qtextstream.h>
32 #include <vector>
33 #include <assert.h>
34 #include <sstream>
35 #include <iostream>
36 #include <qimage.h>
37 #include <QTextStream>
38 
39 #include <utils/point.h>
40 #include "gsp_thread.h"
41 
42 namespace GMapping {
43 
44 class QParticleViewer : public QWidget{
45  Q_OBJECT
46  public:
48  //motionmodel
49  double srr, srt, str, stt;
50  //map
51  double xmin, ymin, xmax, ymax, delta;
53  //likelihood
54  double lsigma, lgain;
55  unsigned int lskip;
56  //update
58  //filter
59  unsigned int particles;
61  //mode
63  //output
64  const char * outFileName;
65  };
66 
68  //ranges
69  double maxrange, urange;
70  //score
71  double ssigma, sreg, scrit;
72  unsigned int ksize;
73  //search
74  double lstep, astep;
75  unsigned int iterations;
76  };
77 
78  void refreshParameters(); //reads the parameters from the thread
79  inline void setGSP( GridSlamProcessorThread* thread){gfs_thread=thread;}
80 
81 
82  typedef std::vector<OrientedPoint> OrientedPointVector;
83  QParticleViewer( QWidget * parent = 0, const char * name = 0, Qt::WindowFlags f = 0, GridSlamProcessorThread* thread=0 );
84  virtual ~QParticleViewer();
85  virtual void timerEvent(QTimerEvent * te);
86  virtual void resizeEvent(QResizeEvent *);
87 
88  void drawFromFile();
89  void drawFromMemory();
90  void drawMap(const ScanMatcherMap& map);
91  void start(int period);
92  QTextStream* tis;
93 
96 
98  public slots:
100  void setStartParameters(const StartParameters& mp);
101  void start();
102  void stop();
103  void loadFile(const char *);
104  signals:
105  void neffChanged(double);
106  void poseEntropyChanged(double, double, double);
107  void trajectoryEntropyChanged(double, double, double);
108  void mapsEntropyChanged(double);
109  void mapsIGainChanged(double);
110 
111  protected:
112  ifstream inputStream;
113  ofstream outputStream;
114 
115 
116  protected:
117  inline Point pic2map(const IntPoint& p)
118  {return viewCenter+Point(p.x/mapscale, -p.y/mapscale); }
119  inline IntPoint map2pic(const Point& p)
120  {return IntPoint((int)((p.x-viewCenter.x)*mapscale),(int)((viewCenter.y-p.y)*mapscale)); }
121 
122  int timer;
123  virtual void paintEvent ( QPaintEvent *paintevent );
124  void drawParticleMove(const OrientedPointVector& start, const OrientedPointVector& end);
125  QPixmap* m_pixmap;
126 
127  //thread interaction
130 
131  //mouse movement
132  virtual void mousePressEvent(QMouseEvent*);
133  virtual void mouseReleaseEvent(QMouseEvent*);
134  virtual void mouseMoveEvent(QMouseEvent*);
135  QPoint draggingPos;
136  bool dragging;
137 
138  //particle plotting
139  virtual void keyPressEvent ( QKeyEvent* e );
140 
141  //map painting
142  double mapscale;
146 
147  // view mode
148  bool showPaths;
150 
151  // file plotting
153  unsigned int m_particleSize;
154  bool m_refresh;
155  int count;
156 };
157 
158 };
159 
160 #endif
161 
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
virtual void mouseReleaseEvent(QMouseEvent *)
StartParameters startParameters
IntPoint map2pic(const Point &p)
void setStartParameters(const StartParameters &mp)
deque< Event * > EventDeque
Definition: gsp_thread.h:73
virtual void paintEvent(QPaintEvent *paintevent)
void drawParticleMove(const OrientedPointVector &start, const OrientedPointVector &end)
QParticleViewer(QWidget *parent=0, const char *name=0, Qt::WindowFlags f=0, GridSlamProcessorThread *thread=0)
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): Giorgio Grisetti, Cyrill Stachniss, Wolfram Burgard
autogenerated on Mon Jun 10 2019 14:04:22