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


rtabmap
Author(s): Mathieu Labbe
autogenerated on Wed Jun 5 2019 22:41:32