00001 /** 00002 \file gnss_types.h 00003 \brief Basic gnss types. 00004 00005 \author Glenn D. MacGougan (GDM) 00006 \date 2007-12-05 00007 \since 2006-11-13 00008 00009 \b "LICENSE INFORMATION" \n 00010 Copyright (c) 2007, refer to 'author' doxygen tags \n 00011 All rights reserved. \n 00012 00013 Redistribution and use in source and binary forms, with or without 00014 modification, are permitted provided the following conditions are met: \n 00015 00016 - Redistributions of source code must retain the above copyright 00017 notice, this list of conditions and the following disclaimer. \n 00018 - Redistributions in binary form must reproduce the above copyright 00019 notice, this list of conditions and the following disclaimer in the 00020 documentation and/or other materials provided with the distribution. \n 00021 - The name(s) of the contributor(s) may not be used to endorse or promote 00022 products derived from this software without specific prior written 00023 permission. \n 00024 00025 THIS SOFTWARE IS PROVIDED BY THE CONTRIBUTORS ``AS IS'' AND ANY EXPRESS 00026 OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 00027 WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 00028 DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY DIRECT, 00029 INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 00030 (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR 00031 SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER 00032 CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 00033 LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 00034 OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 00035 SUCH DAMAGE. 00036 */ 00037 00038 #ifndef _GNSS_TYPES_H_ 00039 #define _GNSS_TYPES_H_ 00040 00041 #ifdef __cplusplus 00042 extern "C" { 00043 #endif 00044 00045 00046 00047 /// \brief These are the supported receiver data types. 00048 typedef enum GNSS_enumRxDataType 00049 { 00050 GNSS_RXDATA_NOVATELOEM4 = 0, //!< NovAtel OEM4 data. 00051 GNSS_RXDATA_RINEX21 = 1, //!< RINEX version 2.1 00052 GNSS_RXDATA_RINEX211 = 2, //!< RINEX version 2.11 00053 GNSS_RXDATA_UNKNOWN 00054 }; 00055 00056 00057 /// A 32 bit bit-field for GNSS measurement associated flags (all are boolean indicators). 00058 typedef struct 00059 { 00060 unsigned isActive:1; //!< This flag indicates that the channel is active for use. If this is not set, no other flags are valid for use. 00061 unsigned isCodeLocked:1; //!< Indicates if the code tracking is locked. 00062 unsigned isPhaseLocked:1; //!< Indicates if the phase tracking is locked. 00063 unsigned isParityValid:1; //!< Indicates if the phase parity if valid. 00064 unsigned isPsrValid:1; //!< Indicates if the pseudorange valid for use. 00065 unsigned isAdrValid:1; //!< Indicates if the ADR is valid for use. 00066 unsigned isDopplerValid:1; //!< Indicates if the Doppler if valid for use. 00067 unsigned isGrouped:1; //!< Indicates if this channel has another associated channel. eg. L1 and L2 measurements. 00068 unsigned isAutoAssigned:1; //!< Indicates if the channel was receiver assigned (otherwise, the user forced this channel assignment). 00069 unsigned isCarrierSmoothed:1; //!< Indicates if the pseudorange has carrier smoothing enabled. 00070 unsigned isEphemerisValid:1; //!< Indicates if this channel has valid associated ephemeris information. 00071 unsigned isAlmanacValid:1; //!< Indicates if this channel has valid associated almanac information. 00072 unsigned isAboveElevationMask:1; //!< Indicates if the satellite tracked is above the elevation mask. 00073 unsigned isAboveCNoMask:1; //!< Indciates if the channel's C/No is above a threshold value. 00074 unsigned isAboveLockTimeMask:1; //!< Indicates if the channel's locktime is above a treshold value. 00075 unsigned isNotUserRejected:1; //!< Indicates if the user has not forced the rejection of this channel or PRN. 00076 unsigned isNotPsrRejected:1; //!< Indicates if the pseudorange was not rejetced (ie Fault Detection and Exclusion). 00077 unsigned isNotAdrRejected:1; //!< Indicates if the ADR was not rejetced (ie Fault Detection and Exclusion). 00078 unsigned isNotDopplerRejected:1; //!< Indicates if the Doppler was not rejected (ie Fault Detection and Exclusion). 00079 unsigned isNoCycleSlipDetected:1; //!< Indicates that no cycle slip has occurred at this epoch. 00080 unsigned isPsrUsedInSolution:1; //!< Indicates if some part (pseudorange) of this channel's measurement was used in the position solution. 00081 unsigned isDopplerUsedInSolution:1; //!< Indicates if some part (Doppler) of this channel's measurement was used in the velocity solution. 00082 unsigned isAdrUsedInSolution:1; //!< Indicates if the the ADR is used in the solution. 00083 00084 unsigned isDifferentialPsrAvailable:1; //!< Indicates if a matching pseudrange observation is available from another receiver. 00085 unsigned isDifferentialDopplerAvailable:1; //!< Indicates if a matching Doppler observation is available from another receiver. 00086 unsigned isDifferentialAdrAvailable:1; //!< Indicates if a matching ADR observation is available from another receiver. 00087 00088 unsigned useTropoCorrection:1; //!< Indicates that the tropospheric correction should be applied. 00089 unsigned useBroadcastIonoCorrection:1; //!< Indicates that the broadcast ionospheric correction should be applied. 00090 00091 unsigned isTimeDifferntialPsrAvailable:1; 00092 unsigned isTimeDifferntialDopplerAvailable:1; 00093 00094 unsigned reserved:2; 00095 } GNSS_structFlagsBitField; 00096 00097 /// \brief An enumerated for a GNSS code modulation type. 00098 /// 00099 /// This enumerated uses the NovAtel OEM4 convention. 00100 typedef enum 00101 { 00102 GNSS_CACode = 0, 00103 GNSS_PCode = 1, 00104 GNSS_PCodeless = 2, 00105 GNSS_ReservedCodeType 00106 } GNSS_enumCodeType; 00107 00108 /// \brief An enumeration for a GNSS frequency type. 00109 /// 00110 /// This enumerated uses the NovAtel OEM4 convention. 00111 typedef enum 00112 { 00113 GNSS_GPSL1 = 0, 00114 GNSS_GPSL2 = 1, 00115 GNSS_ReservedFrequency 00116 } GNSS_enumFrequency; 00117 00118 /// \brief An enumeration for a GNSS system type. 00119 /// 00120 /// This enumerated uses the NovAtel OEM4 convention. 00121 typedef enum 00122 { 00123 GNSS_GPS = 0, 00124 GNSS_GLONASS = 1, 00125 GNSS_WAAS = 2, 00126 GNSS_Pseudolite = 3, 00127 GNSS_ReservedSystem 00128 } GNSS_enumSystem; 00129 00130 /// \brief Correction data associated with a single receiver measurement channel. 00131 /// PRC is PseudRange Correction, RRC is RangeRate Correction. 00132 /// 00133 /// This struct is 4 and 8 byte struct member packing compatible. 00134 typedef struct 00135 { 00136 float prcTropoDry; //!< Tropospheric dry delay correction (+ve is a delay) [m]. 00137 float prcTropoWet; //!< Tropospheric wet delay correction (+ve is a delay) [m]. 00138 float prcIono; //!< Ionospheric correction (+ve is a delay) [m]. 00139 float prcSatClk; //!< The satellite clock correction (+ve is a delay) [m]. 00140 float prcReserved1; //!< A reserved range correction for the pseudorange [m]. 00141 float prcReserved2; //!< A reserved range correction for the pseudorange [m]. 00142 float rrcSatClkDrift; //!< The satellite clock drift rate correction (+ve is a rate delay) [m/s]. 00143 float rrcReserved1; //!< A reserved range rate correction [m/s]. 00144 float rrcReserved2; //!< A reserved range rate correction [m/s]. 00145 float dX; //!< This channel's associated satellite orbital correction X (ECEF) [m]. 00146 float dY; //!< This channel's associated satellite orbital correction X (ECEF) [m]. 00147 float dZ; //!< This channel's associated satellite orbital correction X (ECEF) [m]. 00148 } GNSS_structCorrections; 00149 00150 /// \brief Residuals data associated with a single receiver measurement channel. 00151 /// 00152 /// This struct is 4 and 8 byte struct member packing compatible. 00153 typedef struct 00154 { 00155 float psrResidual; //!< The pseudorange residual [m]. 00156 float adrResidual; //!< The accumulated Doppler range residual [cycles]. 00157 float dopplerResidual; //!< The Doppler residual [Hz]. 00158 float reserved; //!< Reserved value. 00159 } GNSS_structResiduals; 00160 00161 /// \brief A struct for satelite data. 00162 /// 00163 /// This struct is 4 and 8 byte struct member packing compatible. 00164 typedef struct 00165 { 00166 int isValid; //!< This indicates if the pvt information is valid [1=valid, 0=invalid]. 00167 int ageOfEph; //!< The difference between the current measurement time and the time of ephemeris. 00168 double x; //!< The satellite position ECEF, x [m]. 00169 double y; //!< The satellite position ECEF, y [m]. 00170 double z; //!< The satellite position ECEF, z [m]. 00171 double vx; //!< The satellite velocity ECEF, vx [m]. 00172 double vy; //!< The satellite velocity ECEF, vy [m]. 00173 double vz; //!< The satellite velocity ECEF, vz [m]. 00174 double clk; //!< The satellite clock correction [m]. 00175 double clkdrift; //!< The satellite clock drift correction [m/s]. 00176 double elevation; //!< The elevation angle between the user and the satellite [rad]. 00177 double azimuth; //!< The azimuth angle between the user and the satellite, measured clockwise positive from the true North [rad]. 00178 double doppler; //!< The satellite doppler with respect to the user position [m/s], Note: User must convert to Hz. 00179 } GNSS_structSatellitePVT; 00180 00181 00182 /// \brief A container for klobuchar sytle ionospheric parameters. 00183 /// 00184 /// This struct is 4 and 8 byte struct member packing compatible. 00185 typedef struct 00186 { 00187 unsigned short isValid; //!< Is this structure valid for use 1=YES, 0=NO. 00188 unsigned short week; //!< The GPS week corresponding to the correction parameters [weeks]. 00189 unsigned tow; //!< The GPS time of week corresponding to the correction parameters [s]. 00190 double alpha0; //!< coefficients of a cubic equation representing the amplitude of the vertical delay [s] 00191 double alpha1; //!< coefficients of a cubic equation representing the amplitude of the vertical delay [s/semi-circle] 00192 double alpha2; //!< coefficients of a cubic equation representing the amplitude of the vertical delay [s/semi-circle^2] 00193 double alpha3; //!< coefficients of a cubic equation representing the amplitude of the vertical delay [s/semi-circle^3] 00194 double beta0; //!< coefficients of a cubic equation representing the period of the model [s] 00195 double beta1; //!< coefficients of a cubic equation representing the period of the model [s/semi-circle] 00196 double beta2; //!< coefficients of a cubic equation representing the period of the model [s/semi-circle^2] 00197 double beta3; //!< coefficients of a cubic equation representing the period of the model [s/semi-circle^3] 00198 } GNSS_structKlobuchar; 00199 00200 /// \brief Measurement data associated with a single receiver measurement channel. 00201 /// 00202 /// This struct is 4 and 8 byte struct member packing compatible. 00203 typedef struct 00204 { 00205 unsigned short channel; //!< The channel number associated with this measurement. 00206 unsigned short id; //!< The unique id for this channel (eg PRN for GPS). 00207 GNSS_enumSystem system; //!< The satellite system associated with this channel. 00208 GNSS_enumCodeType codeType; //!< The code type for this channel. 00209 GNSS_enumFrequency freqType; //!< The frequency type for this channel. 00210 GNSS_structFlagsBitField flags; //!< The flags associated with this channel. ie Validity flags, etc. 00211 short reserved1; 00212 unsigned short week; //!< The measurement gps week (at 'transmit' time) [weeks]. 00213 double tow; //!< The measurement gps time of week (at 'transmit' time) [s]. 00214 00215 // The actual measurements. 00216 double psr; //!< The pseudorange measurement [m]. 00217 double adr; //!< The carrier phase or accumulated Doppler range measurement [cycles]. 00218 float doppler; //!< The Doppler measurement for this channel [Hz]. 00219 float cno; //!< The carrier to noise density ratio for this channel [dB-Hz] 00220 float locktime; //!< The number of seconds of continous phase tracking (no known cycle slips) [s]. 00221 00222 // The variance information associated with the actual measurements. 00223 float stdev_psr; //!< The estimated pseudorange measurement standard deviation [m]. 00224 float stdev_adr; //!< The estimated accumulated Doppler range measurement standard deviation [cycles]. 00225 float stdev_doppler; //!< The estimated Doppler measurement standard deviation [Hz]. 00226 00227 // Derived information. 00228 double psr_misclosure; //!< The measured psr minus the computed psr estimate [m]. 00229 double doppler_misclosure;//!< The measured Doppler minus the computed Doppler estimate [m]. 00230 double range; //!< The best estimate of the geometric range between the antenna and the satellite [m]. 00231 double rangerate; //!< The best estimate of the geometric range rate between the antenna and the satellite [m/s]. 00232 double psr_smoothed; //!< The carrier smoothed pseudorange if available [m]. 00233 double psr_predicted; //!< The predicted pseudorange based on the satellite position, user position, and current clock offset [m]. 00234 double ambiguity; //!< The estimated float ambiguity [m]. 00235 double ambiguity_dd; //!< The estimated double difference float ambiguity [m]. 00236 float doppler_predicted; //!< The predicted Doppler based on user position, velocity, satellite position, velocity and clock rate [Hz]. 00237 float azimuthRads; //!< The associated satellite azimuth for this channel [rad]. 00238 00239 float elevationRads; //!< The associated satellite elevation for this channel [rad]. 00240 short index_differential; //!< The channel index of a matching differential observation. -1 means there is no matching channel. 00241 short index_time_differential; //!< The channel index of a matching time differential observation. -1 means there is no matching channel. 00242 00243 short index_between_satellite_differential; //!< The channel index for between satellite difference of the satellite that is substracted from this one. -1 means there is no matching channel. 00244 short index_ambiguity_state; //!< The index into the state vector for the float ambiguity state. -1 not estimated. 00245 short index_ambiguity_state_dd; //!< The index into the state vector for the double difference ambiguity state. -1 not estimated. 00246 short index_psr_B; //!< A very convenient index into the B matrix used in double differencing. -1 if not valid. 00247 short index_Doppler_B; //!< A very convenient index into the B matrix used in double differencing. -1 if not valid. 00248 short index_adr_B; //!< A very convenient index into the B matrix used in double differencing. -1 if not valid. 00249 00250 double adr_misclosure; //!< The measured ADR minus the computed ADR estimate [m]. This is likely a differential quantity. 00251 00252 double H_p[3]; //!< The design matrix row relating the pseudorange measurements to the position solution. dP/d(lat), dP/d(lon), dP/d(hgt). 00253 double H_v[3]; //!< The design matrix row relating the Doppler measurements to the velocity solution. dD/d(lat), dD/d(lon), dD/d(hgt). 00254 00255 GNSS_structCorrections corrections; //!< The corrections associated with this channel. 00256 GNSS_structResiduals residuals; //!< The post-adjustment (filtering) measurement residual associated with this channel. 00257 00258 GNSS_structSatellitePVT satellite; //!< Each channel has an associated satellite pvt struct evaluated at the transmit time. 00259 } GNSS_structMeasurement; 00260 00261 00262 00263 00264 /// \brief A struct for holding dilution of precision information. 00265 /// 00266 /// This struct is 4 and 8 byte struct member packing compatible. 00267 typedef struct 00268 { 00269 float gdop; //!< geometric dilution of precision []. 00270 float pdop; //!< position dilution of precision []. 00271 float ndop; //!< northing dilution of precision []. 00272 float edop; //!< easting dilution of precision []. 00273 float hdop; //!< horizontal dilution of precision []. 00274 float vdop; //!< vertical dilution of precision []. 00275 float tdop; //!< time dilution of precision []. 00276 float reserved; //!< reserved dilution of precision []. 00277 } GNSS_structDOP; 00278 00279 /// \brief A container for time information. 00280 /// 00281 /// This struct is 4 and 8 byte struct member packing compatible. 00282 typedef struct 00283 { 00284 unsigned short day_of_year; //!< The number of days into the year (1-366) [days]. 00285 unsigned short utc_year; //!< Universal Time Coordinated [year] 00286 unsigned char utc_month; //!< Universal Time Coordinated [1-12 months] 00287 unsigned char utc_day; //!< Universal Time Coordinated [1-31 days] 00288 unsigned char utc_hour; //!< Universal Time Coordinated [hours] 00289 unsigned char utc_minute; //!< Universal Time Coordinated [minutes] 00290 float utc_seconds; //!< Universal Time Coordinated [s] 00291 unsigned int gps_week; //!< The current GPS week associated with the observations [weeks]. 00292 double gps_tow; //!< The GPS time of week (0-604800.0) (receiver time of observation) [s]. 00293 } GNSS_structReceiverTime; 00294 00295 00296 00297 /// \brief A struct for degrees, minutes, seconds, and a string. 00298 /// 00299 /// This struct is 4 and 8 byte struct member packing compatible. 00300 typedef struct 00301 { 00302 short degrees; //!< The degrees component [deg]. 00303 short minutes; //!< The minutes component [min]. 00304 float seconds; //!< The seconds component [s] 00305 char dms_str[24]; //!< A DMS string e.g. dms_str = "-180'59'59.9999\"" 00306 } GNSS_structDMS; 00307 00308 00309 /// \brief A struct for holding position, velocity and time. 00310 /// 00311 /// This struct is 4 and 8 byte struct member packing compatible. 00312 typedef struct 00313 { 00314 GNSS_structReceiverTime time; // The receiver time information. 00315 00316 double latitude; //!< The user latitude [rad]. 00317 double longitude; //!< The user longitude [rad]. 00318 double height; //!< The user orthometric height [m]. 00319 double undulation; //!< The undulation [m]. 00320 00321 double latitudeDegs; //!< The user latitude [degrees]. 00322 double longitudeDegs; //!< The user longitude [degrees]. 00323 GNSS_structDMS lat_dms; //!< The user latitude [dms]. 00324 GNSS_structDMS lon_dms; //!< The user longitude [dms]. 00325 00326 double x; //!< The user's ECEF position, X [m]. 00327 double y; //!< The user's ECEF position, Y [m]. 00328 double z; //!< The user's ECEF position, Z [m]. 00329 00330 double vn; //!< The user's local geodetic velocity, velocity North [m/s]. 00331 double ve; //!< The user's local geodetic velocity, velocity East [m/s]. 00332 double vup; //!< The user's local geodetic velocity, velocity Up [m/s]. 00333 00334 double vx; //!< The user's ECEF velocity, vx [m/s]. 00335 double vy; //!< The user's ECEF velocity, vy [m/s]. 00336 double vz; //!< The user's ECEF velocity, vz [m/s]. 00337 00338 double clockOffset; //!< The receiver clock offset [m]. 00339 double clockDrift; //!< the receiver clock drift [m/s]. 00340 00341 GNSS_structDOP dop; //!< All the associated DOP information for this solution. 00342 00343 double std_lat; //!< The standard deviation uncertainty in the latitude [m]. 00344 double std_lon; //!< The standard deviation uncertainty in the longitude [m]. 00345 double std_hgt; //!< The standard deviation uncertainty in the height [m]. 00346 double std_vn; //!< The standard deviation uncertainty in the northing velocity [m/s]. 00347 double std_ve; //!< The standard deviation uncertainty in the easting velocity [m/s]. 00348 double std_vup; //!< The standard deviation uncertainty in the up velocity [m/s]. 00349 double std_clk; //!< The standard deviation uncertainty in the clock offset [m]. 00350 double std_clkdrift; //!< The standard deviation uncertainty in the clock drift [m/s]. 00351 00352 00353 unsigned char isPositionConstrained; //!< Is this a constrained position solution [TRUE(1),FALSE(0)]. 00354 unsigned char isHeightConstrained; //!< Is this a height constrained solution [TRUE(1),FALSE(0)]. 00355 unsigned char isClockConstrained; //!< Is this a clock constrained solution [TRUE(1),FALSE(0)]. 00356 unsigned char isSolutionBasedOnEphemeris; //!< Is the solution based on valid ephemeris information [TRUE(1),FALSE(0)]. 00357 unsigned char reserved[5]; //!< Space for reserved flags. 00358 00359 unsigned char nrPsrObsAvailable; //!< This indicates the number of valid pseudorange observations valid before adjustment. 00360 unsigned char nrPsrObsUsed; //!< This indicates the number of valid pseudorange observations valid after adjustment. 00361 unsigned char nrPsrObsRejected; //!< This indicates the number of valid pseudorange observations rejected during adjustment. 00362 00363 unsigned char nrAdrObsAvailable; //!< This indicates the number of valid ADR observations valid before adjustment. 00364 unsigned char nrAdrObsUsed; //!< This indicates the number of valid ADR observations valid after adjustment. 00365 unsigned char nrAdrObsRejected; //!< This indicates the number of valid ADR observations rejected during adjustment. 00366 00367 unsigned char nrDopplerObsAvailable; //!< This indicates the number of valid Doppler observations valid before adjustment. 00368 unsigned char nrDopplerObsUsed; //!< This indicates the number of valid Doppler observations valid after adjustment. 00369 unsigned char nrDopplerObsRejected; //!< This indicates the number of valid Doppler observations rejected during adjustment. 00370 } GNSS_structPVT; 00371 00372 #ifdef __cplusplus 00373 } 00374 #endif 00375 00376 00377 #endif // _GNSS_TYPES_H_ 00378 00379