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 00033 00034 00038 00039 00040 #ifndef __POSITION_DETECTOR_H_ 00041 #define __POSITION_DETECTOR_H_ 00042 00043 #ifdef MIP_HOST_APPLE 00044 #include <applePatch.h> 00045 #endif 00046 00047 #include <stdlib.h> 00048 #include <string> 00049 #include <sstream> 00050 #include <vector> 00051 #include <assert.h> 00052 #include <pthread.h> 00053 00054 #include <baselib.h> 00055 #include <Resource.h> 00056 00057 namespace MipResources{ 00058 00059 00061 /* @{ */ 00062 00063 00067 class PositionDetectorPar 00068 { 00069 private: 00070 string _name; 00071 00072 Pose _pose; 00073 00074 Decimal _rate; 00075 00076 Decimal _latitude; 00077 00078 Decimal _longitude; 00079 00080 Decimal _altitude; 00081 00082 Decimal _hdop; 00083 00084 Decimal _vdop; 00085 00086 Decimal _herr; 00087 00088 Decimal _verr; 00089 00090 Decimal _uest; 00091 00092 Decimal _unorth; 00093 00094 Decimal _time; 00095 00096 uint _numsat; 00097 00098 uint _quality; 00099 00100 00101 protected: 00105 void setGPSName(string value) 00106 { 00107 _name = value; 00108 return; 00109 } 00110 00114 void setGPSPose(Pose value) 00115 { 00116 _pose = value; 00117 return; 00118 } 00119 00123 void setGPSRate(Decimal value) 00124 { 00125 assert(value>0); 00126 _rate = value; 00127 return; 00128 } 00129 00130 public: 00131 00133 ~PositionDetectorPar(){}; 00134 00136 PositionDetectorPar () 00137 { 00138 _rate = 1.0; 00139 _pose = Pose(); 00140 _name = string(); 00141 _latitude = 0.0; 00142 _longitude = 0.0; 00143 _altitude = 0.0; 00144 _hdop = 0.0; 00145 _vdop = 0.0; 00146 _herr = 0.0; 00147 _verr = 0.0; 00148 _uest = 0.0; 00149 _unorth = 0.0; 00150 _time = 0.0; 00151 _numsat = 0; 00152 _quality = 0; 00153 } 00154 00156 PositionDetectorPar(const PositionDetectorPar &s) 00157 { 00158 _rate = s._rate; 00159 _pose = s._pose; 00160 _name = s._name; 00161 _latitude = s._latitude; 00162 _longitude = s._longitude; 00163 _altitude = s._altitude; 00164 _hdop = s._hdop; 00165 _vdop = s._vdop; 00166 _herr = s._herr; 00167 _verr = s._verr; 00168 _uest = s._uest; 00169 _unorth = s._unorth; 00170 _time = s._time; 00171 _numsat = s._numsat; 00172 _quality = s._quality; 00173 } 00174 00175 00177 PositionDetectorPar& operator=(const PositionDetectorPar& s) 00178 { 00179 if (this != &s) 00180 { 00181 _rate = s._rate; 00182 _pose = s._pose; 00183 _name = s._name; 00184 _latitude = s._latitude; 00185 _longitude = s._longitude; 00186 _altitude = s._altitude; 00187 _hdop = s._hdop; 00188 _vdop = s._vdop; 00189 _herr = s._herr; 00190 _verr = s._verr; 00191 _uest = s._uest; 00192 _unorth = s._unorth; 00193 _time = s._time; 00194 _numsat = s._numsat; 00195 _quality = s._quality; 00196 } 00197 return *this; 00198 } 00199 00201 00202 }; 00203 00210 class PositionDetectorVar {}; 00211 00215 class PositionDetector : public Resource 00216 { 00217 private: 00218 bool _GPSavail; 00219 00220 protected: 00221 PositionDetectorPar *_par; 00223 public: 00224 00225 virtual ResourcePlate getPlate() const =0; 00226 00228 PositionDetector() 00229 { 00230 _GPSavail = false; 00231 }; 00232 00234 ~PositionDetector(){}; 00235 00236 virtual Position getMeasure()=0; 00237 }; 00238 00239 00240 /* @} */ 00241 00242 };// end namespace MipResources{ 00243 00244 #endif 00245 00246 00247 00248 00249 00250