00001 /* +---------------------------------------------------------------------------+ 00002 | The Mobile Robot Programming Toolkit (MRPT) C++ library | 00003 | | 00004 | http://mrpt.sourceforge.net/ | 00005 | | 00006 | Copyright (C) 2005-2009 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 00178 uint8_t Fix; //!< enum SolutionType 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 00196 }; 00197 00198 00199 /** Will be true if the corresponding field contains data read from the sensor, or false if it is not available. 00200 * \sa GGA_datum 00201 */ 00202 bool has_GGA_datum; 00203 00204 /** Will be true if the corresponding field contains data read from the sensor, or false if it is not available. 00205 * \sa RMC_datum 00206 */ 00207 bool has_RMC_datum; 00208 00209 /** Will be true if the corresponding field contains data read from the sensor, or false if it is not available. 00210 * \sa PZS_datum 00211 */ 00212 bool has_PZS_datum; 00213 00214 TGPSDatum_GGA GGA_datum; //!< If "has_GGA_datum" is true, this contains the read GGA datum. 00215 TGPSDatum_RMC RMC_datum; //!< If "has_RMC_datum" is true, this contains the read RMC datum. 00216 TGPSDatum_PZS PZS_datum; //!< If "has_PZS_datum" is true, this contains the read PZS datum (TopCon's mmGPS devices only) 00217 00218 /** Implements the virtual method in charge of finding the likelihood between this 00219 * and another observation, probably only of the same derived class. The operator 00220 * may be asymmetric. 00221 * 00222 * \param anotherObs The other observation to compute likelihood with. 00223 * \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. 00224 * 00225 * \return Returns a likelihood measurement, in the range [0,1]. 00226 * \exception std::exception On any error, as another observation being of an invalid class. 00227 */ 00228 float likelihoodWith( const CObservation *anotherObs, const CPosePDF *anotherObsPose = NULL ) const; 00229 00230 /** A general method to retrieve the sensor pose on the robot. 00231 * Note that most sensors will return a full (6D) CPose3D, but see the derived classes for more details or special cases. 00232 * \sa setSensorPose 00233 */ 00234 void getSensorPose( CPose3D &out_sensorPose ) const { out_sensorPose = sensorPose; } 00235 00236 00237 /** A general method to change the sensor pose on the robot. 00238 * Note that most sensors will use the full (6D) CPose3D, but see the derived classes for more details or special cases. 00239 * \sa getSensorPose 00240 */ 00241 void setSensorPose( const CPose3D &newSensorPose ) { sensorPose = newSensorPose; } 00242 00243 }; // End of class def. 00244 00245 00246 } // End of namespace 00247 } // End of namespace 00248 00249 #endif
Page generated by Doxygen 1.5.7.1 for MRPT 0.7.1 SVN: at Mon Aug 17 23:02:22 EDT 2009 |