RtabmapThread.h
Go to the documentation of this file.
1 /*
2 Copyright (c) 2010-2016, Mathieu Labbe - IntRoLab - Universite de Sherbrooke
3 All rights reserved.
4 
5 Redistribution and use in source and binary forms, with or without
6 modification, are permitted provided that the following conditions are met:
7  * Redistributions of source code must retain the above copyright
8  notice, this list of conditions and the following disclaimer.
9  * Redistributions in binary form must reproduce the above copyright
10  notice, this list of conditions and the following disclaimer in the
11  documentation and/or other materials provided with the distribution.
12  * Neither the name of the Universite de Sherbrooke nor the
13  names of its contributors may be used to endorse or promote products
14  derived from this software without specific prior written permission.
15 
16 THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
17 ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
18 WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
19 DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY
20 DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
21 (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
22 LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
23 ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
24 (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
25 SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26 */
27 
28 #ifndef RTABMAPTHREAD_H_
29 #define RTABMAPTHREAD_H_
30 
31 #include "rtabmap/core/RtabmapExp.h" // DLL export/import defines
32 
36 #include <rtabmap/utilite/UMutex.h>
37 
42 
43 #include <queue>
44 
45 class UTimer;
46 
47 namespace rtabmap {
48 
49 class Rtabmap;
50 
52  public UThreadNode,
53  public UEventsHandler
54 {
55 public:
56  enum State {
71  kStateLabelling
72  };
73 
74 public:
75  // take ownership
77  virtual ~RtabmapThread();
78 
79  void clearBufferedData();
80  void setDetectorRate(float rate);
81  void setDataBufferSize(unsigned int bufferSize);
82  void createIntermediateNodes(bool enabled);
83 
84  float getDetectorRate() const {return _rate;}
85  unsigned int getDataBufferSize() const {return _dataBufferMaxSize;}
86  bool getCreateIntermediateNodes() const {return _createIntermediateNodes;}
87 
95  void close(bool databaseSaved, const std::string & databasePath = "");
96 
97 protected:
98  virtual bool handleEvent(UEvent * anEvent);
99 
100 private:
101  virtual void mainLoopBegin();
102  virtual void mainLoop();
103  virtual void mainLoopKill();
104  void process();
105  void addData(const OdometryEvent & odomEvent);
106  bool getData(OdometryEvent & data);
107  void pushNewState(State newState, const ParametersMap & parameters = ParametersMap());
108  void publishMap(bool optimized, bool full, bool graphOnly) const;
109 
110 private:
112  std::queue<State> _state;
113  std::queue<ParametersMap> _stateParam;
114 
115  std::list<OdometryEvent> _dataBuffer;
116  std::list<double> _newMapEvents;
119  unsigned int _dataBufferMaxSize;
120  float _rate;
124 
126  bool _paused;
128  cv::Mat covariance_;
129 
130  cv::Mat _userData;
132 };
133 
134 } /* namespace rtabmap */
135 #endif /* RTABMAPTHREAD_H_ */
Definition: UTimer.h:46
std::list< OdometryEvent > _dataBuffer
Definition: UEvent.h:57
Definition: lz4.c:365
unsigned int _dataBufferMaxSize
std::map< std::string, std::string > ParametersMap
Definition: Parameters.h:43
bool getCreateIntermediateNodes() const
Definition: RtabmapThread.h:86
#define RTABMAP_EXP
Definition: RtabmapExp.h:38
Definition: UMutex.h:54
unsigned int getDataBufferSize() const
Definition: RtabmapThread.h:85
std::queue< ParametersMap > _stateParam
float getDetectorRate() const
Definition: RtabmapThread.h:84
std::list< double > _newMapEvents
std::queue< State > _state


rtabmap
Author(s): Mathieu Labbe
autogenerated on Mon Dec 14 2020 03:35:00