00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028 #ifndef RTABMAPEVENT_H_
00029 #define RTABMAPEVENT_H_
00030
00031
00032
00033 #include <rtabmap/utilite/UEvent.h>
00034 #include <rtabmap/utilite/UVariant.h>
00035 #include "rtabmap/core/Statistics.h"
00036 #include "rtabmap/core/Parameters.h"
00037
00038 namespace rtabmap
00039 {
00040
00042 class RtabmapEvent : public UEvent
00043 {
00044 public:
00045 RtabmapEvent(const Statistics & stats) :
00046 UEvent(0),
00047 _stats(stats) {}
00048
00049 virtual ~RtabmapEvent() {}
00050 const Statistics & getStats() const {return _stats;}
00051 virtual std::string getClassName() const {return std::string("RtabmapEvent");}
00052
00053 private:
00054 Statistics _stats;
00055 };
00056
00057 class RtabmapEventCmd : public UEvent
00058 {
00059 public:
00060 enum dummy {d};
00061 enum Cmd {
00062 kCmdInit,
00063 kCmdResetMemory,
00064 kCmdClose,
00065 kCmdDumpMemory,
00066 kCmdDumpPrediction,
00067 kCmdGenerateDOTGraph,
00068 kCmdExportPoses,
00069 kCmdCleanDataBuffer,
00070 kCmdPublish3DMap,
00071 kCmdTriggerNewMap,
00072 kCmdPause,
00073 kCmdResume,
00074 kCmdGoal,
00075 kCmdCancelGoal,
00076 kCmdLabel
00077 };
00078 public:
00079 RtabmapEventCmd(Cmd cmd, const ParametersMap & parameters = ParametersMap()) :
00080 UEvent(0),
00081 cmd_(cmd),
00082 parameters_(parameters){}
00083 RtabmapEventCmd(Cmd cmd, const UVariant & value1, const ParametersMap & parameters = ParametersMap()) :
00084 UEvent(0),
00085 cmd_(cmd),
00086 value1_(value1),
00087 parameters_(parameters){}
00088 RtabmapEventCmd(Cmd cmd, const UVariant & value1, const UVariant & value2, const ParametersMap & parameters = ParametersMap()) :
00089 UEvent(0),
00090 cmd_(cmd),
00091 value1_(value1),
00092 value2_(value2),
00093 parameters_(parameters){}
00094 RtabmapEventCmd(Cmd cmd, const UVariant & value1, const UVariant & value2, const UVariant & value3, const ParametersMap & parameters = ParametersMap()) :
00095 UEvent(0),
00096 cmd_(cmd),
00097 value1_(value1),
00098 value2_(value2),
00099 value3_(value3),
00100 parameters_(parameters){}
00101 RtabmapEventCmd(Cmd cmd, const UVariant & value1, const UVariant & value2, const UVariant & value3, const UVariant & value4, const ParametersMap & parameters = ParametersMap()) :
00102 UEvent(0),
00103 cmd_(cmd),
00104 value1_(value1),
00105 value2_(value2),
00106 value3_(value3),
00107 value4_(value4),
00108 parameters_(parameters){}
00109
00110 virtual ~RtabmapEventCmd() {}
00111 Cmd getCmd() const {return cmd_;}
00112
00113 const UVariant & value1() const {return value1_;}
00114 const UVariant & value2() const {return value2_;}
00115 const UVariant & value3() const {return value3_;}
00116 const UVariant & value4() const {return value4_;}
00117
00118 const ParametersMap & getParameters() const {return parameters_;}
00119
00120 virtual std::string getClassName() const {return std::string("RtabmapEventCmd");}
00121
00122 private:
00123 Cmd cmd_;
00124 UVariant value1_;
00125 UVariant value2_;
00126 UVariant value3_;
00127 UVariant value4_;
00128 ParametersMap parameters_;
00129 };
00130
00131 class RtabmapEventInit : public UEvent
00132 {
00133 public:
00134 enum dummy {d};
00135 enum Status {
00136 kInitializing,
00137 kInitialized,
00138 kClosing,
00139 kClosed,
00140 kInfo,
00141 kError
00142 };
00143
00144 public:
00145 RtabmapEventInit(Status status, const std::string & info = std::string()) :
00146 UEvent(0),
00147 _status(status),
00148 _info(info)
00149 {}
00150
00151
00152 RtabmapEventInit(const std::string & info) :
00153 UEvent(0),
00154 _status(kInfo),
00155 _info(info)
00156 {}
00157
00158 Status getStatus() const {return _status;}
00159 const std::string & getInfo() const {return _info;}
00160
00161 virtual ~RtabmapEventInit() {}
00162 virtual std::string getClassName() const {return std::string("RtabmapEventInit");}
00163 private:
00164 Status _status;
00165 std::string _info;
00166 };
00167
00168 class RtabmapEvent3DMap : public UEvent
00169 {
00170 public:
00171 RtabmapEvent3DMap(int codeError = 0):
00172 UEvent(codeError){}
00173 RtabmapEvent3DMap(
00174 const std::map<int, Signature> & signatures,
00175 const std::map<int, Transform> & poses,
00176 const std::multimap<int, Link> & constraints) :
00177 UEvent(0),
00178 _signatures(signatures),
00179 _poses(poses),
00180 _constraints(constraints)
00181 {}
00182
00183 virtual ~RtabmapEvent3DMap() {}
00184
00185 const std::map<int, Signature> & getSignatures() const {return _signatures;}
00186 const std::map<int, Transform> & getPoses() const {return _poses;}
00187 const std::multimap<int, Link> & getConstraints() const {return _constraints;}
00188
00189 virtual std::string getClassName() const {return std::string("RtabmapEvent3DMap");}
00190
00191 private:
00192 std::map<int, Signature> _signatures;
00193 std::map<int, Transform> _poses;
00194 std::multimap<int, Link> _constraints;
00195 };
00196
00197 class RtabmapGlobalPathEvent : public UEvent
00198 {
00199 public:
00200 RtabmapGlobalPathEvent():
00201 UEvent(0),
00202 _planningTime(0.0) {}
00203 RtabmapGlobalPathEvent(
00204 int goalId,
00205 const std::vector<std::pair<int, Transform> > & poses,
00206 double planningTime) :
00207 UEvent(goalId),
00208 _poses(poses),
00209 _planningTime(planningTime) {}
00210 RtabmapGlobalPathEvent(
00211 int goalId,
00212 const std::string & goalLabel,
00213 const std::vector<std::pair<int, Transform> > & poses,
00214 double planningTime) :
00215 UEvent(goalId),
00216 _goalLabel(goalLabel),
00217 _poses(poses),
00218 _planningTime(planningTime) {}
00219
00220 virtual ~RtabmapGlobalPathEvent() {}
00221 int getGoal() const {return this->getCode();}
00222 const std::string & getGoalLabel() const {return _goalLabel;}
00223 double getPlanningTime() const {return _planningTime;}
00224 const std::vector<std::pair<int, Transform> > & getPoses() const {return _poses;}
00225 virtual std::string getClassName() const {return std::string("RtabmapGlobalPathEvent");}
00226
00227 private:
00228 std::string _goalLabel;
00229 std::vector<std::pair<int, Transform> > _poses;
00230 double _planningTime;
00231 };
00232
00233 class RtabmapLabelErrorEvent : public UEvent
00234 {
00235 public:
00236 RtabmapLabelErrorEvent(int id, const std::string & label):
00237 UEvent(id),
00238 _label(label){}
00239
00240 virtual ~RtabmapLabelErrorEvent() {}
00241 int id() const {return this->getCode();}
00242 const std::string & label() const {return _label;}
00243 virtual std::string getClassName() const {return std::string("RtabmapLabelErrorEvent");}
00244
00245 private:
00246 std::string _label;
00247 };
00248
00249 class RtabmapGoalStatusEvent : public UEvent
00250 {
00251 public:
00252 RtabmapGoalStatusEvent(int status):
00253 UEvent(status){}
00254
00255 virtual ~RtabmapGoalStatusEvent() {}
00256 virtual std::string getClassName() const {return std::string("RtabmapGoalStatusEvent");}
00257 };
00258
00259 }
00260
00261 #endif