![](/media/cache/profiles/3596c80a46918e6dde2f3c37290cba47.50x50_q85.jpg)
A porting of a GPS decoding and presenting program within the mbos RTOS. It is not a definitive application but a study program to test NMEA full decoding library and a first approach to an RTOS. Many thanks to Andrew Levido for his support and his patience on teaching me the RTOS principles from the other side of the Earth. It uses NMEA library by Tim (xtimor@gmail.com) ported by Ken Todotani (http://mbed.org/users/todotani/) on public mbed library (http://mbed.org/users/todotani/programs/GPS_nmeaLib/5yo4h) also available, as original universal C library, on http://nmea.sourceforge.net
Dependencies: mbos Watchdog TextLCD mbed ConfigFile
nmea/gmath.h@3:a2f9eb3b8a16, 2012-02-03 (annotated)
- Committer:
- guiott
- Date:
- Fri Feb 03 16:29:52 2012 +0000
- Revision:
- 3:a2f9eb3b8a16
- Parent:
- 0:d177c0087d1f
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
guiott | 0:d177c0087d1f | 1 | /* |
guiott | 0:d177c0087d1f | 2 | * |
guiott | 0:d177c0087d1f | 3 | * NMEA library |
guiott | 0:d177c0087d1f | 4 | * URL: http://nmea.sourceforge.net |
guiott | 0:d177c0087d1f | 5 | * Author: Tim (xtimor@gmail.com) |
guiott | 0:d177c0087d1f | 6 | * Licence: http://www.gnu.org/licenses/lgpl.html |
guiott | 0:d177c0087d1f | 7 | * $Id: gmath.h 17 2008-03-11 11:56:11Z xtimor $ |
guiott | 0:d177c0087d1f | 8 | * |
guiott | 0:d177c0087d1f | 9 | */ |
guiott | 0:d177c0087d1f | 10 | |
guiott | 0:d177c0087d1f | 11 | #ifndef __NMEA_GMATH_H__ |
guiott | 0:d177c0087d1f | 12 | #define __NMEA_GMATH_H__ |
guiott | 0:d177c0087d1f | 13 | |
guiott | 0:d177c0087d1f | 14 | #include "info.h" |
guiott | 0:d177c0087d1f | 15 | |
guiott | 0:d177c0087d1f | 16 | #define NMEA_PI (3.141592653589793) /**< PI value */ |
guiott | 0:d177c0087d1f | 17 | #define NMEA_PI180 (NMEA_PI / 180) /**< PI division by 180 */ |
guiott | 0:d177c0087d1f | 18 | #define NMEA_EARTHRADIUS_KM (6378) /**< Earth's mean radius in km */ |
guiott | 0:d177c0087d1f | 19 | #define NMEA_EARTHRADIUS_M (NMEA_EARTHRADIUS_KM * 1000) /**< Earth's mean radius in m */ |
guiott | 0:d177c0087d1f | 20 | #define NMEA_EARTH_SEMIMAJORAXIS_M (6378137.0) /**< Earth's semi-major axis in m according WGS84 */ |
guiott | 0:d177c0087d1f | 21 | #define NMEA_EARTH_SEMIMAJORAXIS_KM (NMEA_EARTHMAJORAXIS_KM / 1000) /**< Earth's semi-major axis in km according WGS 84 */ |
guiott | 0:d177c0087d1f | 22 | #define NMEA_EARTH_FLATTENING (1 / 298.257223563) /**< Earth's flattening according WGS 84 */ |
guiott | 0:d177c0087d1f | 23 | #define NMEA_DOP_FACTOR (5) /**< Factor for translating DOP to meters */ |
guiott | 0:d177c0087d1f | 24 | |
guiott | 0:d177c0087d1f | 25 | #ifdef __cplusplus |
guiott | 0:d177c0087d1f | 26 | extern "C" { |
guiott | 0:d177c0087d1f | 27 | #endif |
guiott | 0:d177c0087d1f | 28 | |
guiott | 0:d177c0087d1f | 29 | /* |
guiott | 0:d177c0087d1f | 30 | * degree VS radian |
guiott | 0:d177c0087d1f | 31 | */ |
guiott | 0:d177c0087d1f | 32 | |
guiott | 0:d177c0087d1f | 33 | double nmea_degree2radian(double val); |
guiott | 0:d177c0087d1f | 34 | double nmea_radian2degree(double val); |
guiott | 0:d177c0087d1f | 35 | |
guiott | 0:d177c0087d1f | 36 | /* |
guiott | 0:d177c0087d1f | 37 | * NDEG (NMEA degree) |
guiott | 0:d177c0087d1f | 38 | */ |
guiott | 0:d177c0087d1f | 39 | |
guiott | 0:d177c0087d1f | 40 | double nmea_ndeg2degree(double val); |
guiott | 0:d177c0087d1f | 41 | double nmea_degree2ndeg(double val); |
guiott | 0:d177c0087d1f | 42 | |
guiott | 0:d177c0087d1f | 43 | double nmea_ndeg2radian(double val); |
guiott | 0:d177c0087d1f | 44 | double nmea_radian2ndeg(double val); |
guiott | 0:d177c0087d1f | 45 | |
guiott | 0:d177c0087d1f | 46 | /* |
guiott | 0:d177c0087d1f | 47 | * DOP |
guiott | 0:d177c0087d1f | 48 | */ |
guiott | 0:d177c0087d1f | 49 | |
guiott | 0:d177c0087d1f | 50 | double nmea_calc_pdop(double hdop, double vdop); |
guiott | 0:d177c0087d1f | 51 | double nmea_dop2meters(double dop); |
guiott | 0:d177c0087d1f | 52 | double nmea_meters2dop(double meters); |
guiott | 0:d177c0087d1f | 53 | |
guiott | 0:d177c0087d1f | 54 | /* |
guiott | 0:d177c0087d1f | 55 | * positions work |
guiott | 0:d177c0087d1f | 56 | */ |
guiott | 0:d177c0087d1f | 57 | |
guiott | 0:d177c0087d1f | 58 | void nmea_info2pos(const nmeaINFO *info, nmeaPOS *pos); |
guiott | 0:d177c0087d1f | 59 | void nmea_pos2info(const nmeaPOS *pos, nmeaINFO *info); |
guiott | 0:d177c0087d1f | 60 | |
guiott | 0:d177c0087d1f | 61 | double nmea_distance( |
guiott | 0:d177c0087d1f | 62 | const nmeaPOS *from_pos, |
guiott | 0:d177c0087d1f | 63 | const nmeaPOS *to_pos |
guiott | 0:d177c0087d1f | 64 | ); |
guiott | 0:d177c0087d1f | 65 | |
guiott | 0:d177c0087d1f | 66 | double nmea_distance_ellipsoid( |
guiott | 0:d177c0087d1f | 67 | const nmeaPOS *from_pos, |
guiott | 0:d177c0087d1f | 68 | const nmeaPOS *to_pos, |
guiott | 0:d177c0087d1f | 69 | double *from_azimuth, |
guiott | 0:d177c0087d1f | 70 | double *to_azimuth |
guiott | 0:d177c0087d1f | 71 | ); |
guiott | 0:d177c0087d1f | 72 | |
guiott | 0:d177c0087d1f | 73 | int nmea_move_horz( |
guiott | 0:d177c0087d1f | 74 | const nmeaPOS *start_pos, |
guiott | 0:d177c0087d1f | 75 | nmeaPOS *end_pos, |
guiott | 0:d177c0087d1f | 76 | double azimuth, |
guiott | 0:d177c0087d1f | 77 | double distance |
guiott | 0:d177c0087d1f | 78 | ); |
guiott | 0:d177c0087d1f | 79 | |
guiott | 0:d177c0087d1f | 80 | int nmea_move_horz_ellipsoid( |
guiott | 0:d177c0087d1f | 81 | const nmeaPOS *start_pos, |
guiott | 0:d177c0087d1f | 82 | nmeaPOS *end_pos, |
guiott | 0:d177c0087d1f | 83 | double azimuth, |
guiott | 0:d177c0087d1f | 84 | double distance, |
guiott | 0:d177c0087d1f | 85 | double *end_azimuth |
guiott | 0:d177c0087d1f | 86 | ); |
guiott | 0:d177c0087d1f | 87 | |
guiott | 0:d177c0087d1f | 88 | #ifdef __cplusplus |
guiott | 0:d177c0087d1f | 89 | } |
guiott | 0:d177c0087d1f | 90 | #endif |
guiott | 0:d177c0087d1f | 91 | |
guiott | 0:d177c0087d1f | 92 | #endif /* __NMEA_GMATH_H__ */ |