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 {
145  kError
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_ */
d
const ParametersMap & getParameters() const
Definition: RtabmapEvent.h:122
const std::string & getGoalLabel() const
Definition: RtabmapEvent.h:226
Definition: UEvent.h:57
const std::string & label() const
Definition: RtabmapEvent.h:246
virtual std::string getClassName() const
Definition: RtabmapEvent.h:193
RtabmapEventCmd(Cmd cmd, const UVariant &value1, const UVariant &value2, const UVariant &value3, const ParametersMap &parameters=ParametersMap())
Definition: RtabmapEvent.h:98
RtabmapEventCmd(Cmd cmd, const ParametersMap &parameters=ParametersMap())
Definition: RtabmapEvent.h:83
RtabmapEventCmd(Cmd cmd, const UVariant &value1, const UVariant &value2, const UVariant &value3, const UVariant &value4, const ParametersMap &parameters=ParametersMap())
Definition: RtabmapEvent.h:105
const std::multimap< int, Link > & getConstraints() const
Definition: RtabmapEvent.h:191
std::map< std::string, std::string > ParametersMap
Definition: Parameters.h:43
std::map< int, Transform > _poses
Definition: RtabmapEvent.h:197
const UVariant & value4() const
Definition: RtabmapEvent.h:120
RtabmapLabelErrorEvent(int id, const std::string &label)
Definition: RtabmapEvent.h:240
int getCode() const
Definition: UEvent.h:74
RtabmapEvent3DMap(int codeError=0)
Definition: RtabmapEvent.h:175
RtabmapEventCmd(Cmd cmd, const UVariant &value1, const UVariant &value2, const ParametersMap &parameters=ParametersMap())
Definition: RtabmapEvent.h:92
RtabmapEventInit(Status status, const std::string &info=std::string())
Definition: RtabmapEvent.h:149
const std::string & getInfo() const
Definition: RtabmapEvent.h:163
std::map< int, Signature > _signatures
Definition: RtabmapEvent.h:196
virtual std::string getClassName() const
Definition: RtabmapEvent.h:124
const std::map< int, Signature > & getSignatures() const
Definition: RtabmapEvent.h:189
const UVariant & value3() const
Definition: RtabmapEvent.h:119
RtabmapGlobalPathEvent(int goalId, const std::string &goalLabel, const std::vector< std::pair< int, Transform > > &poses, double planningTime)
Definition: RtabmapEvent.h:214
virtual std::string getClassName() const
Definition: RtabmapEvent.h:260
std::multimap< int, Link > _constraints
Definition: RtabmapEvent.h:198
RtabmapEvent(const Statistics &stats)
Definition: RtabmapEvent.h:45
Status getStatus() const
Definition: RtabmapEvent.h:162
ParametersMap parameters_
Definition: RtabmapEvent.h:132
RtabmapEventCmd(Cmd cmd, const UVariant &value1, const ParametersMap &parameters=ParametersMap())
Definition: RtabmapEvent.h:87
virtual std::string getClassName() const
Definition: RtabmapEvent.h:166
virtual std::string getClassName() const
Definition: RtabmapEvent.h:229
virtual std::string getClassName() const
Definition: RtabmapEvent.h:247
std::vector< std::pair< int, Transform > > _poses
Definition: RtabmapEvent.h:233
const UVariant & value2() const
Definition: RtabmapEvent.h:118
const Statistics & getStats() const
Definition: RtabmapEvent.h:50
virtual std::string getClassName() const
Definition: RtabmapEvent.h:51
RtabmapGlobalPathEvent(int goalId, const std::vector< std::pair< int, Transform > > &poses, double planningTime)
Definition: RtabmapEvent.h:207
RtabmapEvent3DMap(const std::map< int, Signature > &signatures, const std::map< int, Transform > &poses, const std::multimap< int, Link > &constraints)
Definition: RtabmapEvent.h:177
RtabmapEventInit(const std::string &info)
Definition: RtabmapEvent.h:156
const std::map< int, Transform > & getPoses() const
Definition: RtabmapEvent.h:190
const UVariant & value1() const
Definition: RtabmapEvent.h:117
const std::vector< std::pair< int, Transform > > & getPoses() const
Definition: RtabmapEvent.h:228


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