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 {
58  kStateProcessCommand
59  };
60 
61 public:
62  // take ownership
64  virtual ~RtabmapThread();
65 
66  void clearBufferedData();
67  void setDetectorRate(float rate);
68  void setDataBufferSize(unsigned int bufferSize);
69  void createIntermediateNodes(bool enabled);
70 
71  float getDetectorRate() const {return _rate;}
72  unsigned int getDataBufferSize() const {return _dataBufferMaxSize;}
73  bool getCreateIntermediateNodes() const {return _createIntermediateNodes;}
74 
82  void close(bool databaseSaved, const std::string & databasePath = "");
83 
84 protected:
85  virtual bool handleEvent(UEvent * anEvent);
86 
87 private:
88  virtual void mainLoopBegin();
89  virtual void mainLoop();
90  virtual void mainLoopKill();
91  void process();
92  void addData(const OdometryEvent & odomEvent);
93  bool getData(OdometryEvent & data);
94  void pushNewState(State newState, const RtabmapEventCmd & cmdEvent = RtabmapEventCmd(RtabmapEventCmd::kCmdUndef));
95  void publishMap(bool optimized, bool full, bool graphOnly) const;
96 
97 private:
99  std::queue<State> _state;
100  std::queue<RtabmapEventCmd> _stateParam;
101 
102  std::list<OdometryEvent> _dataBuffer;
103  std::list<double> _newMapEvents;
106  unsigned int _dataBufferMaxSize;
107  float _rate;
111 
113  bool _paused;
115  cv::Mat covariance_;
116 
117  cv::Mat _userData;
119 };
120 
121 } /* namespace rtabmap */
122 #endif /* RTABMAPTHREAD_H_ */
Definition: UTimer.h:46
std::list< OdometryEvent > _dataBuffer
Definition: UEvent.h:57
bool getCreateIntermediateNodes() const
Definition: RtabmapThread.h:73
Definition: lz4.c:365
data
unsigned int _dataBufferMaxSize
std::queue< RtabmapEventCmd > _stateParam
#define RTABMAP_EXP
Definition: RtabmapExp.h:38
Definition: UMutex.h:54
unsigned int getDataBufferSize() const
Definition: RtabmapThread.h:72
float getDetectorRate() const
Definition: RtabmapThread.h:71
std::list< double > _newMapEvents
std::queue< State > _state
Definition: RtabmapThread.h:99


rtabmap
Author(s): Mathieu Labbe
autogenerated on Mon Jan 23 2023 03:37:30