00001 /* +---------------------------------------------------------------------------+ 00002 | The Mobile Robot Programming Toolkit (MRPT) C++ library | 00003 | | 00004 | http://mrpt.sourceforge.net/ | 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 */ 00048 class OBS_IMPEXP 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 OBS_IMPEXP 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 OBS_IMPEXP TGPSDatum_GGA 00088 { 00089 TGPSDatum_GGA(); 00090 00091 /** Return the geodetic coords as a mrpt::topography::TGeodeticCoords structure (requires linking against mrpt-topography) 00092 * Call as: getAsStruct<TGeodeticCoords>(); 00093 */ 00094 template <class TGEODETICCOORDS> 00095 inline TGEODETICCOORDS getAsStruct() const { 00096 return TGEODETICCOORDS(latitude_degrees,longitude_degrees,altitude_meters); 00097 } 00098 00099 /** The GPS sensor measured timestamp (in UTC time) 00100 */ 00101 TUTCTime UTCTime; 00102 00103 /** The measured latitude, in degrees (North:+ , South:-) 00104 */ 00105 double latitude_degrees; 00106 00107 /** The measured longitude, in degrees (East:+ , West:-) 00108 */ 00109 double longitude_degrees; 00110 00111 /** The values defined in the NMEA standard are the following: 00112 * 00113 * 0 = invalid 00114 * 1 = GPS fix (SPS) 00115 * 2 = DGPS fix 00116 * 3 = PPS fix 00117 * 4 = Real Time Kinematic 00118 * 5 = Float RTK 00119 * 6 = estimated (dead reckoning) (2.3 feature) 00120 * 7 = Manual input mode 00121 * 8 = Simulation mode 00122 */ 00123 uint8_t fix_quality; 00124 00125 /** The measured altitude, in meters. 00126 */ 00127 double altitude_meters; 00128 00129 /** The number of satelites used to compute this estimation. 00130 */ 00131 uint32_t satellitesUsed; 00132 00133 /** This states whether to take into account the value in the HDOP field. 00134 */ 00135 bool thereis_HDOP; 00136 00137 /** The HDOP (Horizontal Dilution of Precision) as returned by the sensor. 00138 */ 00139 float HDOP; 00140 }; 00141 00142 /** The GPS datum for RMC commands 00143 */ 00144 struct OBS_IMPEXP TGPSDatum_RMC 00145 { 00146 TGPSDatum_RMC(); 00147 00148 /** The GPS sensor measured timestamp (in UTC time) 00149 */ 00150 TUTCTime UTCTime; 00151 00152 /** This will be: 'A'=OK or 'V'=void 00153 */ 00154 int8_t validity_char; 00155 00156 /** The measured latitude, in degrees (North:+ , South:-) 00157 */ 00158 double latitude_degrees; 00159 00160 /** The measured longitude, in degrees (East:+ , West:-) 00161 */ 00162 double longitude_degrees; 00163 00164 /** The measured speed (in knots) 00165 */ 00166 double speed_knots; 00167 00168 /** The measured speed direction (in degrees) 00169 */ 00170 double direction_degrees; 00171 }; 00172 00173 /** The GPS datum for TopCon's mmGPS devices 00174 */ 00175 struct OBS_IMPEXP TGPSDatum_PZS 00176 { 00177 TGPSDatum_PZS(); 00178 00179 /** Return the geodetic coords as a mrpt::topography::TGeodeticCoords structure (requires linking against mrpt-topography) 00180 * Call as: getAsStruct<TGeodeticCoords>(); 00181 */ 00182 template <class TGEODETICCOORDS> 00183 inline TGEODETICCOORDS getAsStruct() const { 00184 return TGEODETICCOORDS(latitude_degrees,longitude_degrees,height_meters); 00185 } 00186 00187 double latitude_degrees; //!< The measured latitude, in degrees (North:+ , South:-) 00188 double longitude_degrees; //!< The measured longitude, in degrees (East:+ , West:-) 00189 double height_meters; //!< ellipsoidal height from N-beam [m] perhaps weighted with regular gps 00190 double RTK_height_meters; //!< ellipsoidal height [m] without N-beam correction 00191 float PSigma; //!< position SEP [m] 00192 double angle_transmitter; //!< Vertical angle of N-beam 00193 uint8_t nId; //!< ID of the transmitter [1-4], 0 if none. 00194 uint8_t Fix; //!< 1: GPS, 2: mmGPS 00195 uint8_t TXBattery; //!< battery level on transmitter 00196 uint8_t RXBattery; //!< battery level on receiver 00197 uint8_t error; //! system error indicator 00198 00199 bool hasCartesianPosVel; 00200 double cartesian_x,cartesian_y,cartesian_z; //!< Only if hasCartesianPosVel is true 00201 double cartesian_vx,cartesian_vy,cartesian_vz; //!< Only if hasCartesianPosVel is true 00202 00203 bool hasPosCov; 00204 mrpt::math::CMatrixFloat44 pos_covariance; //!< Only if hasPosCov is true 00205 00206 bool hasVelCov; 00207 mrpt::math::CMatrixFloat44 vel_covariance; //!< Only if hasPosCov is true 00208 00209 bool hasStats; 00210 uint8_t stats_GPS_sats_used, stats_GLONASS_sats_used; //<! Only if hasStats is true 00211 uint8_t stats_rtk_fix_progress; //!< [0,100] %, only in modes other than RTK FIXED. 00212 00213 }; 00214 00215 00216 /** A generic structure for statistics about tracked satelites and their positions. 00217 */ 00218 struct OBS_IMPEXP TGPSDatum_SATS 00219 { 00220 TGPSDatum_SATS(); 00221 vector_byte USIs; //!< The list of USI (Universal Sat ID) for the detected sats (See GRIL Manual, pag 4-31). 00222 vector_signed_byte ELs; //!< Elevation (in degrees, 0-90) for each satellite in USIs. 00223 vector_signed_word AZs; //!< Azimuth (in degrees, 0-360) for each satellite in USIs. 00224 }; 00225 00226 00227 /** Will be true if the corresponding field contains data read from the sensor, or false if it is not available. 00228 * \sa GGA_datum 00229 */ 00230 bool has_GGA_datum; 00231 00232 /** Will be true if the corresponding field contains data read from the sensor, or false if it is not available. 00233 * \sa RMC_datum 00234 */ 00235 bool has_RMC_datum; 00236 00237 /** Will be true if the corresponding field contains data read from the sensor, or false if it is not available. 00238 * \sa PZS_datum 00239 */ 00240 bool has_PZS_datum; 00241 00242 /** Will be true if the corresponding field contains data read from the sensor, or false if it is not available. 00243 * \sa SATS_datum 00244 */ 00245 bool has_SATS_datum; 00246 00247 TGPSDatum_GGA GGA_datum; //!< If "has_GGA_datum" is true, this contains the read GGA datum. 00248 TGPSDatum_RMC RMC_datum; //!< If "has_RMC_datum" is true, this contains the read RMC datum. 00249 TGPSDatum_PZS PZS_datum; //!< If "has_PZS_datum" is true, this contains the read PZS datum (TopCon's mmGPS devices only) 00250 TGPSDatum_SATS SATS_datum; //!< If "has_SATS_datum" is true, this contains the read PZS datum (TopCon's mmGPS devices only) 00251 00252 /** A general method to retrieve the sensor pose on the robot. 00253 * Note that most sensors will return a full (6D) CPose3D, but see the derived classes for more details or special cases. 00254 * \sa setSensorPose 00255 */ 00256 void getSensorPose( CPose3D &out_sensorPose ) const { out_sensorPose = sensorPose; } 00257 00258 00259 /** A general method to change the sensor pose on the robot. 00260 * Note that most sensors will use the full (6D) CPose3D, but see the derived classes for more details or special cases. 00261 * \sa getSensorPose 00262 */ 00263 void setSensorPose( const CPose3D &newSensorPose ) { sensorPose = newSensorPose; } 00264 00265 }; // End of class def. 00266 00267 00268 } // End of namespace 00269 } // End of namespace 00270 00271 #endif
Page generated by Doxygen 1.7.2 for MRPT 0.9.4 SVN: at Mon Jan 10 22:30:30 UTC 2011 |