AP_NavEKF: Always return a NED relative position if possible
If a calculated position is not available, the function will return a value based on raw GPS or last calculation if available, but the status will be set to false to indicate that it cannot be used for control.
mission-4.1.18
Paul Riseborough10 years agocommitted byRandy Mackay
// return the last calculated NED position relative to the reference point (m).
// Return the last calculated NED position relative to the reference point (m).
// return false if no position is available
// if a calculated solution is not available, use the best available data and return false
boolNavEKF::getPosNED(Vector3f&pos)const
boolNavEKF::getPosNED(Vector3f&pos)const
{
{
if(constPosMode){
// The EKF always has a height estimate regardless of mode of operation
pos.x=state.position.x+lastKnownPositionNE.x;
pos.z=state.position.z;
pos.y=state.position.y+lastKnownPositionNE.y;
// There are three modes of operation, absolute position (GPS fusion), relative position (optical flow fusion) and constant position (no position estimate available)