From f63c32531c4c132670cc6c44842056d39df7acf6 Mon Sep 17 00:00:00 2001 From: Paul Riseborough Date: Thu, 15 Oct 2015 16:10:44 +1100 Subject: [PATCH] AP_InertialNav: Address peer review comments The decision to set the origin to zero has been moved out of the AHRS library and into the inertial nav library as this is consumer specific. --- libraries/AP_InertialNav/AP_InertialNav_NavEKF.cpp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/libraries/AP_InertialNav/AP_InertialNav_NavEKF.cpp b/libraries/AP_InertialNav/AP_InertialNav_NavEKF.cpp index d57c0f51b6..a4764532fb 100644 --- a/libraries/AP_InertialNav/AP_InertialNav_NavEKF.cpp +++ b/libraries/AP_InertialNav/AP_InertialNav_NavEKF.cpp @@ -54,7 +54,10 @@ nav_filter_status AP_InertialNav_NavEKF::get_filter_status() const struct Location AP_InertialNav_NavEKF::get_origin() const { struct Location ret; - ret = _ahrs_ekf.get_origin(); + if (!_ahrs_ekf.get_origin(ret)) { + // initialise location to all zeros if EKF1 origin not yet set + memset(&ret, 0, sizeof(ret)); + } return ret; }