C MIP-SDK
|
00001 00002 // 00006 // 00008 // 00009 // External dependencies: 00010 // 00011 // 00012 // 00014 // 00017 // 00027 // 00029 00030 #ifndef _MIP_SDK_GPS_H 00031 #define _MIP_SDK_GPS_H 00032 00034 // 00035 //Include Files 00036 // 00038 00039 #include "mip.h" 00040 #include "mip_sdk_interface.h" 00041 00042 00044 // 00045 // Defines 00046 // 00048 00050 00051 00053 // 00054 // Descriptor Set designator - used in the Desc Set field of the MIP header 00055 // 00057 00058 #define MIP_GPS_DATA_SET 0x81 00059 00060 00062 // 00063 // Descriptors 00064 // 00066 00068 // GPS LEGACY (RAW) DATA DESCRIPTORS 00070 00071 #define MIP_GPS_DATA_NMEA 0x01 // uBlox NMEA packet 00072 #define MIP_GPS_DATA_UBX 0x02 // uBlox packet 00073 00075 // GPS DATA DESCRIPTORS 00077 00078 #define MIP_GPS_DATA_LLH_POS 0x03 00079 #define MIP_GPS_DATA_ECEF_POS 0x04 00080 #define MIP_GPS_DATA_NED_VELOCITY 0x05 00081 #define MIP_GPS_DATA_ECEF_VELOCITY 0x06 00082 #define MIP_GPS_DATA_DOP 0x07 00083 #define MIP_GPS_DATA_UTC_TIME 0x08 00084 #define MIP_GPS_DATA_GPS_TIME 0x09 00085 #define MIP_GPS_DATA_CLOCK_INFO 0x0A 00086 #define MIP_GPS_DATA_FIX_INFO 0x0B 00087 #define MIP_GPS_DATA_SV_INFO 0x0C 00088 #define MIP_GPS_DATA_HW_STATUS 0x0D 00089 00090 00092 // 00093 // Valid Data Flag Definitions 00094 // 00096 00097 00099 // Position: Latitude, Longitude, Height 00101 00102 #define MIP_GPS_LLH_POS_LAT_LON_VALID 0x0001 00103 #define MIP_GPS_LLH_POS_ELLIPSOID_HEIGHT_VALID 0x0002 00104 #define MIP_GPS_LLH_MSL_HEIGHT_VALID 0x0004 00105 #define MIP_GPS_LLH_POS_HORIZONTAL_ACCURACY_VALID 0x0008 00106 #define MIP_GPS_LLH_POS_VERTICAL_ACCURACY_VALID 0x0010 00107 00108 #define MIP_GPS_LLH_POS_PACKET_VALID (MIP_GPS_LLH_POS_LAT_LON_VALID | MIP_GPS_LLH_POS_ELLIPSOID_HEIGHT_VALID |\ 00109 MIP_GPS_LLH_MSL_HEIGHT_VALID | MIP_GPS_LLH_POS_HORIZONTAL_ACCURACY_VALID |\ 00110 MIP_GPS_LLH_POS_VERTICAL_ACCURACY_VALID) 00111 00112 00114 // Position: ECEF (Earth-Centered, Earth-Fixed) 00116 00117 #define MIP_GPS_ECEF_POS_POSITION_VALID 0x0001 00118 #define MIP_GPS_ECEF_POS_ACCURACY_ESTIMATE_VALID 0x0002 00119 00120 #define MIP_GPS_ECEF_POS_PACKET_VALID (MIP_GPS_ECEF_POS_POSITION_VALID | MIP_GPS_ECEF_POS_ACCURACY_ESTIMATE_VALID) 00121 00122 00124 // Velocity: NED (North, East, Down) 00126 00127 #define MIP_GPS_NED_VEL_VELOCITY_VALID 0x0001 00128 #define MIP_GPS_NED_VEL_SPEED_3D_VALID 0x0002 00129 #define MIP_GPS_NED_VEL_GROUND_SPEED_VALID 0x0004 00130 #define MIP_GPS_NED_VEL_HEADING_VALID 0x0008 00131 #define MIP_GPS_NED_VEL_SPEED_ACCURACY_VALID 0x0010 00132 #define MIP_GPS_NED_VEL_HEADING_ACCURACY_VALID 0x0020 00133 00134 #define MIP_GPS_NED_VEL_PACKET_VALID (MIP_GPS_NED_VEL_VELOCITY_VALID | MIP_GPS_NED_VEL_SPEED_3D_VALID | \ 00135 MIP_GPS_NED_VEL_GROUND_SPEED_VALID | MIP_GPS_NED_VEL_HEADING_VALID | \ 00136 MIP_GPS_NED_VEL_SPEED_ACCURACY_VALID | MIP_GPS_NED_VEL_HEADING_ACCURACY_VALID) 00137 00138 00140 // Velocity: ECEF (Earth-Centered, Earth-Fixed) 00142 00143 #define MIP_GPS_ECEF_VEL_VELOCITY_VALID 0x0001 00144 #define MIP_GPS_ECEF_VEL_ACCURACY_ESTIMATE_VALID 0x0002 00145 00146 #define MIP_GPS_ECEF_VEL_PACKET_VALID (MIP_GPS_ECEF_VEL_VELOCITY_VALID | MIP_GPS_ECEF_VEL_ACCURACY_ESTIMATE_VALID) 00147 00148 00150 // GPS Fix Information 00152 00153 #define MIP_GPS_FIX_INFO_FIX_TYPE_VALID 0x0001 00154 #define MIP_GPS_FIX_INFO_NUM_SV_VALID 0x0002 00155 #define MIP_GPS_FIX_INFO_FIX_FLAGS_VALID 0x0004 00156 00157 #define MIP_GPS_FIX_INFO_PACKET_VALID (MIP_GPS_FIX_INFO_FIX_TYPE_VALID | MIP_GPS_FIX_INFO_NUM_SV_VALID | \ 00158 MIP_GPS_FIX_INFO_FIX_FLAGS_VALID) 00159 00160 #define MIP_GPS_FIX_TYPE_3D 0x00 00161 #define MIP_GPS_FIX_TYPE_2D 0x01 00162 #define MIP_GPS_FIX_TYPE_TIME_ONLY 0x02 00163 #define MIP_GPS_FIX_TYPE_NONE 0x03 00164 #define MIP_GPS_FIX_TYPE_INVALID 0x04 00165 00166 00167 00169 // GPS SV (Space Vehicle) Information 00171 00172 #define MIP_GPS_SV_INFO_MAX_SV_NUMBER 32 00173 00174 #define MIP_GPS_SV_INFO_CHANNEL_VALID 0x0001 00175 #define MIP_GPS_SV_INFO_SV_ID_VALID 0x0002 00176 #define MIP_GPS_SV_INFO_CARRIER_NOISE_RATIO_VALID 0x0008 00177 #define MIP_GPS_SV_INFO_AZIMUTH_VALID 0x0010 00178 #define MIP_GPS_SV_INFO_ELEVATION_VALID 0x0020 00179 #define MIP_GPS_SV_INFO_SV_FLAGS_VALID 0x0040 00180 00181 #define MIP_GPS_SV_INFO_PACKET_VALID (MIP_GPS_SV_INFO_CHANNEL_VALID | MIP_GPS_SV_INFO_SV_ID_VALID | \ 00182 MIP_GPS_SV_INFO_CARRIER_NOISE_RATIO_VALID | MIP_GPS_SV_INFO_AZIMUTH_VALID | \ 00183 MIP_GPS_SV_INFO_ELEVATION_VALID | MIP_GPS_SV_INFO_SV_FLAGS_VALID) 00184 00185 #define MIP_GPS_SV_FLAG_USED_FOR_NAVIGATION 0x01 00186 #define MIP_GPS_SV_FLAG_HEALTH 0x02 00187 00188 00190 // GPS DOP (Dilution of Precision) Information 00192 00193 #define MIP_GPS_DOP_GDOP_VALID 0x0001 00194 #define MIP_GPS_DOP_PDOP_VALID 0x0002 00195 #define MIP_GPS_DOP_HDOP_VALID 0x0004 00196 #define MIP_GPS_DOP_VDOP_VALID 0x0008 00197 #define MIP_GPS_DOP_TDOP_VALID 0x0010 00198 #define MIP_GPS_DOP_NDOP_VALID 0x0020 00199 #define MIP_GPS_DOP_EDOP_VALID 0x0040 00200 00201 #define MIP_GPS_DOP_PACKET_VALID (MIP_GPS_DOP_GDOP_VALID | MIP_GPS_DOP_PDOP_VALID | MIP_GPS_DOP_HDOP_VALID | \ 00202 MIP_GPS_DOP_VDOP_VALID | MIP_GPS_DOP_TDOP_VALID | MIP_GPS_DOP_NDOP_VALID | \ 00203 MIP_GPS_DOP_EDOP_VALID) 00204 00205 00207 // GPS UTC (Coordinated Universal Time) Time 00209 00210 #define MIP_GPS_UTC_TIME_GPS_TIME_DATE_VALID 0x0001 00211 #define MIP_GPS_UTC_TIME_LEAP_SECONDS_KNOWN_VALID 0x0002 00212 00213 #define MIP_GPS_UTC_TIME_PACKET_VALID (MIP_GPS_UTC_TIME_GPS_TIME_DATE_VALID | MIP_GPS_UTC_TIME_LEAP_SECONDS_KNOWN_VALID) 00214 00215 00217 // GPS Time 00219 00220 #define MIP_GPS_TIME_TOW_VALID 0x0001 00221 #define MIP_GPS_TIME_WEEK_NUMBER_VALID 0x0002 00222 00223 #define MIP_GPS_TIME_PACKET_VALID (MIP_GPS_TIME_TOW_VALID | MIP_GPS_TIME_WEEK_NUMBER_VALID) 00224 00225 00227 // GPS Clock Information 00229 00230 #define MIP_GPS_CLOCK_INFO_BIAS_VALID 0x0001 00231 #define MIP_GPS_CLOCK_INFO_DRIFT_VALID 0x0002 00232 #define MIP_GPS_CLOCK_INFO_ACCURACY_ESTIMATE_VALID 0x0004 00233 00234 #define MIP_GPS_CLOCK_INFO_PACKET_VALID (MIP_GPS_CLOCK_INFO_BIAS_VALID | MIP_GPS_CLOCK_INFO_DRIFT_VALID | \ 00235 MIP_GPS_CLOCK_INFO_ACCURACY_ESTIMATE_VALID) 00236 00238 // GPS Hardware Status 00240 00241 #define MIP_GPS_HW_STATUS_SENSOR_STATE_VALID 0x0001 00242 #define MIP_GPS_HW_STATUS_ANTENNA_STATE_VALID 0x0002 00243 #define MIP_GPS_HW_STATUS_ANTENNA_POWER_VALID 0x0004 00244 00245 #define MIP_GPS_HW_STATUS_PACKET_VALID (MIP_GPS_HW_STATUS_SENSOR_STATE_VALID | \ 00246 MIP_GPS_HW_STATUS_ANTENNA_STATE_VALID | \ 00247 MIP_GPS_HW_STATUS_ANTENNA_POWER_VALID) 00248 00249 00250 #define MIP_GPS_SENSOR_STATE_OFF 0x00 00251 #define MIP_GPS_SENSOR_STATE_ON 0x01 00252 #define MIP_GPS_SENSOR_STATE_UNKNOWN 0x02 00253 00254 #define MIP_GPS_ANTENNA_STATE_INIT 0x01 00255 #define MIP_GPS_ANTENNA_STATE_SHORT 0x02 00256 #define MIP_GPS_ANTENNA_STATE_OPEN 0x03 00257 #define MIP_GPS_ANTENNA_STATE_GOOD 0x04 00258 #define MIP_GPS_ANTENNA_STATE_UNKNOWN 0x05 00259 00260 #define MIP_GPS_ANTENNA_POWER_OFF 0x00 00261 #define MIP_GPS_ANTENNA_POWER_ON 0x01 00262 #define MIP_GPS_ANTENNA_POWER_UNKNOWN 0x02 00263 00264 00266 // 00267 // Field Data Structures 00268 // 00270 00271 #pragma pack(1) 00272 00274 // Position: Latitude, Longitude, Height 00276 00277 typedef struct _mip_gps_llh_pos 00278 { 00279 double latitude, longitude; //(deg, deg) 00280 double ellipsoid_height, msl_height; //(m) 00281 float horizontal_accuracy, vertical_accuracy; //(m) 00282 u16 valid_flags; 00283 }mip_gps_llh_pos; 00284 00285 00287 // Position: ECEF (Earth-Centered, Earth-Fixed) 00289 00290 typedef struct _mip_gps_ecef_pos 00291 { 00292 double x[3]; //(m) 00293 float x_accuracy; //(m) 00294 u16 valid_flags; 00295 }mip_gps_ecef_pos; 00296 00297 00299 // Velocity: NED (North, East, Down) 00301 00302 typedef struct _mip_gps_ned_vel 00303 { 00304 float v[3]; //(m/s) 00305 float speed; //(m/s) 00306 float ground_speed; //(m/s) 00307 float heading; //(deg) 00308 float speed_accuracy; //(m/s) 00309 float heading_accuracy; //(deg) 00310 u16 valid_flags; 00311 }mip_gps_ned_vel; 00312 00313 00315 // Velocity: ECEF (Earth-Centered, Earth-Fixed) 00317 00318 typedef struct _mip_ecef_vel 00319 { 00320 float v[3]; //(m/s) 00321 float v_accuracy; //(m/s) 00322 u16 valid_flags; 00323 }mip_gps_ecef_vel; 00324 00325 00327 // GPS Fix Information 00329 00330 typedef struct _mip_fix_info 00331 { 00332 u8 fix_type; 00333 u8 num_sv; 00334 u16 fix_flags; 00335 u16 valid_flags; 00336 }mip_gps_fix_info; 00337 00338 00340 // GPS SV (Space Vehicle) Information 00342 00343 typedef struct _mip_gps_sv_info 00344 { 00345 u8 channel, sv_id; 00346 u16 carrier_noise_ratio; //(dBHz) 00347 s16 azimuth, elevation; //(deg) 00348 u16 sv_flags; 00349 u16 valid_flags; 00350 }mip_gps_sv_info; 00351 00352 00354 // GPS DOP (Dilution of Precision) Information 00356 00357 typedef struct _mip_gps_dop 00358 { 00359 float gdop; //Geometric DOP 00360 float pdop; //Position DOP 00361 float hdop; //Horizontal DOP 00362 float vdop; //Vertical DOP 00363 float tdop; //Time DOP 00364 float ndop; //Northing DOP 00365 float edop; //Easting DOP 00366 u16 valid_flags; 00367 }mip_gps_dop; 00368 00369 00371 // GPS UTC (Coordinated Universal Time) Time 00373 00374 typedef struct _mip_gps_utc_time 00375 { 00376 u16 year; 00377 u8 month, day; 00378 u8 hour, min, sec; 00379 u32 msec; //milliseconds 00380 u16 valid_flags; 00381 }mip_gps_utc_time; 00382 00383 00385 // GPS Time 00387 00388 typedef struct _mip_gps_time 00389 { 00390 double tow; //Time of Week (seconds) 00391 u16 week_number; 00392 u16 valid_flags; 00393 }mip_gps_time; 00394 00395 00397 // GPS Clock Information 00399 00400 typedef struct _mip_gps_clock_info 00401 { 00402 double bias; //sec 00403 double drift; //sec/sec 00404 double accuracy_estimate; //sec 00405 u16 valid_flags; 00406 }mip_gps_clock_info; 00407 00408 00410 // GPS Hardware Status 00412 00413 typedef struct _mip_gps_hw_status 00414 { 00415 u8 sensor_state; 00416 u8 antenna_state; 00417 u8 antenna_power; 00418 u16 valid_flags; 00419 }mip_gps_hw_status; 00420 00421 00423 // DGPS Information 00425 00426 typedef struct _mip_gps_dgps_info 00427 { 00428 float age; 00429 s16 base_station_id; 00430 s16 base_station_status; 00431 u16 num_dgps_channels; 00432 u16 valid_flags; 00433 }mip_gps_dgps_info; 00434 00435 00437 // DGPS Channel Status 00439 00440 typedef struct _mip_gps_dgps_channel_status 00441 { 00442 u8 sv_id; 00443 float age; 00444 float pseudorange_correction; 00445 float pseudorange_rate_correction; 00446 u16 valid_flags; 00447 }mip_gps_dgps_channel_status; 00448 00449 00450 00451 #pragma pack() 00452 00453 00454 00456 // 00457 // Function Prototypes 00458 // 00460 00461 void mip_gps_llh_pos_byteswap(mip_gps_llh_pos *llh_pos); 00462 void mip_gps_ecef_pos_byteswap(mip_gps_ecef_pos *ecef_pos); 00463 void mip_gps_ned_vel_byteswap(mip_gps_ned_vel *ned_vel); 00464 void mip_gps_ecef_vel_byteswap(mip_gps_ecef_vel *ecef_vel); 00465 void mip_gps_fix_info_byteswap(mip_gps_fix_info *fix_info); 00466 void mip_gps_sv_info_byteswap(mip_gps_sv_info *sv_info); 00467 void mip_gps_dop_byteswap(mip_gps_dop *dop); 00468 void mip_gps_utc_time_byteswap(mip_gps_utc_time *utc_time); 00469 void mip_gps_time_byteswap(mip_gps_time *gps_time); 00470 void mip_gps_clock_info_byteswap(mip_gps_clock_info *clock_info); 00471 void mip_gps_hw_status_byteswap(mip_gps_hw_status *hw_status); 00472 00473 void mip_gps_dgps_info_byteswap(mip_gps_dgps_info *dgps_info); 00474 void mip_gps_dgps_channel_status_byteswap(mip_gps_dgps_channel_status *dgps_channel_status); 00475 00476 #endif