00001 /* +---------------------------------------------------------------------------+ 00002 | The Mobile Robot Programming Toolkit (MRPT) C++ library | 00003 | | 00004 | http://mrpt.sourceforge.net/ | 00005 | | 00006 | Copyright (C) 2005-2010 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( CObservationGPS , CObservation ) 00043 00044 /** Declares a class derived from "CObservation" that represents a Global Positioning System (GPS) reading. 00045 * 00046 * \sa CObservation 00047 */ 00048 class MRPTDLLIMPEXP CObservationGPS : public CObservation 00049 { 00050 // This must be added to any CSerializable derived class: 00051 DEFINE_SERIALIZABLE( CObservationGPS ) 00052 00053 public: 00054 /** Constructor. 00055 */ 00056 CObservationGPS( ); 00057 00058 /** Dumps the contents of the observation in a human-readable form to a given output stream 00059 */ 00060 void dumpToStream( CStream &out ); 00061 00062 /** Dumps the contents of the observation in a human-readable form to the console 00063 */ 00064 void dumpToConsole( ); 00065 00066 00067 /** The sensor pose on the robot. 00068 */ 00069 CPose3D sensorPose; 00070 00071 /** A UTC time-stamp structure for GPS messages 00072 */ 00073 struct MRPTDLLIMPEXP TUTCTime 00074 { 00075 TUTCTime(); 00076 00077 uint8_t hour; 00078 uint8_t minute; 00079 double sec; 00080 00081 bool operator == (const TUTCTime& o) const { return hour==o.hour && minute==o.minute && sec==o.sec; } 00082 bool operator != (const TUTCTime& o) const { return hour!=o.hour || minute!=o.minute || sec!=o.sec; } 00083 }; 00084 00085 /** The GPS datum for GGA commands 00086 */ 00087 struct MRPTDLLIMPEXP TGPSDatum_GGA 00088 { 00089 TGPSDatum_GGA(); 00090 00091 /** The GPS sensor measured timestamp (in UTC time) 00092 */ 00093 TUTCTime UTCTime; 00094 00095 /** The measured latitude, in degrees (North:+ , South:-) 00096 */ 00097 double latitude_degrees; 00098 00099 /** The measured longitude, in degrees (East:+ , West:-) 00100 */ 00101 double longitude_degrees; 00102 00103 /** The values defined in the NMEA standard are the following: 00104 * 00105 * 0 = invalid 00106 * 1 = GPS fix (SPS) 00107 * 2 = DGPS fix 00108 * 3 = PPS fix 00109 * 4 = Real Time Kinematic 00110 * 5 = Float RTK 00111 * 6 = estimated (dead reckoning) (2.3 feature) 00112 * 7 = Manual input mode 00113 * 8 = Simulation mode 00114 */ 00115 uint8_t fix_quality; 00116 00117 /** The measured altitude, in meters. 00118 */ 00119 double altitude_meters; 00120 00121 /** The number of satelites used to compute this estimation. 00122 */ 00123 uint32_t satellitesUsed; 00124 00125 /** This states whether to take into account the value in the HDOP field. 00126 */ 00127 bool thereis_HDOP; 00128 00129 /** The HDOP (Horizontal Dilution of Precision) as returned by the sensor. 00130 */ 00131 float HDOP; 00132 }; 00133 00134 /** The GPS datum for RMC commands 00135 */ 00136 struct MRPTDLLIMPEXP TGPSDatum_RMC 00137 { 00138 TGPSDatum_RMC(); 00139 00140 /** The GPS sensor measured timestamp (in UTC time) 00141 */ 00142 TUTCTime UTCTime; 00143 00144 /** This will be: 'A'=OK or 'V'=void 00145 */ 00146 int8_t validity_char; 00147 00148 /** The measured latitude, in degrees (North:+ , South:-) 00149 */ 00150 double latitude_degrees; 00151 00152 /** The measured longitude, in degrees (East:+ , West:-) 00153 */ 00154 double longitude_degrees; 00155 00156 /** The measured speed (in knots) 00157 */ 00158 double speed_knots; 00159 00160 /** The measured speed direction (in degrees) 00161 */ 00162 double direction_degrees; 00163 }; 00164 00165 /** The GPS datum for TopCon's mmGPS devices 00166 */ 00167 struct MRPTDLLIMPEXP TGPSDatum_PZS 00168 { 00169 TGPSDatum_PZS(); 00170 00171 double latitude_degrees; //!< The measured latitude, in degrees (North:+ , South:-) 00172 double longitude_degrees; //!< The measured longitude, in degrees (East:+ , West:-) 00173 double height_meters; //!< ellipsoidal height from N-beam [m] perhaps weighted with regular gps 00174 double RTK_height_meters; //!< ellipsoidal height [m] without N-beam correction 00175 float PSigma; //!< position SEP [m] 00176 double angle_transmitter; //!< Vertical angle of N-beam 00177 uint8_t nId; //!< ID of the transmitter [1-4], 0 if none. 00178 uint8_t Fix; //!< 1: GPS, 2: mmGPS 00179 uint8_t TXBattery; //!< battery level on transmitter 00180 uint8_t RXBattery; //!< battery level on receiver 00181 uint8_t error; //! system error indicator 00182 00183 bool hasCartesianPosVel; 00184 double cartesian_x,cartesian_y,cartesian_z; //!< Only if hasCartesianPosVel is true 00185 double cartesian_vx,cartesian_vy,cartesian_vz; //!< Only if hasCartesianPosVel is true 00186 00187 bool hasPosCov; 00188 mrpt::math::CMatrixFloat44 pos_covariance; //!< Only if hasPosCov is true 00189 00190 bool hasVelCov; 00191 mrpt::math::CMatrixFloat44 vel_covariance; //!< Only if hasPosCov is true 00192 00193 bool hasStats; 00194 uint8_t stats_GPS_sats_used, stats_GLONASS_sats_used; //<! Only if hasStats is true 00195 uint8_t stats_rtk_fix_progress; //!< [0,100] %, only in modes other than RTK FIXED. 00196 00197 }; 00198 00199 00200 /** A generic structure for statistics about tracked satelites and their positions. 00201 */ 00202 struct MRPTDLLIMPEXP TGPSDatum_SATS 00203 { 00204 TGPSDatum_SATS(); 00205 vector_byte USIs; //!< The list of USI (Universal Sat ID) for the detected sats (See GRIL Manual, pag 4-31). 00206 vector_signed_byte ELs; //!< Elevation (in degrees, 0-90) for each satellite in USIs. 00207 vector_signed_word AZs; //!< Azimuth (in degrees, 0-360) for each satellite in USIs. 00208 }; 00209 00210 00211 /** Will be true if the corresponding field contains data read from the sensor, or false if it is not available. 00212 * \sa GGA_datum 00213 */ 00214 bool has_GGA_datum; 00215 00216 /** Will be true if the corresponding field contains data read from the sensor, or false if it is not available. 00217 * \sa RMC_datum 00218 */ 00219 bool has_RMC_datum; 00220 00221 /** Will be true if the corresponding field contains data read from the sensor, or false if it is not available. 00222 * \sa PZS_datum 00223 */ 00224 bool has_PZS_datum; 00225 00226 /** Will be true if the corresponding field contains data read from the sensor, or false if it is not available. 00227 * \sa SATS_datum 00228 */ 00229 bool has_SATS_datum; 00230 00231 TGPSDatum_GGA GGA_datum; //!< If "has_GGA_datum" is true, this contains the read GGA datum. 00232 TGPSDatum_RMC RMC_datum; //!< If "has_RMC_datum" is true, this contains the read RMC datum. 00233 TGPSDatum_PZS PZS_datum; //!< If "has_PZS_datum" is true, this contains the read PZS datum (TopCon's mmGPS devices only) 00234 TGPSDatum_SATS SATS_datum; //!< If "has_SATS_datum" is true, this contains the read PZS datum (TopCon's mmGPS devices only) 00235 00236 /** Implements the virtual method in charge of finding the likelihood between this 00237 * and another observation, probably only of the same derived class. The operator 00238 * may be asymmetric. 00239 * 00240 * \param anotherObs The other observation to compute likelihood with. 00241 * \param anotherObsPose If known, the belief about the robot pose when the other observation was taken can be supplied here, or NULL if it is unknown. 00242 * 00243 * \return Returns a likelihood measurement, in the range [0,1]. 00244 * \exception std::exception On any error, as another observation being of an invalid class. 00245 */ 00246 float likelihoodWith( const CObservation *anotherObs, const CPosePDF *anotherObsPose = NULL ) const; 00247 00248 /** A general method to retrieve the sensor pose on the robot. 00249 * Note that most sensors will return a full (6D) CPose3D, but see the derived classes for more details or special cases. 00250 * \sa setSensorPose 00251 */ 00252 void getSensorPose( CPose3D &out_sensorPose ) const { out_sensorPose = sensorPose; } 00253 00254 00255 /** A general method to change the sensor pose on the robot. 00256 * Note that most sensors will use the full (6D) CPose3D, but see the derived classes for more details or special cases. 00257 * \sa getSensorPose 00258 */ 00259 void setSensorPose( const CPose3D &newSensorPose ) { sensorPose = newSensorPose; } 00260 00261 }; // End of class def. 00262 00263 00264 } // End of namespace 00265 } // End of namespace 00266 00267 #endif
| Page generated by Doxygen 1.6.2 for MRPT 0.8.1 SVN:exported at Mon Feb 15 22:01:07 UTC 2010 |
