AP_NavEKF2: replace location_offset() and get_distance() function calls with Location object member function calls

This allows removing duplicated code
This commit is contained in:
Dr.-Ing. Amilcar do Carmo Lucas 2019-02-25 01:16:24 +01:00 committed by Peter Barker
parent fa9a460c30
commit 79ee52917f

View File

@ -328,7 +328,7 @@ bool NavEKF2_core::getLLH(struct Location &loc) const
loc.lat = EKF_origin.lat; loc.lat = EKF_origin.lat;
loc.lng = EKF_origin.lng; loc.lng = EKF_origin.lng;
// correct for IMU offset (EKF calculations are at the IMU position) // correct for IMU offset (EKF calculations are at the IMU position)
location_offset(loc, (outputDataNew.position.x + posOffsetNED.x), (outputDataNew.position.y + posOffsetNED.y)); loc.offset((outputDataNew.position.x + posOffsetNED.x), (outputDataNew.position.y + posOffsetNED.y));
return true; return true;
} else { } else {
// we could be in constant position mode because the vehicle has taken off without GPS, or has lost GPS // we could be in constant position mode because the vehicle has taken off without GPS, or has lost GPS
@ -342,7 +342,7 @@ bool NavEKF2_core::getLLH(struct Location &loc) const
} else { } else {
// if no GPS fix, provide last known position before entering the mode // if no GPS fix, provide last known position before entering the mode
// correct for IMU offset (EKF calculations are at the IMU position) // correct for IMU offset (EKF calculations are at the IMU position)
location_offset(loc, (lastKnownPositionNE.x + posOffsetNED.x), (lastKnownPositionNE.y + posOffsetNED.y)); loc.offset((lastKnownPositionNE.x + posOffsetNED.x), (lastKnownPositionNE.y + posOffsetNED.y));
return false; return false;
} }
} }