diff options
author | Eric S. Raymond <esr@thyrsus.com> | 2005-04-01 15:48:21 +0000 |
---|---|---|
committer | Eric S. Raymond <esr@thyrsus.com> | 2005-04-01 15:48:21 +0000 |
commit | 3db67120b2e24200222b377ef5a75d10c8eef67d (patch) | |
tree | 2fbb2eef7022f8fc25efc1c1d174d95bbcd1d030 | |
parent | 3471977cc2ee92e4dfd2d89747bd49c2a0e4069c (diff) | |
download | gpsd-3db67120b2e24200222b377ef5a75d10c8eef67d.tar.gz |
MacOS compiler fixes. Oleg's fix for the bilinear interpolation.
Geoid-separation code integrated for test but not for production.
-rw-r--r-- | Makefile.am | 1 | ||||
-rw-r--r-- | TODO | 22 | ||||
-rw-r--r-- | drivers.c | 1 | ||||
-rw-r--r-- | geoid.c | 6 | ||||
-rw-r--r-- | gpsd.c | 2 | ||||
-rw-r--r-- | sirf.c | 8 |
6 files changed, 14 insertions, 26 deletions
diff --git a/Makefile.am b/Makefile.am index 2ab88d74..fa49ead8 100644 --- a/Makefile.am +++ b/Makefile.am @@ -62,6 +62,7 @@ libgps_la_SOURCES = \ libgps.c \ packet.c \ gpsutils.c \ + geoid.c \ sirf.c \ report.c @@ -34,27 +34,7 @@ the receive FIFO. You'll have to experiment. ** Supply geoidal separation for SiRF packet 2 -Peter H. Dana <pdana@pdana.com>: -> The classic bi-linear interpolation method is published in Table 5.3 -> of DMA TR8350.2 Supplement B (page 5.3) -> -> Np(lat, lon) = a0 +a1*X + a2*Y +a3*X*Y -> -> a0 = N1 -> a1 = N2-N1 -> a2 = N4-N1 -> a3=N1+N3-N2-N4 -> -> X= (lon-lon1)/(lon2-lon1) -> Y = (lat-lat1)/(lat2-lat1) -> Whre -> N1 (lat1, lon1) , N2 (lat1, lon2), N3( lat2,lon2), N4 (lat2, lon1) are known -> geoid heights -> -> Rather than deal with interpolation from a table, most folks use the EGM96 -> coefficients and the formulas for direct computation of N at any point shown -> in NIMA TR8350.2 -> http://earth-info.nga.mil/GandG/tr8350_2.html +It's there for testing now. ** Hotplug interface problems @@ -92,6 +92,7 @@ struct gps_type_t fv18 = { nmea_parse_input, /* how to interpret a packet */ nmea_write_rtcm, /* write RTCM data straight */ NULL, /* no speed switcher */ + NULL, /* no mode switcher */ NULL, /* no wrapup */ 1, /* updates every second */ }; @@ -5,6 +5,7 @@ */ #include <math.h> +#include "gpsd.h" static double bilinear(double x1, double y1, double x2, double y2, double x, double y, double z11, double z12, double z21, double z22) { @@ -16,7 +17,7 @@ static double bilinear(double x1, double y1, double x2, double y2, double x, dou delta=(y2-y1)*(x2-x1); - return (z22*(y-y1)*(x-x1)+z21*(y2-y)*(x-x1)+z12*(y-y1)*(x2-x)+z11*(y2-y)*(x2-x))/delta; + return (z22*(y-y1)*(x-x1)+z12*(y2-y)*(x-x1)+z21*(y-y1)*(x2-x)+z11*(y2-y)*(x2-x))/delta; } double wgs84_separation(double lat, double lon) @@ -63,6 +64,7 @@ double wgs84_separation(double lat, double lon) ); } +#ifdef TESTMAIN #include <stdio.h> #include <stdlib.h> @@ -95,4 +97,4 @@ int main(int argc, char **argv) return 0; } - +#endif /* TESTMAIN */ @@ -900,8 +900,8 @@ int main(int argc, char *argv[]) for (cfd = 0; cfd < FD_SETSIZE; cfd++) { /* some listeners may be in watcher mode */ if (IS_WATCHER(cfd)) { - device->poll_times[cfd] = timestamp(); char cmds[4] = ""; + device->poll_times[cfd] = timestamp(); if (changed &~ ONLINE_SET) { if (changed & LATLON_SET) strcat(cmds, "o"); @@ -106,7 +106,7 @@ static int sirf_to_nmea(int ttyfd, int speed) * * SiRF message 2 (Measure Navigation Data Out) gives us everything we want * except PDOP, VDOP, and altitude with respect to MSL. SiRF message 41 - * (Geodetic Navigation Information) adds MSLfix.altitude, but many of its + * (Geodetic Navigation Information) adds MSL altitude, but many of its * other fields are garbage in firmware versions before 232. So...we * use all the data from message 2 *except* altitude, which we get from * message 41. @@ -166,8 +166,11 @@ int sirf_parse(struct gps_device_t *session, unsigned char *buf, int len) phi = atan2(z + e_2*b*pow(sin(theta),3),p - e2*a*pow(cos(theta),3)); n = a / sqrt(1.0 - e2*pow(sin(phi),2)); h = p / cos(phi) - n; + gpsd_report(4, "Height above ellipsoid: %f\n", h); session->gpsdata.fix.latitude = phi * RAD_2_DEG; session->gpsdata.fix.longitude = lambda * RAD_2_DEG; + gpsd_report(4, "Height with interpolated correction: %f\n", + h+wgs84_separation(session->gpsdata.fix.latitude, session->gpsdata.fix.longitude)); /* velocity computation */ vnorth = -vx*sin(phi)*cos(lambda)-vy*sin(phi)*sin(lambda)+vz*cos(phi); veast = -vx*sin(lambda)+vy*cos(lambda); @@ -400,7 +403,8 @@ int sirf_parse(struct gps_device_t *session, unsigned char *buf, int len) /* skip 4 bytes of altitude from ellipsoid */ mask = TIME_SET | LATLON_SET | STATUS_SET | MODE_SET; } - session->gpsdata.fix.altitude = getl(31)*1e-2; + session->gpsdata.fix.altitude = getl(35)*1e-2; + gpsd_report(4, "Height above MSL: %f\n", session->gpsdata.fix.altitude); if (session->driverstate & SIRF_GE_232) { /* skip 1 byte of map datum */ session->gpsdata.fix.speed = getw(36)*1e-2; |