RTAB-Map 0.23.10
Real-Time Appearance-Based Mapping
Loading...
Searching...
No Matches
RtabmapEvent.h
1/*
2Copyright (c) 2010-2016, Mathieu Labbe - IntRoLab - Universite de Sherbrooke
3All rights reserved.
4
5Redistribution and use in source and binary forms, with or without
6modification, 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
16THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
17ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
18WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
19DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY
20DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
21(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
22LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
23ON 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
25SOFTWARE, 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>
35#include "rtabmap/core/Statistics.h"
36#include "rtabmap/core/Parameters.h"
37
38namespace rtabmap
39{
40
42class RtabmapEvent : public UEvent
43{
44public:
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
53private:
54 Statistics _stats;
55};
56
67class RtabmapEventCmd : public UEvent
68{
69public:
70 enum dummy {d}; // Hack, to fix Eclipse complaining about not defined Cmd enum ?!
93public:
94 RtabmapEventCmd(Cmd cmd, const ParametersMap & parameters = ParametersMap()) :
95 UEvent(0),
96 cmd_(cmd),
97 parameters_(parameters){}
98 RtabmapEventCmd(Cmd cmd, const UVariant & value1, const ParametersMap & parameters = ParametersMap()) :
99 UEvent(0),
100 cmd_(cmd),
101 value1_(value1),
102 parameters_(parameters){}
103 RtabmapEventCmd(Cmd cmd, const UVariant & value1, const UVariant & value2, const ParametersMap & parameters = ParametersMap()) :
104 UEvent(0),
105 cmd_(cmd),
106 value1_(value1),
107 value2_(value2),
108 parameters_(parameters){}
109 RtabmapEventCmd(Cmd cmd, const UVariant & value1, const UVariant & value2, const UVariant & value3, const ParametersMap & parameters = ParametersMap()) :
110 UEvent(0),
111 cmd_(cmd),
112 value1_(value1),
113 value2_(value2),
114 value3_(value3),
115 parameters_(parameters){}
116 RtabmapEventCmd(Cmd cmd, const UVariant & value1, const UVariant & value2, const UVariant & value3, const UVariant & value4, const ParametersMap & parameters = ParametersMap()) :
117 UEvent(0),
118 cmd_(cmd),
119 value1_(value1),
120 value2_(value2),
121 value3_(value3),
122 value4_(value4),
123 parameters_(parameters){}
124
125 virtual ~RtabmapEventCmd() {}
126 Cmd getCmd() const {return cmd_;}
127
128 const UVariant & value1() const {return value1_;}
129 const UVariant & value2() const {return value2_;}
130 const UVariant & value3() const {return value3_;}
131 const UVariant & value4() const {return value4_;}
132
133 const ParametersMap & getParameters() const {return parameters_;}
134
135 virtual std::string getClassName() const {return std::string("RtabmapEventCmd");}
136
137private:
138 Cmd cmd_;
139 UVariant value1_;
140 UVariant value2_;
141 UVariant value3_;
142 UVariant value4_;
143 ParametersMap parameters_;
144};
145
147{
148public:
149 enum dummy {d}; // Hack, to fix Eclipse complaining about not defined Status enum ?!
150 enum Status {
151 kInitializing,
152 kInitialized,
153 kClosing,
154 kClosed,
155 kInfo,
156 kError
157 };
158
159public:
160 RtabmapEventInit(Status status, const std::string & info = std::string()) :
161 UEvent(0),
162 _status(status),
163 _info(info)
164 {}
165
166 // for convenience
167 RtabmapEventInit(const std::string & info) :
168 UEvent(0),
169 _status(kInfo),
170 _info(info)
171 {}
172
173 Status getStatus() const {return _status;}
174 const std::string & getInfo() const {return _info;}
175
176 virtual ~RtabmapEventInit() {}
177 virtual std::string getClassName() const {return std::string("RtabmapEventInit");}
178private:
179 Status _status;
180 std::string _info; // "Loading signatures", "Loading words" ...
181};
182
184{
185public:
186 RtabmapEvent3DMap(int codeError = 0):
187 UEvent(codeError){}
189 const std::map<int, Signature> & signatures,
190 const std::map<int, Transform> & poses,
191 const std::multimap<int, Link> & constraints) :
192 UEvent(0),
193 _signatures(signatures),
194 _poses(poses),
195 _constraints(constraints)
196 {}
197
198 virtual ~RtabmapEvent3DMap() {}
199
200 const std::map<int, Signature> & getSignatures() const {return _signatures;}
201 const std::map<int, Transform> & getPoses() const {return _poses;}
202 const std::multimap<int, Link> & getConstraints() const {return _constraints;}
203
204 virtual std::string getClassName() const {return std::string("RtabmapEvent3DMap");}
205
206private:
207 std::map<int, Signature> _signatures;
208 std::map<int, Transform> _poses;
209 std::multimap<int, Link> _constraints;
210};
211
213{
214public:
216 UEvent(0),
217 _planningTime(0.0) {}
219 int goalId,
220 const std::vector<std::pair<int, Transform> > & poses,
221 double planningTime) :
222 UEvent(goalId),
223 _poses(poses),
224 _planningTime(planningTime) {}
226 int goalId,
227 const std::string & goalLabel,
228 const std::vector<std::pair<int, Transform> > & poses,
229 double planningTime) :
230 UEvent(goalId),
231 _goalLabel(goalLabel),
232 _poses(poses),
233 _planningTime(planningTime) {}
234
235 virtual ~RtabmapGlobalPathEvent() {}
236 int getGoal() const {return this->getCode();}
237 const std::string & getGoalLabel() const {return _goalLabel;}
238 double getPlanningTime() const {return _planningTime;}
239 const std::vector<std::pair<int, Transform> > & getPoses() const {return _poses;}
240 virtual std::string getClassName() const {return std::string("RtabmapGlobalPathEvent");}
241
242private:
243 std::string _goalLabel;
244 std::vector<std::pair<int, Transform> > _poses;
245 double _planningTime;
246};
247
249{
250public:
251 RtabmapLabelErrorEvent(int id, const std::string & label):
252 UEvent(id),
253 _label(label){}
254
255 virtual ~RtabmapLabelErrorEvent() {}
256 int id() const {return this->getCode();}
257 const std::string & label() const {return _label;}
258 virtual std::string getClassName() const {return std::string("RtabmapLabelErrorEvent");}
259
260private:
261 std::string _label;
262};
263
265{
266public:
267 RtabmapGoalStatusEvent(int status):
268 UEvent(status){}
269
270 virtual ~RtabmapGoalStatusEvent() {}
271 virtual std::string getClassName() const {return std::string("RtabmapGoalStatusEvent");}
272};
273
274} // namespace rtabmap
275
276#endif /* RTABMAPEVENT_H_ */
UVariant class for storing and converting between different data types.
int getCode() const
Definition UEvent.h:74
A variant type that can hold values of different types.
Definition UVariant.h:54
virtual std::string getClassName() const
Command sent to RtabmapThread, with its parameters.
virtual std::string getClassName() const
Cmd
What the receiving RtabmapThread should do.
virtual std::string getClassName() const
virtual std::string getClassName() const
virtual std::string getClassName() const
virtual std::string getClassName() const
virtual std::string getClassName() const
Collects and manages runtime statistics for RTAB-Map.
Definition Statistics.h:108
std::map< std::string, std::string > ParametersMap
Parameter keys mapped to their values, as used by every configurable class (see Parameters).
Definition Parameters.h:44