diff options
author | Thomas Gubler <thomasgubler@gmail.com> | 2014-05-06 14:43:23 +0200 |
---|---|---|
committer | Thomas Gubler <thomasgubler@gmail.com> | 2014-05-06 14:56:47 +0200 |
commit | 548c7f4aaf93bddeb05053cd4dede945fede22ef (patch) | |
tree | aabb6c251f08916ec1215536dfe3f533da72fe28 /src/lib/geo/geo.h | |
parent | fc204a18902b5d623fff1e541a3212502295ed82 (diff) | |
download | px4-firmware-548c7f4aaf93bddeb05053cd4dede945fede22ef.tar.gz px4-firmware-548c7f4aaf93bddeb05053cd4dede945fede22ef.tar.bz2 px4-firmware-548c7f4aaf93bddeb05053cd4dede945fede22ef.zip |
geo: introduce global/local coordinate frame converter which uses the map projection but also converts altitude
Diffstat (limited to 'src/lib/geo/geo.h')
-rw-r--r-- | src/lib/geo/geo.h | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/src/lib/geo/geo.h b/src/lib/geo/geo.h index 20fb34ca3..98dfbd14b 100644 --- a/src/lib/geo/geo.h +++ b/src/lib/geo/geo.h @@ -77,6 +77,11 @@ struct map_projection_reference_s { uint64_t timestamp; }; +struct globallocal_converter_reference_s { + float alt; + bool init_done; +}; + /** * Checks if global projection was initialized * @return true if map was initialized before, false else @@ -191,6 +196,27 @@ __EXPORT int map_projection_global_reproject(float x, float y, double *lat, doub __EXPORT int map_projection_reproject(const struct map_projection_reference_s *ref, float x, float y, double *lat, double *lon); /** + * Initialize the global mapping between global position (spherical) and local position (NED). + */ +__EXPORT int globallocalconverter_init(double lat_0, double lon_0, float alt_0, uint64_t timestamp); + +/** + * Checks if globallocalconverter was initialized + * @return true if map was initialized before, false else + */ +__EXPORT bool globallocalconverter_initialized(); + +/** + * Convert from global position coordinates to local position coordinates using the global reference + */ +__EXPORT int globallocalconverter_tolocal(double lat, double lon, float alt, float *x, float *y, float *z); + +/** + * Convert from local position coordinates to global position coordinates using the global reference + */ +__EXPORT int globallocalconverter_toglobal(float x, float y, float z, double *lat, double *lon, float *alt); + +/** * Returns the distance to the next waypoint in meters. * * @param lat_now current position in degrees (47.1234567°, not 471234567°) |