diff --git a/libraries/AP_AHRS/AP_AHRS.h b/libraries/AP_AHRS/AP_AHRS.h index c1a8d62f0d..d6fd37fe4d 100644 --- a/libraries/AP_AHRS/AP_AHRS.h +++ b/libraries/AP_AHRS/AP_AHRS.h @@ -686,4 +686,10 @@ private: namespace AP { AP_AHRS &ahrs(); + + // use ahrs_navekf() only where the AHRS interface doesn't expose the + // functionality you require: +#if AP_AHRS_NAVEKF_AVAILABLE + AP_AHRS_NavEKF &ahrs_navekf(); +#endif }; diff --git a/libraries/AP_AHRS/AP_AHRS_NavEKF.cpp b/libraries/AP_AHRS/AP_AHRS_NavEKF.cpp index a68bb8a464..9383e308f4 100644 --- a/libraries/AP_AHRS/AP_AHRS_NavEKF.cpp +++ b/libraries/AP_AHRS/AP_AHRS_NavEKF.cpp @@ -1642,5 +1642,11 @@ uint8_t AP_AHRS_NavEKF::get_primary_gyro_index(void) const return AP::ins().get_primary_gyro(); } + +AP_AHRS_NavEKF &AP::ahrs_navekf() +{ + return static_cast(*AP_AHRS::get_singleton()); +} + #endif // AP_AHRS_NAVEKF_AVAILABLE