From 3959780999744e159601acd7a1742e49a0956d65 Mon Sep 17 00:00:00 2001 From: Peter Barker Date: Thu, 21 Feb 2019 08:39:37 +1100 Subject: [PATCH] AP_AHRS: ensure home is always stored in ALT_FRAME_ABSOLUTE --- libraries/AP_AHRS/AP_AHRS_DCM.cpp | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/libraries/AP_AHRS/AP_AHRS_DCM.cpp b/libraries/AP_AHRS/AP_AHRS_DCM.cpp index b5d88570d2..1caa80178a 100644 --- a/libraries/AP_AHRS/AP_AHRS_DCM.cpp +++ b/libraries/AP_AHRS/AP_AHRS_DCM.cpp @@ -1040,8 +1040,15 @@ bool AP_AHRS_DCM::set_home(const Location &loc) if (!check_latlng(loc)) { return false; } + // home must always be global frame at the moment as .alt is + // accessed directly by the vehicles and they may not be rigorous + // in checking the frame type. + Location tmp = loc; + if (!tmp.change_alt_frame(Location::ALT_FRAME_ABSOLUTE)) { + return false; + } - _home = loc; + _home = tmp; _home_is_set = true; // log ahrs home and ekf origin dataflash