Browse Source

AP_NavEKF2: Ensure reported local height = global height - origin height

mission-4.1.18
priseborough 8 years ago committed by Francisco Ferreira
parent
commit
fd25450632
  1. 15
      libraries/AP_NavEKF2/AP_NavEKF2_Outputs.cpp

15
libraries/AP_NavEKF2/AP_NavEKF2_Outputs.cpp

@ -279,18 +279,27 @@ bool NavEKF2_core::getPosNE(Vector2f &posNE) const @@ -279,18 +279,27 @@ bool NavEKF2_core::getPosNE(Vector2f &posNE) const
return false;
}
// Write the last calculated D position of the body frame origin relative to the reference point (m).
// Write the last calculated D position of the body frame origin relative to the EKF origin (m).
// Return true if the estimate is valid
bool NavEKF2_core::getPosD(float &posD) const
{
// The EKF always has a height estimate regardless of mode of operation
// correct for the IMU offset (EKF calculations are at the IMU)
posD = outputDataNew.position.z + posOffsetNED.z;
// Correct for the IMU offset (EKF calculations are at the IMU)
// Correct for
if (frontend->_originHgtMode & (1<<2)) {
// Any sensor height drift corrections relative to the WGS-84 reference are applied to the origin.
posD = outputDataNew.position.z + posOffsetNED.z;
} else {
// The origin height is static and corrections are applied to the local vertical position
// so that height returned by getLLH() = height returned by getOriginLLH - posD
posD = outputDataNew.position.z + posOffsetNED.z + 0.01f * (float)EKF_origin.alt - (float)ekfGpsRefHgt;
}
// Return the current height solution status
return filterStatus.flags.vert_pos;
}
// return the estimated height of body frame origin above ground level
bool NavEKF2_core::getHAGL(float &HAGL) const
{

Loading…
Cancel
Save