RtabmapEvent.h
Go to the documentation of this file.
00001 /*
00002 Copyright (c) 2010-2016, Mathieu Labbe - IntRoLab - Universite de Sherbrooke
00003 All rights reserved.
00004 
00005 Redistribution and use in source and binary forms, with or without
00006 modification, are permitted provided that the following conditions are met:
00007     * Redistributions of source code must retain the above copyright
00008       notice, this list of conditions and the following disclaimer.
00009     * Redistributions in binary form must reproduce the above copyright
00010       notice, this list of conditions and the following disclaimer in the
00011       documentation and/or other materials provided with the distribution.
00012     * Neither the name of the Universite de Sherbrooke nor the
00013       names of its contributors may be used to endorse or promote products
00014       derived from this software without specific prior written permission.
00015 
00016 THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
00017 ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
00018 WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
00019 DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY
00020 DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
00021 (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
00022 LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
00023 ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
00024 (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
00025 SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
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}; // Hack, to fix Eclipse complaining about not defined Cmd enum ?!
00061         enum Cmd {
00062                         kCmdInit,             // params: [string] database path + ParametersMap
00063                         kCmdResetMemory,
00064                         kCmdClose,            // params: [bool] database saved (default true), [string] output database path (empty=use same database to save, only work when Db/Sqlite3InMemory=true)
00065                         kCmdDumpMemory,
00066                         kCmdDumpPrediction,
00067                         kCmdGenerateDOTGraph, // params: [bool] global, [string] path, if global=false: [int] id, [int] margin
00068                         kCmdExportPoses,      // params: [bool] global, [bool] optimized, [string] path, [int] type (0=raw format, 1=RGBD-SLAM format, 2=KITTI format, 3=TORO, 4=g2o)
00069                         kCmdCleanDataBuffer,
00070                         kCmdPublish3DMap,     // params: [bool] global, [bool] optimized, [bool] graphOnly
00071                         kCmdTriggerNewMap,
00072                         kCmdPause,
00073                         kCmdResume,
00074                         kCmdGoal,             // params: [string] label or [int] location ID
00075                         kCmdCancelGoal,
00076                         kCmdLabel             // params: [string] label, [int] location ID
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}; // Hack, to fix Eclipse complaining about not defined Status enum ?!
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         // for convenience
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; // "Loading signatures", "Loading words" ...
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 } // namespace rtabmap
00260 
00261 #endif /* RTABMAPEVENT_H_ */


rtabmap
Author(s): Mathieu Labbe
autogenerated on Thu Jun 6 2019 21:59:22