From 6847acb72ee6dae9f189bd005b5aadba0dc461f2 Mon Sep 17 00:00:00 2001 From: Paul Riseborough Date: Sun, 2 Sep 2018 21:22:58 +1000 Subject: [PATCH] EKF: Add protection for undefined GPS antenna array heading offset --- EKF/estimator_interface.cpp | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/EKF/estimator_interface.cpp b/EKF/estimator_interface.cpp index 8b1b0d2800..200c507d97 100644 --- a/EKF/estimator_interface.cpp +++ b/EKF/estimator_interface.cpp @@ -221,7 +221,11 @@ void EstimatorInterface::setGpsData(uint64_t time_usec, struct gps_message *gps) gps_sample_new.hgt = (float)gps->alt * 1e-3f; gps_sample_new.yaw = gps->yaw; - _gps_yaw_offset = gps->yaw_offset; + if (ISFINITE(gps->yaw_offset)) { + _gps_yaw_offset = gps->yaw_offset; + } else { + _gps_yaw_offset = 0.0f; + } // Only calculate the relative position if the WGS-84 location of the origin is set if (collect_gps(time_usec, gps)) {