mirror of
https://github.com/ArduPilot/ardupilot
synced 2025-01-03 14:38:30 -04:00
AP_NavEKF2: Fix roundoff, and missing offset handling of getLLH
This commit is contained in:
parent
7e1ed948f5
commit
66e9286cf6
@ -316,10 +316,12 @@ bool NavEKF2_core::getHAGL(float &HAGL) const
|
|||||||
bool NavEKF2_core::getLLH(struct Location &loc) const
|
bool NavEKF2_core::getLLH(struct Location &loc) const
|
||||||
{
|
{
|
||||||
const AP_GPS &gps = AP::gps();
|
const AP_GPS &gps = AP::gps();
|
||||||
|
Location origin;
|
||||||
|
float posD;
|
||||||
|
|
||||||
if(validOrigin) {
|
if(getPosD(posD) && getOriginLLH(origin)) {
|
||||||
// Altitude returned is an absolute altitude relative to the WGS-84 spherioid
|
// Altitude returned is an absolute altitude relative to the WGS-84 spherioid
|
||||||
loc.alt = 100 * (int32_t)(ekfGpsRefHgt - (double)outputDataNew.position.z);
|
loc.alt = origin.alt - posD*100;
|
||||||
loc.flags.relative_alt = 0;
|
loc.flags.relative_alt = 0;
|
||||||
loc.flags.terrain_alt = 0;
|
loc.flags.terrain_alt = 0;
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user