RtabmapEvent.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 RTABMAPEVENT_H_
29 #define RTABMAPEVENT_H_
30 
31 
32 
33 #include <rtabmap/utilite/UEvent.h>
37 
38 namespace rtabmap
39 {
40 
42 class RtabmapEvent : public UEvent
43 {
44 public:
45  RtabmapEvent(const Statistics & stats) :
46  UEvent(0),
47  _stats(stats) {}
48 
49  virtual ~RtabmapEvent() {}
50  const Statistics & getStats() const {return _stats;}
51  virtual std::string getClassName() const {return std::string("RtabmapEvent");}
52 
53 private:
55 };
56 
57 class RtabmapEventCmd : public UEvent
58 {
59 public:
60  enum dummy {d}; // Hack, to fix Eclipse complaining about not defined Cmd enum ?!
61  enum Cmd {
63  kCmdInit, // params: [string] database path + ParametersMap
65  kCmdClose, // params: [bool] database saved (default true), [string] output database path (empty=use same database to save, only work when Db/Sqlite3InMemory=true)
66  kCmdUpdateParams, // params: ParametersMap
69  kCmdGenerateDOTGraph, // params: [bool] global, [string] path, if global=false: [int] id, [int] margin
70  kCmdExportPoses, // params: [bool] global, [bool] optimized, [string] path, [int] type (0=raw format, 1=RGBD-SLAM format, 2=KITTI format, 3=TORO, 4=g2o)
72  kCmdPublish3DMap, // params: [bool] global, [bool] optimized, [bool] graphOnly
73  kCmdRepublishData, // params: [vector<int>] ids
77  kCmdGoal, // params: [string] label or [int] location ID
79  kCmdLabel, // params: [string] label, [int] location ID
80  kCmdRemoveLabel // params: [string] label
81  };
82 public:
83  RtabmapEventCmd(Cmd cmd, const ParametersMap & parameters = ParametersMap()) :
84  UEvent(0),
85  cmd_(cmd),
86  parameters_(parameters){}
87  RtabmapEventCmd(Cmd cmd, const UVariant & value1, const ParametersMap & parameters = ParametersMap()) :
88  UEvent(0),
89  cmd_(cmd),
90  value1_(value1),
91  parameters_(parameters){}
92  RtabmapEventCmd(Cmd cmd, const UVariant & value1, const UVariant & value2, const ParametersMap & parameters = ParametersMap()) :
93  UEvent(0),
94  cmd_(cmd),
95  value1_(value1),
96  value2_(value2),
97  parameters_(parameters){}
98  RtabmapEventCmd(Cmd cmd, const UVariant & value1, const UVariant & value2, const UVariant & value3, const ParametersMap & parameters = ParametersMap()) :
99  UEvent(0),
100  cmd_(cmd),
101  value1_(value1),
102  value2_(value2),
103  value3_(value3),
104  parameters_(parameters){}
105  RtabmapEventCmd(Cmd cmd, const UVariant & value1, const UVariant & value2, const UVariant & value3, const UVariant & value4, const ParametersMap & parameters = ParametersMap()) :
106  UEvent(0),
107  cmd_(cmd),
108  value1_(value1),
109  value2_(value2),
110  value3_(value3),
111  value4_(value4),
112  parameters_(parameters){}
113 
114  virtual ~RtabmapEventCmd() {}
115  Cmd getCmd() const {return cmd_;}
116 
117  const UVariant & value1() const {return value1_;}
118  const UVariant & value2() const {return value2_;}
119  const UVariant & value3() const {return value3_;}
120  const UVariant & value4() const {return value4_;}
121 
122  const ParametersMap & getParameters() const {return parameters_;}
123 
124  virtual std::string getClassName() const {return std::string("RtabmapEventCmd");}
125 
126 private:
133 };
134 
135 class RtabmapEventInit : public UEvent
136 {
137 public:
138  enum dummy {d}; // Hack, to fix Eclipse complaining about not defined Status enum ?!
139  enum Status {
146  };
147 
148 public:
149  RtabmapEventInit(Status status, const std::string & info = std::string()) :
150  UEvent(0),
151  _status(status),
152  _info(info)
153  {}
154 
155  // for convenience
156  RtabmapEventInit(const std::string & info) :
157  UEvent(0),
158  _status(kInfo),
159  _info(info)
160  {}
161 
162  Status getStatus() const {return _status;}
163  const std::string & getInfo() const {return _info;}
164 
165  virtual ~RtabmapEventInit() {}
166  virtual std::string getClassName() const {return std::string("RtabmapEventInit");}
167 private:
169  std::string _info; // "Loading signatures", "Loading words" ...
170 };
171 
172 class RtabmapEvent3DMap : public UEvent
173 {
174 public:
175  RtabmapEvent3DMap(int codeError = 0):
176  UEvent(codeError){}
178  const std::map<int, Signature> & signatures,
179  const std::map<int, Transform> & poses,
180  const std::multimap<int, Link> & constraints) :
181  UEvent(0),
182  _signatures(signatures),
183  _poses(poses),
184  _constraints(constraints)
185  {}
186 
187  virtual ~RtabmapEvent3DMap() {}
188 
189  const std::map<int, Signature> & getSignatures() const {return _signatures;}
190  const std::map<int, Transform> & getPoses() const {return _poses;}
191  const std::multimap<int, Link> & getConstraints() const {return _constraints;}
192 
193  virtual std::string getClassName() const {return std::string("RtabmapEvent3DMap");}
194 
195 private:
196  std::map<int, Signature> _signatures;
197  std::map<int, Transform> _poses;
198  std::multimap<int, Link> _constraints;
199 };
200 
202 {
203 public:
205  UEvent(0),
206  _planningTime(0.0) {}
208  int goalId,
209  const std::vector<std::pair<int, Transform> > & poses,
210  double planningTime) :
211  UEvent(goalId),
212  _poses(poses),
213  _planningTime(planningTime) {}
215  int goalId,
216  const std::string & goalLabel,
217  const std::vector<std::pair<int, Transform> > & poses,
218  double planningTime) :
219  UEvent(goalId),
220  _goalLabel(goalLabel),
221  _poses(poses),
222  _planningTime(planningTime) {}
223 
225  int getGoal() const {return this->getCode();}
226  const std::string & getGoalLabel() const {return _goalLabel;}
227  double getPlanningTime() const {return _planningTime;}
228  const std::vector<std::pair<int, Transform> > & getPoses() const {return _poses;}
229  virtual std::string getClassName() const {return std::string("RtabmapGlobalPathEvent");}
230 
231 private:
232  std::string _goalLabel;
233  std::vector<std::pair<int, Transform> > _poses;
235 };
236 
238 {
239 public:
240  RtabmapLabelErrorEvent(int id, const std::string & label):
241  UEvent(id),
242  _label(label){}
243 
245  int id() const {return this->getCode();}
246  const std::string & label() const {return _label;}
247  virtual std::string getClassName() const {return std::string("RtabmapLabelErrorEvent");}
248 
249 private:
250  std::string _label;
251 };
252 
254 {
255 public:
257  UEvent(status){}
258 
260  virtual std::string getClassName() const {return std::string("RtabmapGoalStatusEvent");}
261 };
262 
263 } // namespace rtabmap
264 
265 #endif /* RTABMAPEVENT_H_ */
rtabmap::RtabmapEventInit::RtabmapEventInit
RtabmapEventInit(const std::string &info)
Definition: RtabmapEvent.h:156
rtabmap::RtabmapGlobalPathEvent::getGoal
int getGoal() const
Definition: RtabmapEvent.h:225
rtabmap::RtabmapEventInit::kInitialized
@ kInitialized
Definition: RtabmapEvent.h:141
rtabmap::Statistics
Definition: Statistics.h:53
rtabmap::RtabmapEventInit::RtabmapEventInit
RtabmapEventInit(Status status, const std::string &info=std::string())
Definition: RtabmapEvent.h:149
rtabmap::RtabmapEventCmd
Definition: RtabmapEvent.h:57
rtabmap::RtabmapEventInit
Definition: RtabmapEvent.h:135
rtabmap::RtabmapEventInit::Status
Status
Definition: RtabmapEvent.h:139
rtabmap::RtabmapEventCmd::getCmd
Cmd getCmd() const
Definition: RtabmapEvent.h:115
rtabmap::RtabmapLabelErrorEvent::_label
std::string _label
Definition: RtabmapEvent.h:250
rtabmap::RtabmapEvent3DMap::_signatures
std::map< int, Signature > _signatures
Definition: RtabmapEvent.h:196
rtabmap::RtabmapEventCmd::kCmdPublish3DMap
@ kCmdPublish3DMap
Definition: RtabmapEvent.h:72
rtabmap::RtabmapEventCmd::RtabmapEventCmd
RtabmapEventCmd(Cmd cmd, const UVariant &value1, const UVariant &value2, const UVariant &value3, const UVariant &value4, const ParametersMap &parameters=ParametersMap())
Definition: RtabmapEvent.h:105
rtabmap::RtabmapEventCmd::value2_
UVariant value2_
Definition: RtabmapEvent.h:129
rtabmap::RtabmapEventCmd::kCmdGenerateDOTGraph
@ kCmdGenerateDOTGraph
Definition: RtabmapEvent.h:69
rtabmap::RtabmapEventCmd::d
@ d
Definition: RtabmapEvent.h:60
rtabmap::RtabmapGlobalPathEvent::_planningTime
double _planningTime
Definition: RtabmapEvent.h:234
rtabmap::RtabmapEventCmd::value3
const UVariant & value3() const
Definition: RtabmapEvent.h:119
rtabmap::RtabmapEventCmd::kCmdExportPoses
@ kCmdExportPoses
Definition: RtabmapEvent.h:70
rtabmap::RtabmapEventCmd::kCmdTriggerNewMap
@ kCmdTriggerNewMap
Definition: RtabmapEvent.h:74
rtabmap::RtabmapLabelErrorEvent
Definition: RtabmapEvent.h:237
rtabmap::RtabmapEventCmd::getClassName
virtual std::string getClassName() const
Definition: RtabmapEvent.h:124
rtabmap::RtabmapEventCmd::value3_
UVariant value3_
Definition: RtabmapEvent.h:130
rtabmap::RtabmapEvent
Definition: RtabmapEvent.h:42
rtabmap::RtabmapEventCmd::kCmdDumpMemory
@ kCmdDumpMemory
Definition: RtabmapEvent.h:67
rtabmap::RtabmapEventCmd::kCmdUndef
@ kCmdUndef
Definition: RtabmapEvent.h:62
UEvent::getCode
int getCode() const
Definition: UEvent.h:74
rtabmap::RtabmapEventInit::kError
@ kError
Definition: RtabmapEvent.h:145
rtabmap::RtabmapEvent3DMap::getSignatures
const std::map< int, Signature > & getSignatures() const
Definition: RtabmapEvent.h:189
rtabmap::RtabmapGlobalPathEvent::getPlanningTime
double getPlanningTime() const
Definition: RtabmapEvent.h:227
rtabmap::RtabmapEventCmd::kCmdUpdateParams
@ kCmdUpdateParams
Definition: RtabmapEvent.h:66
rtabmap::RtabmapEventInit::kInfo
@ kInfo
Definition: RtabmapEvent.h:144
rtabmap::RtabmapEventCmd::RtabmapEventCmd
RtabmapEventCmd(Cmd cmd, const UVariant &value1, const UVariant &value2, const ParametersMap &parameters=ParametersMap())
Definition: RtabmapEvent.h:92
rtabmap::ParametersMap
std::map< std::string, std::string > ParametersMap
Definition: Parameters.h:43
rtabmap::RtabmapGlobalPathEvent::~RtabmapGlobalPathEvent
virtual ~RtabmapGlobalPathEvent()
Definition: RtabmapEvent.h:224
rtabmap::RtabmapEventCmd::kCmdRepublishData
@ kCmdRepublishData
Definition: RtabmapEvent.h:73
rtabmap::RtabmapEvent3DMap::_constraints
std::multimap< int, Link > _constraints
Definition: RtabmapEvent.h:198
rtabmap::RtabmapEventCmd::kCmdResetMemory
@ kCmdResetMemory
Definition: RtabmapEvent.h:64
rtabmap::RtabmapEventCmd::value2
const UVariant & value2() const
Definition: RtabmapEvent.h:118
rtabmap::RtabmapEventCmd::RtabmapEventCmd
RtabmapEventCmd(Cmd cmd, const ParametersMap &parameters=ParametersMap())
Definition: RtabmapEvent.h:83
rtabmap::RtabmapEvent::RtabmapEvent
RtabmapEvent(const Statistics &stats)
Definition: RtabmapEvent.h:45
rtabmap::RtabmapEventCmd::kCmdInit
@ kCmdInit
Definition: RtabmapEvent.h:63
Parameters.h
rtabmap::RtabmapEventCmd::value1
const UVariant & value1() const
Definition: RtabmapEvent.h:117
UEvent
Definition: UEvent.h:57
rtabmap::RtabmapLabelErrorEvent::RtabmapLabelErrorEvent
RtabmapLabelErrorEvent(int id, const std::string &label)
Definition: RtabmapEvent.h:240
rtabmap::RtabmapEventCmd::RtabmapEventCmd
RtabmapEventCmd(Cmd cmd, const UVariant &value1, const UVariant &value2, const UVariant &value3, const ParametersMap &parameters=ParametersMap())
Definition: RtabmapEvent.h:98
UVariant.h
UEvent.h
rtabmap::RtabmapLabelErrorEvent::~RtabmapLabelErrorEvent
virtual ~RtabmapLabelErrorEvent()
Definition: RtabmapEvent.h:244
rtabmap::RtabmapEventInit::_info
std::string _info
Definition: RtabmapEvent.h:169
rtabmap::RtabmapEventCmd::value4
const UVariant & value4() const
Definition: RtabmapEvent.h:120
rtabmap::RtabmapEventCmd::Cmd
Cmd
Definition: RtabmapEvent.h:61
rtabmap::RtabmapEvent3DMap
Definition: RtabmapEvent.h:172
stats
bool stats
rtabmap::RtabmapEvent::_stats
Statistics _stats
Definition: RtabmapEvent.h:54
rtabmap::RtabmapEventInit::d
@ d
Definition: RtabmapEvent.h:138
rtabmap::RtabmapGlobalPathEvent::_goalLabel
std::string _goalLabel
Definition: RtabmapEvent.h:232
rtabmap::RtabmapEvent3DMap::~RtabmapEvent3DMap
virtual ~RtabmapEvent3DMap()
Definition: RtabmapEvent.h:187
rtabmap::RtabmapEventInit::~RtabmapEventInit
virtual ~RtabmapEventInit()
Definition: RtabmapEvent.h:165
rtabmap::RtabmapEventInit::getClassName
virtual std::string getClassName() const
Definition: RtabmapEvent.h:166
rtabmap::RtabmapEventCmd::value4_
UVariant value4_
Definition: RtabmapEvent.h:131
rtabmap::RtabmapEventInit::dummy
dummy
Definition: RtabmapEvent.h:138
rtabmap::RtabmapEvent3DMap::RtabmapEvent3DMap
RtabmapEvent3DMap(int codeError=0)
Definition: RtabmapEvent.h:175
rtabmap::RtabmapLabelErrorEvent::label
const std::string & label() const
Definition: RtabmapEvent.h:246
rtabmap::RtabmapEvent3DMap::RtabmapEvent3DMap
RtabmapEvent3DMap(const std::map< int, Signature > &signatures, const std::map< int, Transform > &poses, const std::multimap< int, Link > &constraints)
Definition: RtabmapEvent.h:177
rtabmap::RtabmapGoalStatusEvent::RtabmapGoalStatusEvent
RtabmapGoalStatusEvent(int status)
Definition: RtabmapEvent.h:256
info
else if n * info
rtabmap::RtabmapGlobalPathEvent::RtabmapGlobalPathEvent
RtabmapGlobalPathEvent(int goalId, const std::string &goalLabel, const std::vector< std::pair< int, Transform > > &poses, double planningTime)
Definition: RtabmapEvent.h:214
rtabmap::RtabmapEvent::~RtabmapEvent
virtual ~RtabmapEvent()
Definition: RtabmapEvent.h:49
rtabmap::RtabmapEventInit::kClosed
@ kClosed
Definition: RtabmapEvent.h:143
rtabmap::RtabmapLabelErrorEvent::id
int id() const
Definition: RtabmapEvent.h:245
rtabmap::RtabmapLabelErrorEvent::getClassName
virtual std::string getClassName() const
Definition: RtabmapEvent.h:247
rtabmap::RtabmapEventCmd::kCmdGoal
@ kCmdGoal
Definition: RtabmapEvent.h:77
rtabmap::RtabmapEventCmd::~RtabmapEventCmd
virtual ~RtabmapEventCmd()
Definition: RtabmapEvent.h:114
rtabmap::RtabmapGlobalPathEvent::getGoalLabel
const std::string & getGoalLabel() const
Definition: RtabmapEvent.h:226
rtabmap::RtabmapEventCmd::kCmdLabel
@ kCmdLabel
Definition: RtabmapEvent.h:79
rtabmap::RtabmapEventCmd::cmd_
Cmd cmd_
Definition: RtabmapEvent.h:127
rtabmap::RtabmapEventCmd::RtabmapEventCmd
RtabmapEventCmd(Cmd cmd, const UVariant &value1, const ParametersMap &parameters=ParametersMap())
Definition: RtabmapEvent.h:87
rtabmap::RtabmapEventInit::_status
Status _status
Definition: RtabmapEvent.h:168
rtabmap::RtabmapGoalStatusEvent
Definition: RtabmapEvent.h:253
rtabmap::RtabmapEventCmd::value1_
UVariant value1_
Definition: RtabmapEvent.h:128
rtabmap::RtabmapEvent3DMap::getClassName
virtual std::string getClassName() const
Definition: RtabmapEvent.h:193
rtabmap::RtabmapEventInit::kClosing
@ kClosing
Definition: RtabmapEvent.h:142
rtabmap::RtabmapEventCmd::kCmdCancelGoal
@ kCmdCancelGoal
Definition: RtabmapEvent.h:78
UVariant
Definition: UVariant.h:30
rtabmap::RtabmapEventCmd::getParameters
const ParametersMap & getParameters() const
Definition: RtabmapEvent.h:122
rtabmap::RtabmapEventCmd::kCmdCleanDataBuffer
@ kCmdCleanDataBuffer
Definition: RtabmapEvent.h:71
rtabmap::RtabmapGlobalPathEvent::getClassName
virtual std::string getClassName() const
Definition: RtabmapEvent.h:229
rtabmap::RtabmapEventInit::getStatus
Status getStatus() const
Definition: RtabmapEvent.h:162
rtabmap::RtabmapEventCmd::kCmdClose
@ kCmdClose
Definition: RtabmapEvent.h:65
rtabmap::RtabmapEvent3DMap::getPoses
const std::map< int, Transform > & getPoses() const
Definition: RtabmapEvent.h:190
rtabmap::RtabmapGlobalPathEvent::RtabmapGlobalPathEvent
RtabmapGlobalPathEvent(int goalId, const std::vector< std::pair< int, Transform > > &poses, double planningTime)
Definition: RtabmapEvent.h:207
rtabmap::RtabmapGlobalPathEvent::_poses
std::vector< std::pair< int, Transform > > _poses
Definition: RtabmapEvent.h:233
Statistics.h
rtabmap::RtabmapEvent3DMap::_poses
std::map< int, Transform > _poses
Definition: RtabmapEvent.h:197
rtabmap::RtabmapGlobalPathEvent::getPoses
const std::vector< std::pair< int, Transform > > & getPoses() const
Definition: RtabmapEvent.h:228
rtabmap::RtabmapGoalStatusEvent::~RtabmapGoalStatusEvent
virtual ~RtabmapGoalStatusEvent()
Definition: RtabmapEvent.h:259
rtabmap::RtabmapEventCmd::kCmdResume
@ kCmdResume
Definition: RtabmapEvent.h:76
rtabmap::RtabmapEvent3DMap::getConstraints
const std::multimap< int, Link > & getConstraints() const
Definition: RtabmapEvent.h:191
cmd
string cmd
rtabmap::RtabmapEvent::getClassName
virtual std::string getClassName() const
Definition: RtabmapEvent.h:51
rtabmap::RtabmapEventCmd::kCmdRemoveLabel
@ kCmdRemoveLabel
Definition: RtabmapEvent.h:80
rtabmap::RtabmapEventCmd::kCmdPause
@ kCmdPause
Definition: RtabmapEvent.h:75
rtabmap
Definition: CameraARCore.cpp:35
rtabmap::RtabmapGlobalPathEvent
Definition: RtabmapEvent.h:201
rtabmap::RtabmapEventCmd::parameters_
ParametersMap parameters_
Definition: RtabmapEvent.h:132
rtabmap::RtabmapEventInit::kInitializing
@ kInitializing
Definition: RtabmapEvent.h:140
rtabmap::RtabmapEventInit::getInfo
const std::string & getInfo() const
Definition: RtabmapEvent.h:163
rtabmap::RtabmapEventCmd::kCmdDumpPrediction
@ kCmdDumpPrediction
Definition: RtabmapEvent.h:68
rtabmap::RtabmapGlobalPathEvent::RtabmapGlobalPathEvent
RtabmapGlobalPathEvent()
Definition: RtabmapEvent.h:204
rtabmap::RtabmapEventCmd::dummy
dummy
Definition: RtabmapEvent.h:60
rtabmap::RtabmapEvent::getStats
const Statistics & getStats() const
Definition: RtabmapEvent.h:50
rtabmap::RtabmapGoalStatusEvent::getClassName
virtual std::string getClassName() const
Definition: RtabmapEvent.h:260


rtabmap
Author(s): Mathieu Labbe
autogenerated on Thu Jul 25 2024 02:50:15