mirror of
https://github.com/ArduPilot/ardupilot
synced 2025-01-22 00:28:30 -04:00
AP_NavEKF3: fixed EKF3 origin alt inconsistency
always use common origin, and adjust output posD for difference between public and local lane origin heights
This commit is contained in:
parent
36c88661c8
commit
03c27c6626
@ -1366,6 +1366,10 @@ bool NavEKF3::getOriginLLH(struct Location &loc) const
|
||||
if (!core) {
|
||||
return false;
|
||||
}
|
||||
if (common_origin_valid) {
|
||||
loc = common_EKF_origin;
|
||||
return true;
|
||||
}
|
||||
return core[primary].getOriginLLH(loc);
|
||||
}
|
||||
|
||||
|
@ -255,6 +255,12 @@ bool NavEKF3_core::getPosD(float &posD) const
|
||||
posD = outputDataNew.position.z + posOffsetNED.z + 0.01f * (float)EKF_origin.alt - (float)ekfGpsRefHgt;
|
||||
}
|
||||
|
||||
// adjust posD for difference between our origin and the public_origin
|
||||
Location local_origin;
|
||||
if (getOriginLLH(local_origin)) {
|
||||
posD += (public_origin.alt - local_origin.alt) * 0.01;
|
||||
}
|
||||
|
||||
// Return the current height solution status
|
||||
return filterStatus.flags.vert_pos;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user