Go to the documentation of this file.
24 #include "moc_qparticleviewer.cpp"
32 setMinimumSize(500,500);
60 if (event->button()==LeftButton){
76 if (event->button()==LeftButton){
85 case Qt::Key_Plus:
mapscale *=1.25;
break;
86 case Qt::Key_Minus:
mapscale/=1.25;
break;
96 cerr <<
"QParticleViewer::resizeEvent" << sizeev->size().width()<<
" " << sizeev->size().height() << endl;
101 assert(oldPose.size()==newPose.size());
103 painter.setPen(Qt::red);
104 OrientedPointVector::const_iterator nit=newPose.begin();
105 for(OrientedPointVector::const_iterator it=oldPose.begin(); it!=oldPose.end(); it++, nit++){
109 (
int)(p0.
x), (
int)(p0.
y), (
int)(p1.
x), (
int)(p1.
y)
119 QTextIStream&
is=*
tis;
121 string line=
is.readLine();
122 istringstream lineStream(line);
124 lineStream >> recordType;
125 if (recordType==
"LASER_READING"){
127 cout <<
"l" << flush;
129 if (recordType==
"ODO_UPDATE"){
140 for (
unsigned int i=0; i< size; i++){
145 lineStream >> p.
theta;
149 cout <<
"o" << flush;
151 if (recordType==
"SM_UPDATE"){
161 for (
unsigned int i=0; i< size; i++){
166 lineStream >> p.
theta;
170 cout <<
"u" << flush;
172 if (recordType==
"RESAMPLE"){
179 for (
unsigned int i=0; i< size; i++){
185 cout <<
"r" << flush;
196 painter.setPen(Qt::black);
197 m_pixmap->fill(QColor(200,200,255));
198 unsigned int count=0;
209 for(
int x=0; x<
m_pixmap->width(); x++)
210 for(
int y=0; y<
m_pixmap->height(); y++){
217 double v=map.
cell(p);
219 int grayValue=255-(int)(255.*v);
220 painter.setPen(QColor(grayValue, grayValue, grayValue));
221 painter.drawPoint(x,y);
233 for (GridSlamProcessorThread::EventDeque::const_iterator it=events.begin(); it!=events.end();it++){
259 unsigned int particleSize=0;
260 std::vector<OrientedPoint> oldPose, newPose;
261 vector<unsigned int> indexes;
263 GridSlamProcessorThread::EventDeque::reverse_iterator it=
history.rbegin();
264 while (!particleSize && it!=
history.rend()){
270 particleSize=
resample->indexes.size();
276 unsigned int bestIdx=0;
278 for (
unsigned int i=0; i<particleSize; i++){
279 unsigned int currentIndex=i;
281 for(GridSlamProcessorThread::EventDeque::reverse_iterator it=
history.rbegin(); it!=
history.rend()&& !done; it++){
287 bestIdx=currentIndex;
297 currentIndex=
resample->indexes[currentIndex];
304 for (
unsigned int i=0; i<particleSize+1; i++){
305 painter.setPen(Qt::yellow);
306 unsigned int currentIndex=i;
308 currentIndex=bestIdx;
309 painter.setPen(Qt::red);
313 for(GridSlamProcessorThread::EventDeque::reverse_iterator it=
history.rbegin(); it!=
history.rend(); it++){
320 painter.drawPoint(p0.
x, p0.
y);
322 painter.drawLine(p0.
x, p0.
y, p1.
x, p1.
y);
331 currentIndex=
resample->indexes[currentIndex];
339 cout <<
" Writing " << name <<
" ..." << flush;
340 QImage image=
m_pixmap->convertToImage();
341 bool rv=image.save(name,
"PNG");
353 if (te->timerId()==
timer) {
365 timer=startTimer(period);
std::vector< OrientedPoint > hypotheses
unsigned int m_particleSize
MatchingParameters matchingParameters
void setMatchingParameters(double urange, double range, double sigma, int kernsize, double lopt, double aopt, int iterations, double likelihoodSigma=1, double likelihoodGain=1, unsigned int likelihoodSkip=0)
virtual ~QParticleViewer()
void setMatchingParameters(const MatchingParameters &mp)
virtual void mouseMoveEvent(QMouseEvent *)
void drawParticleMove(const OrientedPointVector &start, const OrientedPointVector &end)
void drawMap(const ScanMatcherMap &map)
void loadFile(const char *)
virtual void keyPressEvent(QKeyEvent *e)
QParticleViewer::OrientedPointVector m_oldPose
int loadFiles(const char *fn=0)
const char *const *argv double delta
OrientedPoint initialPose
void setStartParameters(const StartParameters &mp)
std::vector< double > weightSums
std::vector< OrientedPoint > OrientedPointVector
virtual void mousePressEvent(QMouseEvent *)
void setUpdateDistances(double linear, double angular, double resampleThreshold)
IntPoint map2pic(const Point &p)
GridSlamProcessorThread::EventDeque history
deque< Event * > EventDeque
const ParticleVector & getParticles() const
StartParameters startParameters
virtual void resizeEvent(QResizeEvent *)
Point pic2map(const IntPoint &p)
IntPoint world2map(const Point &p) const
Cell & cell(int x, int y)
void setMotionModelParameters(double srr, double srt, double str, double stt)
virtual void paintEvent(QPaintEvent *paintevent)
void resample(std::vector< int > &indexes, const WeightVector &weights, unsigned int nparticles=0)
virtual void timerEvent(QTimerEvent *te)
GridSlamProcessorThread * gfs_thread
QParticleViewer(QWidget *parent=0, const char *name=0, WFlags f=0, GridSlamProcessorThread *thread=0)
virtual void mouseReleaseEvent(QMouseEvent *)
QParticleViewer::OrientedPointVector m_newPose
openslam_gmapping
Author(s): Cyrill Stachniss, Udo Frese, Giorgio Grisetti, Wolfram Burgard
autogenerated on Thu Oct 19 2023 02:25:51