00001 #ifndef GPS_MATH_H 00002 #define GPS_MATH_H 00003 00004 #define GPS_A 6378137.0 // earth semimajor axis in meters 00005 #define GPS_F 0.0033528106647474807198455286185206 // reciprocal flattening 00006 #define GPS_E2 2*GPS_F-GPS_F*GPS_F // eccentricity squared 00007 #define MEAN_EARTH_RADIUS 6378137.0 00008 #define MEAN_EARTH_DIAMETER 12756274.0 00009 #define UMR 0.017453292519943295769236907684886 //PI/180 00010 00011 00012 struct GPS_DATA 00013 { 00014 //latitude/longitude in deg * 10^7 00015 int latitude; 00016 int longitude; 00017 //GPS height in mm 00018 int height; 00019 //speed in x (E/W) and y(N/S) in mm/s 00020 int speed_x; 00021 int speed_y; 00022 //GPS heading in deg * 1000 00023 int heading; 00024 00025 //accuracy estimates in mm and mm/s 00026 unsigned int horizontal_accuracy; 00027 unsigned int vertical_accuracy; 00028 unsigned int speed_accuracy; 00029 00030 //number of satellite vehicles used in NAV solution 00031 unsigned int numSV; 00032 00033 // GPS status information; Bit7...Bit3: 0 Bit 2: longitude direction Bit1: latitude direction Bit 0: GPS lock 00034 int status; 00035 }; 00036 extern struct GPS_DATA GPS_Data; 00037 00038 struct GPS_TIME 00039 { 00040 unsigned int time_of_week; //[ms] 00041 unsigned short week; //[1..52] 00042 }; 00043 extern struct GPS_TIME GPS_Time; 00044 00045 //trigger's new gps data transmission 00046 extern unsigned int gpsDataOkTrigger; 00047 00048 #endif // GPS_MATH_H