ekf2-test: add test for inclination of mag earth field

This commit is contained in:
bresch
2023-07-24 10:16:37 -04:00
committed by Daniel Agar
parent 72be724b86
commit a95c11d48a
3 changed files with 17 additions and 1 deletions
@@ -227,6 +227,17 @@ public:
}
}
bool get_mag_inc_deg(float &val) const
{
if (_NED_origin_initialised) {
val = math::degrees(_mag_inclination_gps);
return true;
} else {
return false;
}
}
void get_mag_checks(float &inc_deg, float &inc_ref_deg, float &strength_gs, float &strength_ref_gs) const
{
inc_deg = math::degrees(_mag_inclination);
+1 -1
View File
@@ -472,7 +472,7 @@ bool Ekf::checkMagField(const Vector3f &mag_sample)
}
const Vector3f mag_earth = _R_to_earth * mag_sample;
_mag_inclination = asin(mag_earth(2) / fmaxf(mag_earth.norm(), 1e-4f));
_mag_inclination = asinf(mag_earth(2) / fmaxf(mag_earth.norm(), 1e-4f));
if (_params.mag_check & static_cast<int32_t>(MagCheckMask::INCLINATION)) {
if (PX4_ISFINITE(_mag_inclination_gps)) {