00001 // ---------------------------------------------------------------------------- 00002 // 00003 // $Id$ 00004 // 00005 // Copyright 2008, 2009, 2010, 2011, 2012 Antonio Franchi and Paolo Stegagno 00006 // 00007 // This file is part of MIP. 00008 // 00009 // MIP is free software: you can redistribute it and/or modify 00010 // it under the terms of the GNU General Public License as published by 00011 // the Free Software Foundation, either version 3 of the License, or 00012 // (at your option) any later version. 00013 // 00014 // MIP is distributed in the hope that it will be useful, 00015 // but WITHOUT ANY WARRANTY; without even the implied warranty of 00016 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00017 // GNU General Public License for more details. 00018 // 00019 // You should have received a copy of the GNU General Public License 00020 // along with MIP. If not, see <http://www.gnu.org/licenses/>. 00021 // 00022 // Contact info: antonio.franchi@tuebingen.mpg.de stegagno@diag.uniroma1.it 00023 // 00024 // ---------------------------------------------------------------------------- 00025 00026 00032 00036 00037 00038 00039 #ifndef __SCAN_MATCHER_H_ 00040 #define __SCAN_MATCHER_H_ 00041 00042 #include <Resource.h> 00043 #include <CsmInterface.h> 00044 00045 #include <CommonOptions.h> 00046 00047 #define SMATCHRES_DEBUG 1 00048 00049 using namespace MipBaselib; 00050 00051 namespace MipResources{ 00052 00054 /* @{ */ 00055 00056 00060 class ExternScanMatchOptions : public Options { 00061 public: 00062 StringOption* algorithm; 00063 IntOption* csmUseCorrTricks; 00064 DecimalOption* csmMaxLinearCorrection; 00065 DecimalOption* csmMaxAngularCorrection; 00066 IntOption* customDebugLevel;; 00067 00068 ExternScanMatchOptions(); 00069 00070 ~ExternScanMatchOptions(); 00071 00072 string getObjectName() const { 00073 return "ExternScanMatchOptions"; 00074 } 00075 }; 00076 00088 class ExternScanMatch : public Resource{ 00089 private: 00090 00091 static const ResourcePlate _plate= SCNM_RES; 00092 00093 bool _performSM; 00094 bool _resultAvailable; 00095 00096 CsmInterface* _csmInterface; 00097 pthread_mutex_t _mutex; 00098 00099 ExternScanMatchOptions _options; 00100 00101 void _executeScanMatching(); 00102 bool _getPerformSM(); 00103 void _setResultAvailable(); 00104 void _unsetResultAvailable(); 00105 bool _checkResultAvailable(); 00106 void _unsetPerformSM(); 00107 00108 Thread _smThread; 00109 00110 Scan *_firstScan; 00111 Pose *_firstPose; 00112 Scan *_secondScan; 00113 Pose *_secondPose; 00114 00115 public: 00116 00118 ExternScanMatch(int argc, const char* argv[]); 00119 00121 ~ExternScanMatch(); 00122 00124 ResourcePlate getPlate() const { 00125 return _plate; 00126 } 00127 00133 void execute(Scan *fS, Pose *fP,Scan *sS, Pose *sP); 00134 00139 bool getResult(Pose& result, bool& valid); 00140 00142 void extSMWork(); 00143 }; 00144 00145 /* @} */ 00146 00147 }; //end namespace MipResources 00148 00149 00150 00151 00152 #endif 00153 00154 00155