diff --git a/libraries/AP_Common/Location.cpp b/libraries/AP_Common/Location.cpp index 4af398084e..41b09f1fcc 100644 --- a/libraries/AP_Common/Location.cpp +++ b/libraries/AP_Common/Location.cpp @@ -26,6 +26,7 @@ void Location::zero(void) memset(this, 0, sizeof(*this)); } +// Construct location using position (NEU) from ekf_origin for the given altitude frame Location::Location(int32_t latitude, int32_t longitude, int32_t alt_in_cm, AltFrame frame) { zero(); @@ -34,10 +35,10 @@ Location::Location(int32_t latitude, int32_t longitude, int32_t alt_in_cm, AltFr set_alt_cm(alt_in_cm, frame); } -Location::Location(const Vector3f &ekf_offset_neu) +Location::Location(const Vector3f &ekf_offset_neu, AltFrame frame) { // store alt and alt frame - set_alt_cm(ekf_offset_neu.z, AltFrame::ABOVE_ORIGIN); + set_alt_cm(ekf_offset_neu.z, frame); // calculate lat, lon Location ekf_origin; diff --git a/libraries/AP_Common/Location.h b/libraries/AP_Common/Location.h index bb18bedeee..ba317d432f 100644 --- a/libraries/AP_Common/Location.h +++ b/libraries/AP_Common/Location.h @@ -32,7 +32,7 @@ public: /// constructors Location(); Location(int32_t latitude, int32_t longitude, int32_t alt_in_cm, AltFrame frame); - Location(const Vector3f &ekf_offset_neu); + Location(const Vector3f &ekf_offset_neu, AltFrame frame); static void set_terrain(AP_Terrain* terrain) { _terrain = terrain; }