mirror of
https://github.com/ArduPilot/ardupilot
synced 2025-01-18 06:38:29 -04:00
AP_NavEKF2: don't use WMM tables unless we have a compass scale factor set
This commit is contained in:
parent
6fd0ca36aa
commit
fce4d6952f
@ -577,13 +577,16 @@ void NavEKF2_core::readGpsData()
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (gpsGoodToAlign && !have_table_earth_field) {
|
if (gpsGoodToAlign && !have_table_earth_field) {
|
||||||
table_earth_field_ga = AP_Declination::get_earth_field_ga(gpsloc);
|
const Compass *compass = _ahrs->get_compass();
|
||||||
table_declination = radians(AP_Declination::get_declination(gpsloc.lat*1.0e-7,
|
if (compass && compass->have_scale_factor(magSelectIndex)) {
|
||||||
gpsloc.lng*1.0e-7));
|
table_earth_field_ga = AP_Declination::get_earth_field_ga(gpsloc);
|
||||||
have_table_earth_field = true;
|
table_declination = radians(AP_Declination::get_declination(gpsloc.lat*1.0e-7,
|
||||||
if (frontend->_mag_ef_limit > 0) {
|
gpsloc.lng*1.0e-7));
|
||||||
// initialise earth field from tables
|
have_table_earth_field = true;
|
||||||
stateStruct.earth_magfield = table_earth_field_ga;
|
if (frontend->_mag_ef_limit > 0) {
|
||||||
|
// initialise earth field from tables
|
||||||
|
stateStruct.earth_magfield = table_earth_field_ga;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user