mirror of
https://github.com/ArduPilot/ardupilot
synced 2025-01-09 09:28:31 -04:00
AP_NavEKF2: use vector comparison for new mag vector
This commit is contained in:
parent
c9b1b02b8e
commit
ac60901b0c
@ -185,7 +185,7 @@ void NavEKF2_core::readMagData()
|
|||||||
|
|
||||||
// detect changes to magnetometer offset parameters and reset states
|
// detect changes to magnetometer offset parameters and reset states
|
||||||
Vector3f nowMagOffsets = _ahrs->get_compass()->get_offsets(magSelectIndex);
|
Vector3f nowMagOffsets = _ahrs->get_compass()->get_offsets(magSelectIndex);
|
||||||
bool changeDetected = lastMagOffsetsValid && (!is_equal(nowMagOffsets.x,lastMagOffsets.x) || !is_equal(nowMagOffsets.y,lastMagOffsets.y) || !is_equal(nowMagOffsets.z,lastMagOffsets.z));
|
bool changeDetected = lastMagOffsetsValid && (nowMagOffsets != lastMagOffsets);
|
||||||
if (changeDetected) {
|
if (changeDetected) {
|
||||||
// zero the learned magnetometer bias states
|
// zero the learned magnetometer bias states
|
||||||
stateStruct.body_magfield.zero();
|
stateStruct.body_magfield.zero();
|
||||||
|
Loading…
Reference in New Issue
Block a user