gsp_thread.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 GSP_THREAD_H
24 #define GSP_THREAD_H
25 
26 #ifndef _WIN32
27  #include <unistd.h>
28  #include <pthread.h>
29 #endif
30 #include <deque>
31 #include <fstream>
32 #include <iostream>
36 
37 using namespace std;
38 using namespace GMapping;
39 
40 
41 #define MAX_STRING_LENGTH 1024
42 
43 
45  struct Event{
46  virtual ~Event();
47  };
48 
49  struct ParticleMoveEvent: public Event{
51  double neff;
52  std::vector<OrientedPoint> hypotheses;
53  std::vector<double> weightSums;
54  };
55 
56  struct TruePosEvent : public Event{
58  };
59 
60  struct ResampleEvent: public Event{
61  std::vector<unsigned int> indexes;
62  };
63 
64  struct MapEvent: public Event{
66  unsigned int index;
68  virtual ~MapEvent();
69  };
70 
71  struct DoneEvent: public Event{
72  };
73 
74  typedef deque<Event*> EventDeque;
75 
78  int init(int argc, const char * const * argv);
79  int loadFiles(const char * fn=0);
80  static void * fastslamthread(GridSlamProcessorThread* gpt);
81  std::vector<OrientedPoint> getHypotheses();
82  std::vector<unsigned int> getIndexes();
83 
84  EventDeque getEvents();
85 
86  void start();
87  void stop();
88 
89  virtual void onOdometryUpdate();
90  virtual void onResampleUpdate();
91  virtual void onScanmatchUpdate();
92 
93  virtual void syncOdometryUpdate();
94  virtual void syncResampleUpdate();
95  virtual void syncScanmatchUpdate();
96 
97  void setEventBufferSize(unsigned int length);
98  inline void setMapUpdateTime(unsigned int ut) {mapUpdateTime=ut;}
99  inline bool isRunning() const {return running;}
100  OrientedPoint boundingBox(SensorLog* log, double& xmin, double& ymin, double& xmax, double& ymax) const;
101  private:
102 
103  void addEvent(Event *);
104  EventDeque eventBuffer;
105 
106  unsigned int eventBufferLength;
107  unsigned int mapUpdateTime;
108  unsigned int mapTimer;
109 
110  //thread interaction stuff
111  std::vector<OrientedPoint> hypotheses;
112  std::vector<unsigned int> indexes;
113  std::vector<double> weightSums;
114  pthread_mutex_t hp_mutex, ind_mutex, hist_mutex;
115  pthread_t gfs_thread;
116  bool running;
117 
118  //This are the processor parameters
119  std::string filename;
120  std::string outfilename;
121 
122  double xmin;
123  double ymin;
124  double xmax;
125  double ymax;
126  bool autosize;
127  double delta;
129 
130  //scan matching parameters
131  double sigma;
132  double maxrange;
133  double maxUrange;
134  double regscore;
135  double lstep;
136  double astep;
139  double critscore;
140  double maxMove;
141  unsigned int lskip;
142 
143  //likelihood
144  double lsigma;
145  double ogain;
146  double llsamplerange, lasamplerange;
147  double llsamplestep, lasamplestep;
150 
151 
152  //motion model parameters
153  double srr, srt, str, stt;
154  //particle parameters
157 
158  //gfs parameters
160  double linearUpdate;
161 
162  //robot config
164  //input stream
166  std::ifstream plainStream;
168  bool onLine;
171  unsigned int randseed;
172 
173  //dirty carmen interface
174  const char* const * m_argv;
175  unsigned int m_argc;
176 
177 };
178 #endif
InputSensorStream * input
Definition: gsp_thread.h:165
void setMapUpdateTime(unsigned int ut)
Definition: gsp_thread.h:98
unsigned int mapTimer
Definition: gsp_thread.h:108
std::vector< double > weightSums
Definition: gsp_thread.h:113
const char *const * m_argv
Definition: gsp_thread.h:174
bool isRunning() const
Definition: gsp_thread.h:99
std::string outfilename
Definition: gsp_thread.h:120
std::vector< unsigned int > indexes
Definition: gsp_thread.h:112
deque< Event * > EventDeque
Definition: gsp_thread.h:74
double linearOdometryReliability
Definition: gsp_thread.h:148
std::ifstream plainStream
Definition: gsp_thread.h:166
unsigned int eventBufferLength
Definition: gsp_thread.h:106
std::map< std::string, Sensor * > SensorMap
Definition: sensor.h:20
std::vector< OrientedPoint > hypotheses
Definition: gsp_thread.h:111
double angularOdometryReliability
Definition: gsp_thread.h:149
std::vector< unsigned int > indexes
Definition: gsp_thread.h:61
unsigned int mapUpdateTime
Definition: gsp_thread.h:107
std::vector< OrientedPoint > hypotheses
Definition: gsp_thread.h:52
pthread_mutex_t ind_mutex
Definition: gsp_thread.h:114
unsigned int randseed
Definition: gsp_thread.h:171


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