Mbed library to handle GPS data reception and parsing
Dependents: GPS_U-blox_NEO-6M_Code
Features
- All positionning parameters are contained into a global data structure.
- Automatic nema string parsing and data structure update.
- GSA,GGA,VTG and RMC
- Convert latitude and longitude to decimal value.
- Converts latittude,longitude and altitude to ECEF coordinates.
Planed developement
- Test library for RTOS use.
- Complete the nema parsing decoders (couple of parameters are not parsed yet and not present in the data structure).
- Add conversion tool to get ENU coordinates.
Diff: utils/GPSUtils.hpp
- Revision:
- 1:fade122a76a8
- Parent:
- 0:0c1aa5906cef
- Child:
- 2:72ac4d7044a7
diff -r 0c1aa5906cef -r fade122a76a8 utils/GPSUtils.hpp --- a/utils/GPSUtils.hpp Wed Aug 06 01:37:39 2014 +0000 +++ b/utils/GPSUtils.hpp Mon Apr 06 17:41:43 2015 +0000 @@ -81,4 +81,20 @@ } return decimal; } + +// Coverts ECEF to ENU coordinates centered at given lat, lon +void ecefToEnu(double lat, double lon, double x, double y, double z, double xr, double yr, double zr, double *e, double *n, double *u) +{ + double clat = cos(lat * DEGREES_TO_RADIANS); + double slat = sin(lat * DEGREES_TO_RADIANS); + double clon = cos(lon * DEGREES_TO_RADIANS); + double slon = sin(lon * DEGREES_TO_RADIANS); + double dx = x - xr; + double dy = y - yr; + double dz = z - zr; + + *e = -slon*dx + clon*dy; + *n = -slat*clon*dx - slat*slon*dy + clat*dz; + *u = clat*clon*dx + clat*slon*dy + slat*dz; +} #endif \ No newline at end of file