diff --git a/libraries/AP_NavEKF3/AP_NavEKF3_core.cpp b/libraries/AP_NavEKF3/AP_NavEKF3_core.cpp index 67298272ffe85..a35a95920bd84 100644 --- a/libraries/AP_NavEKF3/AP_NavEKF3_core.cpp +++ b/libraries/AP_NavEKF3/AP_NavEKF3_core.cpp @@ -394,7 +394,9 @@ void NavEKF3_core::InitialiseVariables() storedGPS.reset(); storedBaro.reset(); storedTAS.reset(); +#if EK3_FEATURE_RANGEFINDER_MEASUREMENTS storedRange.reset(); +#endif storedOutput.reset(); #if EK3_FEATURE_BEACON_FUSION rngBcn.storedRange.reset(); diff --git a/libraries/AP_NavEKF3/AP_NavEKF3_core.h b/libraries/AP_NavEKF3/AP_NavEKF3_core.h index 322ebc6907ab2..d930bbb0fc5b9 100644 --- a/libraries/AP_NavEKF3/AP_NavEKF3_core.h +++ b/libraries/AP_NavEKF3/AP_NavEKF3_core.h @@ -1056,7 +1056,9 @@ class NavEKF3_core : public NavEKF_core_common EKF_obs_buffer_t storedMag; // Magnetometer data buffer EKF_obs_buffer_t storedBaro; // Baro data buffer EKF_obs_buffer_t storedTAS; // TAS data buffer +#if EK3_FEATURE_RANGEFINDER_MEASUREMENTS EKF_obs_buffer_t storedRange; // Range finder data buffer +#endif EKF_IMU_buffer_t storedOutput;// output state buffer Matrix3F prevTnb; // previous nav to body transformation used for INS earth rotation compensation ftype accNavMag; // magnitude of navigation accel - used to adjust GPS obs variance (m/s^2)