Browse Source

AP_AHRS: add a singleton-getter cast into AP_AHRS_NavEKF

This will allow libraries which absolutely require the EKF to easily get
a cast copy of the singleton.
master
Peter Barker 7 years ago committed by Francisco Ferreira
parent
commit
4d944da530
  1. 6
      libraries/AP_AHRS/AP_AHRS.h
  2. 6
      libraries/AP_AHRS/AP_AHRS_NavEKF.cpp

6
libraries/AP_AHRS/AP_AHRS.h

@ -686,4 +686,10 @@ private: @@ -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
};

6
libraries/AP_AHRS/AP_AHRS_NavEKF.cpp

@ -1642,5 +1642,11 @@ uint8_t AP_AHRS_NavEKF::get_primary_gyro_index(void) const @@ -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_NavEKF&>(*AP_AHRS::get_singleton());
}
#endif // AP_AHRS_NAVEKF_AVAILABLE

Loading…
Cancel
Save