mirror of
https://github.com/ArduPilot/ardupilot
synced 2025-01-22 00:28:30 -04:00
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.
This commit is contained in:
parent
c83ff0e156
commit
4d944da530
@ -686,4 +686,10 @@ private:
|
|||||||
|
|
||||||
namespace AP {
|
namespace AP {
|
||||||
AP_AHRS &ahrs();
|
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
|
||||||
};
|
};
|
||||||
|
@ -1642,5 +1642,11 @@ uint8_t AP_AHRS_NavEKF::get_primary_gyro_index(void) const
|
|||||||
return AP::ins().get_primary_gyro();
|
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
|
#endif // AP_AHRS_NAVEKF_AVAILABLE
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user