AP_NavEKF: Output terrain relative PosD when relying on Optical Flow

This commit is contained in:
priseborough 2014-11-29 20:26:35 +11:00 committed by Andrew Tridgell
parent 0156d846f1
commit d701cfcb75

View File

@ -3576,7 +3576,14 @@ void NavEKF::getVelNED(Vector3f &vel) const
// return false if no position is available
bool NavEKF::getPosNED(Vector3f &pos) const
{
pos = state.position;
pos.x = state.position.x;
pos.y = state.position.y;
// If relying on optical flow, then output ground relative position so that the vehicle does terain following
if (_fusionModeGPS == 3) {
pos.z = state.position.z - flowStates[1];
} else {
pos.z = state.position.z;
}
return true;
}