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/core/Statistics.h"
00035 #include "rtabmap/core/Parameters.h"
00036
00037 namespace rtabmap
00038 {
00039
00041 class RtabmapEvent : public UEvent
00042 {
00043 public:
00044 RtabmapEvent(const Statistics & stats) :
00045 UEvent(0),
00046 _stats(stats) {}
00047
00048 virtual ~RtabmapEvent() {}
00049 const Statistics & getStats() const {return _stats;}
00050 virtual std::string getClassName() const {return std::string("RtabmapEvent");}
00051
00052 private:
00053 Statistics _stats;
00054 };
00055
00056 class RtabmapEventCmd : public UEvent
00057 {
00058 public:
00059 enum dummy {d};
00060 enum Cmd {
00061 kCmdInit,
00062 kCmdResetMemory,
00063 kCmdClose,
00064 kCmdDumpMemory,
00065 kCmdDumpPrediction,
00066 kCmdGenerateDOTGraph,
00067 kCmdGenerateDOTLocalGraph,
00068 kCmdGenerateTOROGraphLocal,
00069 kCmdGenerateTOROGraphGlobal,
00070 kCmdCleanDataBuffer,
00071 kCmdPublish3DMapLocal,
00072 kCmdPublish3DMapGlobal,
00073 kCmdPublishTOROGraphGlobal,
00074 kCmdPublishTOROGraphLocal,
00075 kCmdTriggerNewMap,
00076 kCmdPause,
00077 kCmdGoal};
00078 public:
00079 RtabmapEventCmd(Cmd cmd, const std::string & strValue = "", int intValue = 0, const ParametersMap & parameters = ParametersMap()) :
00080 UEvent(0),
00081 _cmd(cmd),
00082 _strValue(strValue),
00083 _intValue(intValue),
00084 _parameters(parameters){}
00085
00086 virtual ~RtabmapEventCmd() {}
00087 Cmd getCmd() const {return _cmd;}
00088
00089 void setStr(const std::string & str) {_strValue = str;}
00090 const std::string & getStr() const {return _strValue;}
00091
00092 void setInt(int v) {_intValue = v;}
00093 int getInt() const {return _intValue;}
00094
00095 const ParametersMap & getParameters() const {return _parameters;}
00096
00097 virtual std::string getClassName() const {return std::string("RtabmapEventCmd");}
00098
00099 private:
00100 Cmd _cmd;
00101 std::string _strValue;
00102 int _intValue;
00103 ParametersMap _parameters;
00104 };
00105
00106 class RtabmapEventInit : public UEvent
00107 {
00108 public:
00109 enum dummy {d};
00110 enum Status {
00111 kInitializing,
00112 kInitialized,
00113 kClosing,
00114 kClosed,
00115 kInfo,
00116 kError
00117 };
00118
00119 public:
00120 RtabmapEventInit(Status status, const std::string & info = std::string()) :
00121 UEvent(0),
00122 _status(status),
00123 _info(info)
00124 {}
00125
00126
00127 RtabmapEventInit(const std::string & info) :
00128 UEvent(0),
00129 _status(kInfo),
00130 _info(info)
00131 {}
00132
00133 Status getStatus() const {return _status;}
00134 const std::string & getInfo() const {return _info;}
00135
00136 virtual ~RtabmapEventInit() {}
00137 virtual std::string getClassName() const {return std::string("RtabmapEventInit");}
00138 private:
00139 Status _status;
00140 std::string _info;
00141 };
00142
00143 class RtabmapEvent3DMap : public UEvent
00144 {
00145 public:
00146 RtabmapEvent3DMap(int codeError = 0):
00147 UEvent(codeError){}
00148 RtabmapEvent3DMap(
00149 const std::map<int, Signature> & signatures,
00150 const std::map<int, Transform> & poses,
00151 const std::multimap<int, Link> & constraints,
00152 const std::map<int, int> & mapIds,
00153 const std::map<int, double> & stamps,
00154 const std::map<int, std::string> & labels,
00155 const std::map<int, std::vector<unsigned char> > & userDatas) :
00156 UEvent(0),
00157 _signatures(signatures),
00158 _poses(poses),
00159 _constraints(constraints),
00160 _mapIds(mapIds),
00161 _stamps(stamps),
00162 _labels(labels),
00163 _userDatas(userDatas)
00164 {}
00165
00166 virtual ~RtabmapEvent3DMap() {}
00167
00168 const std::map<int, Signature> & getSignatures() const {return _signatures;}
00169 const std::map<int, Transform> & getPoses() const {return _poses;}
00170 const std::multimap<int, Link> & getConstraints() const {return _constraints;}
00171 const std::map<int, int> & getMapIds() const {return _mapIds;}
00172 const std::map<int, double> & getStamps() const {return _stamps;}
00173 const std::map<int, std::string> & getLabels() const {return _labels;}
00174 const std::map<int, std::vector<unsigned char> > & getUserDatas() const {return _userDatas;}
00175
00176 virtual std::string getClassName() const {return std::string("RtabmapEvent3DMap");}
00177
00178 private:
00179 std::map<int, Signature> _signatures;
00180 std::map<int, Transform> _poses;
00181 std::multimap<int, Link> _constraints;
00182 std::map<int, int> _mapIds;
00183 std::map<int, double> _stamps;
00184 std::map<int, std::string> _labels;
00185 std::map<int, std::vector<unsigned char> > _userDatas;
00186 };
00187
00188 class RtabmapGlobalPathEvent : public UEvent
00189 {
00190 public:
00191 RtabmapGlobalPathEvent():
00192 UEvent(0) {}
00193 RtabmapGlobalPathEvent(int goalId, const std::vector<std::pair<int, Transform> > & poses) :
00194 UEvent(goalId),
00195 _poses(poses) {}
00196
00197 virtual ~RtabmapGlobalPathEvent() {}
00198 int getGoal() const {return this->getCode();}
00199 const std::vector<std::pair<int, Transform> > & getPoses() const {return _poses;}
00200 virtual std::string getClassName() const {return std::string("RtabmapGlobalPathEvent");}
00201
00202 private:
00203 std::vector<std::pair<int, Transform> > _poses;
00204 };
00205
00206 }
00207
00208 #endif