00001 /* +---------------------------------------------------------------------------+ 00002 | The Mobile Robot Programming Toolkit (MRPT) C++ library | 00003 | | 00004 | http://www.mrpt.org/ | 00005 | | 00006 | Copyright (C) 2005-2011 University of Malaga | 00007 | | 00008 | This software was written by the Machine Perception and Intelligent | 00009 | Robotics Lab, University of Malaga (Spain). | 00010 | Contact: Jose-Luis Blanco <jlblanco@ctima.uma.es> | 00011 | | 00012 | This file is part of the MRPT project. | 00013 | | 00014 | MRPT is free software: you can redistribute it and/or modify | 00015 | it under the terms of the GNU General Public License as published by | 00016 | the Free Software Foundation, either version 3 of the License, or | 00017 | (at your option) any later version. | 00018 | | 00019 | MRPT is distributed in the hope that it will be useful, | 00020 | but WITHOUT ANY WARRANTY; without even the implied warranty of | 00021 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | 00022 | GNU General Public License for more details. | 00023 | | 00024 | You should have received a copy of the GNU General Public License | 00025 | along with MRPT. If not, see <http://www.gnu.org/licenses/>. | 00026 | | 00027 +---------------------------------------------------------------------------+ */ 00028 #ifndef CObservationGPS_H 00029 #define CObservationGPS_H 00030 00031 #include <mrpt/utils/CSerializable.h> 00032 #include <mrpt/slam/CObservation.h> 00033 #include <mrpt/poses/CPose3D.h> 00034 #include <mrpt/poses/CPose2D.h> 00035 00036 namespace mrpt 00037 { 00038 namespace slam 00039 { 00040 using namespace mrpt::utils; 00041 00042 DEFINE_SERIALIZABLE_PRE_CUSTOM_BASE_LINKAGE( CObservationGPS , CObservation, OBS_IMPEXP) 00043 00044 /** Declares a class derived from "CObservation" that represents a Global Positioning System (GPS) reading. 00045 * 00046 * \sa CObservation 00047 * \ingroup mrpt_obs_grp 00048 */ 00049 class OBS_IMPEXP CObservationGPS : public CObservation 00050 { 00051 // This must be added to any CSerializable derived class: 00052 DEFINE_SERIALIZABLE( CObservationGPS ) 00053 00054 public: 00055 /** Constructor. 00056 */ 00057 CObservationGPS( ); 00058 00059 /** Dumps the contents of the observation in a human-readable form to a given output stream 00060 */ 00061 void dumpToStream( CStream &out ); 00062 00063 /** Dumps the contents of the observation in a human-readable form to the console 00064 */ 00065 void dumpToConsole( ); 00066 00067 00068 /** The sensor pose on the robot. 00069 */ 00070 CPose3D sensorPose; 00071 00072 /** A UTC time-stamp structure for GPS messages 00073 */ 00074 struct OBS_IMPEXP TUTCTime 00075 { 00076 TUTCTime(); 00077 00078 uint8_t hour; 00079 uint8_t minute; 00080 double sec; 00081 00082 bool operator == (const TUTCTime& o) const { return hour==o.hour && minute==o.minute && sec==o.sec; } 00083 bool operator != (const TUTCTime& o) const { return hour!=o.hour || minute!=o.minute || sec!=o.sec; } 00084 inline TUTCTime& operator = (const TUTCTime& o) 00085 { 00086 this->hour = o.hour; 00087 this->minute = o.minute; 00088 this->sec = o.sec; 00089 return *this; 00090 } 00091 }; 00092 00093 /** The GPS datum for GGA commands 00094 */ 00095 struct OBS_IMPEXP TGPSDatum_GGA 00096 { 00097 TGPSDatum_GGA(); 00098 00099 /** Return the geodetic coords as a mrpt::topography::TGeodeticCoords structure (requires linking against mrpt-topography) 00100 * Call as: getAsStruct<TGeodeticCoords>(); 00101 */ 00102 template <class TGEODETICCOORDS> 00103 inline TGEODETICCOORDS getOrthoAsStruct() const { 00104 return TGEODETICCOORDS(latitude_degrees,longitude_degrees,corrected_orthometric_altitude); 00105 } 00106 00107 /** Return the geodetic coords as a mrpt::topography::TGeodeticCoords structure (requires linking against mrpt-topography) 00108 * Call as: getAsStruct<TGeodeticCoords>(); 00109 */ 00110 template <class TGEODETICCOORDS> 00111 inline TGEODETICCOORDS getAsStruct() const { 00112 return TGEODETICCOORDS(latitude_degrees,longitude_degrees,altitude_meters); 00113 } 00114 00115 /** The GPS sensor measured timestamp (in UTC time) 00116 */ 00117 TUTCTime UTCTime; 00118 00119 /** The measured latitude, in degrees (North:+ , South:-) 00120 */ 00121 double latitude_degrees; 00122 00123 /** The measured longitude, in degrees (East:+ , West:-) 00124 */ 00125 double longitude_degrees; 00126 00127 /** The values defined in the NMEA standard are the following: 00128 * 00129 * 0 = invalid 00130 * 1 = GPS fix (SPS) 00131 * 2 = DGPS fix 00132 * 3 = PPS fix 00133 * 4 = Real Time Kinematic 00134 * 5 = Float RTK 00135 * 6 = estimated (dead reckoning) (2.3 feature) 00136 * 7 = Manual input mode 00137 * 8 = Simulation mode 00138 */ 00139 uint8_t fix_quality; 00140 00141 /** The measured altitude, in meters (A). 00142 */ 00143 double altitude_meters; 00144 00145 /** Difference between the measured altitude and the geoid, in meters (B). 00146 */ 00147 double geoidal_distance; 00148 00149 /** The measured orthometric altitude, in meters (A)+(B). 00150 */ 00151 double orthometric_altitude; 00152 00153 /** The corrected (mmGPS) orthometric altitude, in meters mmGPS(A+B). 00154 */ 00155 double corrected_orthometric_altitude; 00156 00157 /** The number of satelites used to compute this estimation. 00158 */ 00159 uint32_t satellitesUsed; 00160 00161 /** This states whether to take into account the value in the HDOP field. 00162 */ 00163 bool thereis_HDOP; 00164 00165 /** The HDOP (Horizontal Dilution of Precision) as returned by the sensor. 00166 */ 00167 float HDOP; 00168 }; 00169 00170 /** The GPS datum for RMC commands 00171 */ 00172 struct OBS_IMPEXP TGPSDatum_RMC 00173 { 00174 TGPSDatum_RMC(); 00175 00176 /** The GPS sensor measured timestamp (in UTC time) 00177 */ 00178 TUTCTime UTCTime; 00179 00180 /** This will be: 'A'=OK or 'V'=void 00181 */ 00182 int8_t validity_char; 00183 00184 /** The measured latitude, in degrees (North:+ , South:-) 00185 */ 00186 double latitude_degrees; 00187 00188 /** The measured longitude, in degrees (East:+ , West:-) 00189 */ 00190 double longitude_degrees; 00191 00192 /** The measured speed (in knots) 00193 */ 00194 double speed_knots; 00195 00196 /** The measured speed direction (in degrees) 00197 */ 00198 double direction_degrees; 00199 }; 00200 00201 /** The GPS datum for TopCon's mmGPS devices 00202 */ 00203 struct OBS_IMPEXP TGPSDatum_PZS 00204 { 00205 TGPSDatum_PZS(); 00206 00207 /** Return the geodetic coords as a mrpt::topography::TGeodeticCoords structure (requires linking against mrpt-topography) 00208 * Call as: getAsStruct<TGeodeticCoords>(); 00209 */ 00210 template <class TGEODETICCOORDS> 00211 inline TGEODETICCOORDS getAsStruct() const { 00212 return TGEODETICCOORDS(latitude_degrees,longitude_degrees,height_meters); 00213 } 00214 00215 double latitude_degrees; //!< The measured latitude, in degrees (North:+ , South:-) 00216 double longitude_degrees; //!< The measured longitude, in degrees (East:+ , West:-) 00217 double height_meters; //!< ellipsoidal height from N-beam [m] perhaps weighted with regular gps 00218 double RTK_height_meters; //!< ellipsoidal height [m] without N-beam correction 00219 float PSigma; //!< position SEP [m] 00220 double angle_transmitter; //!< Vertical angle of N-beam 00221 uint8_t nId; //!< ID of the transmitter [1-4], 0 if none. 00222 uint8_t Fix; //!< 1: GPS, 2: mmGPS 00223 uint8_t TXBattery; //!< battery level on transmitter 00224 uint8_t RXBattery; //!< battery level on receiver 00225 uint8_t error; //! system error indicator 00226 00227 bool hasCartesianPosVel; 00228 double cartesian_x,cartesian_y,cartesian_z; //!< Only if hasCartesianPosVel is true 00229 double cartesian_vx,cartesian_vy,cartesian_vz; //!< Only if hasCartesianPosVel is true 00230 00231 bool hasPosCov; 00232 mrpt::math::CMatrixFloat44 pos_covariance; //!< Only if hasPosCov is true 00233 00234 bool hasVelCov; 00235 mrpt::math::CMatrixFloat44 vel_covariance; //!< Only if hasPosCov is true 00236 00237 bool hasStats; 00238 uint8_t stats_GPS_sats_used, stats_GLONASS_sats_used; //<! Only if hasStats is true 00239 uint8_t stats_rtk_fix_progress; //!< [0,100] %, only in modes other than RTK FIXED. 00240 00241 }; 00242 00243 00244 /** A generic structure for statistics about tracked satelites and their positions. 00245 */ 00246 struct OBS_IMPEXP TGPSDatum_SATS 00247 { 00248 TGPSDatum_SATS(); 00249 vector_byte USIs; //!< The list of USI (Universal Sat ID) for the detected sats (See GRIL Manual, pag 4-31). 00250 vector_signed_byte ELs; //!< Elevation (in degrees, 0-90) for each satellite in USIs. 00251 vector_signed_word AZs; //!< Azimuth (in degrees, 0-360) for each satellite in USIs. 00252 }; 00253 00254 00255 /** Will be true if the corresponding field contains data read from the sensor, or false if it is not available. 00256 * \sa GGA_datum 00257 */ 00258 bool has_GGA_datum; 00259 00260 /** Will be true if the corresponding field contains data read from the sensor, or false if it is not available. 00261 * \sa RMC_datum 00262 */ 00263 bool has_RMC_datum; 00264 00265 /** Will be true if the corresponding field contains data read from the sensor, or false if it is not available. 00266 * \sa PZS_datum 00267 */ 00268 bool has_PZS_datum; 00269 00270 /** Will be true if the corresponding field contains data read from the sensor, or false if it is not available. 00271 * \sa SATS_datum 00272 */ 00273 bool has_SATS_datum; 00274 00275 TGPSDatum_GGA GGA_datum; //!< If "has_GGA_datum" is true, this contains the read GGA datum. 00276 TGPSDatum_RMC RMC_datum; //!< If "has_RMC_datum" is true, this contains the read RMC datum. 00277 TGPSDatum_PZS PZS_datum; //!< If "has_PZS_datum" is true, this contains the read PZS datum (TopCon's mmGPS devices only) 00278 TGPSDatum_SATS SATS_datum; //!< If "has_SATS_datum" is true, this contains the read PZS datum (TopCon's mmGPS devices only) 00279 00280 /** A general method to retrieve the sensor pose on the robot. 00281 * Note that most sensors will return a full (6D) CPose3D, but see the derived classes for more details or special cases. 00282 * \sa setSensorPose 00283 */ 00284 void getSensorPose( CPose3D &out_sensorPose ) const { out_sensorPose = sensorPose; } 00285 00286 00287 /** A general method to change the sensor pose on the robot. 00288 * Note that most sensors will use the full (6D) CPose3D, but see the derived classes for more details or special cases. 00289 * \sa getSensorPose 00290 */ 00291 void setSensorPose( const CPose3D &newSensorPose ) { sensorPose = newSensorPose; } 00292 00293 00294 }; // End of class def. 00295 00296 00297 } // End of namespace 00298 } // End of namespace 00299 00300 #endif
| Page generated by Doxygen 1.7.5 for MRPT 0.9.5 SVN: at Thu Oct 13 21:25:36 UTC 2011 |