EKF: Add protection for undefined GPS antenna array heading offset

This commit is contained in:
Paul Riseborough 2018-09-02 21:22:58 +10:00 committed by Paul Riseborough
parent d1f3f4c916
commit 6847acb72e

View File

@ -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)) {