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 00041 #ifndef __GPS_SENSOR3D_H_ 00042 #define __GPS_SENSOR3D_H_ 00043 00044 #ifdef MIP_HOST_APPLE 00045 #include <applePatch.h> 00046 #endif 00047 00048 #include <stdlib.h> 00049 #include <string> 00050 #include <sstream> 00051 #include <vector> 00052 #include <assert.h> 00053 #include <pthread.h> 00054 00055 #include <baselib.h> 00056 #include <Resource.h> 00057 00058 using namespace MipBaselib; 00059 00060 namespace MipResources{ 00061 00063 /* @{ */ 00064 00065 00069 class PositionDetector3DPar 00070 { 00071 private: 00072 string _name; 00073 00074 Pose3D _pose3D; 00075 00076 Decimal _rate; 00077 00078 Decimal _latitude; 00079 00080 Decimal _longitude; 00081 00082 Decimal _altitude; 00083 00084 Decimal _hdop; 00085 00086 Decimal _vdop; 00087 00088 Decimal _herr; 00089 00090 Decimal _verr; 00091 00092 Decimal _uest; 00093 00094 Decimal _unorth; 00095 00096 Decimal _time; 00097 00098 uint _numsat; 00099 00100 uint _quality; 00101 00102 00103 protected: 00107 void setGPSName(string value) 00108 { 00109 _name = value; 00110 return; 00111 } 00112 00116 void setGPSPose(Pose3D value) 00117 { 00118 _pose3D = value; 00119 return; 00120 } 00121 00125 void setGPSRate(Decimal value) 00126 { 00127 assert(value>0); 00128 _rate = value; 00129 return; 00130 } 00131 00132 public: 00133 00135 ~PositionDetector3DPar(){}; 00136 00138 PositionDetector3DPar () 00139 { 00140 _rate = 1.0; 00141 _pose3D = Pose3D(); 00142 _name = string(); 00143 _latitude = 0.0; 00144 _longitude = 0.0; 00145 _altitude = 0.0; 00146 _hdop = 0.0; 00147 _vdop = 0.0; 00148 _herr = 0.0; 00149 _verr = 0.0; 00150 _uest = 0.0; 00151 _unorth = 0.0; 00152 _time = 0.0; 00153 _numsat = 0; 00154 _quality = 0; 00155 } 00156 00158 PositionDetector3DPar(const PositionDetector3DPar &s) 00159 { 00160 _rate = s._rate; 00161 _pose3D = s._pose3D; 00162 _name = s._name; 00163 _latitude = s._latitude; 00164 _longitude = s._longitude; 00165 _altitude = s._altitude; 00166 _hdop = s._hdop; 00167 _vdop = s._vdop; 00168 _herr = s._herr; 00169 _verr = s._verr; 00170 _uest = s._uest; 00171 _unorth = s._unorth; 00172 _time = s._time; 00173 _numsat = s._numsat; 00174 _quality = s._quality; 00175 } 00176 00177 00179 PositionDetector3DPar& operator=(const PositionDetector3DPar& s) 00180 { 00181 if (this != &s) 00182 { 00183 _rate = s._rate; 00184 _pose3D = s._pose3D; 00185 _name = s._name; 00186 _latitude = s._latitude; 00187 _longitude = s._longitude; 00188 _altitude = s._altitude; 00189 _hdop = s._hdop; 00190 _vdop = s._vdop; 00191 _herr = s._herr; 00192 _verr = s._verr; 00193 _uest = s._uest; 00194 _unorth = s._unorth; 00195 _time = s._time; 00196 _numsat = s._numsat; 00197 _quality = s._quality; 00198 } 00199 return *this; 00200 } 00201 00203 00204 }; 00205 00212 class PositionDetector3DVar {}; 00213 00219 class PositionDetector3D : public Resource 00220 { 00221 private: 00222 bool _GPSavail; 00223 00224 protected: 00225 PositionDetector3DPar *_par; 00227 public: 00228 00229 virtual ResourcePlate getPlate() const =0; 00230 00232 PositionDetector3D() 00233 { 00234 cout << "PositionDetector3D::PositionDetector3D()." << endl; 00235 _par = new PositionDetector3DPar(); 00236 _GPSavail = false; 00237 cout << "PositionDetector3D OK." << endl; 00238 }; 00239 00241 ~PositionDetector3D(){}; 00242 00243 virtual bool getGPSMeasure(Position3D &pos, Decimal *MeasTime)=0; 00244 virtual bool getRefGPSMeasure(Position3D &pos, Decimal *MeasTime)=0; 00245 }; 00246 00247 /* @} */ 00248 00249 };// end namespace MipResources{ 00250 00251 00252 #endif 00253 00254 00255 00256 00257