Browse Source

AP_NavEKF3: use first usable compass index to set magSelectIndex

c415-sdk
Siddharth Purohit 4 years ago committed by Andrew Tridgell
parent
commit
cd5b764fd8
  1. 6
      libraries/AP_NavEKF3/AP_NavEKF3_MagFusion.cpp
  2. 2
      libraries/AP_NavEKF3/AP_NavEKF3_core.cpp

6
libraries/AP_NavEKF3/AP_NavEKF3_MagFusion.cpp

@ -94,7 +94,7 @@ void NavEKF3_core::controlMagYawReset() @@ -94,7 +94,7 @@ void NavEKF3_core::controlMagYawReset()
if (magYawResetRequest && use_compass()) {
// send initial alignment status to console
if (!yawAlignComplete) {
GCS_SEND_TEXT(MAV_SEVERITY_INFO, "EKF3 IMU%u initial yaw alignment complete",(unsigned)imu_index);
GCS_SEND_TEXT(MAV_SEVERITY_INFO, "EKF3 IMU%u MAG%u initial yaw alignment complete",(unsigned)imu_index, (unsigned)magSelectIndex);
}
// set yaw from a single mag sample
@ -102,10 +102,10 @@ void NavEKF3_core::controlMagYawReset() @@ -102,10 +102,10 @@ void NavEKF3_core::controlMagYawReset()
// send in-flight yaw alignment status to console
if (finalResetRequest) {
GCS_SEND_TEXT(MAV_SEVERITY_INFO, "EKF3 IMU%u in-flight yaw alignment complete",(unsigned)imu_index);
GCS_SEND_TEXT(MAV_SEVERITY_INFO, "EKF3 IMU%u MAG%u in-flight yaw alignment complete",(unsigned)imu_index, (unsigned)magSelectIndex);
} else if (interimResetRequest) {
magYawAnomallyCount++;
GCS_SEND_TEXT(MAV_SEVERITY_WARNING, "EKF3 IMU%u ground mag anomaly, yaw re-aligned",(unsigned)imu_index);
GCS_SEND_TEXT(MAV_SEVERITY_WARNING, "EKF3 IMU%u MAG%u ground mag anomaly, yaw re-aligned",(unsigned)imu_index, (unsigned)magSelectIndex);
}
// clear the complete flags if an interim reset has been performed to allow subsequent

2
libraries/AP_NavEKF3/AP_NavEKF3_core.cpp

@ -454,7 +454,7 @@ void NavEKF3_core::InitialiseVariablesMag() @@ -454,7 +454,7 @@ void NavEKF3_core::InitialiseVariablesMag()
mag_state.q0 = 1;
mag_state.DCM.identity();
inhibitMagStates = true;
magSelectIndex = 0;
magSelectIndex = dal.compass().get_first_usable();
lastMagOffsetsValid = false;
magStateResetRequest = false;
magStateInitComplete = false;

Loading…
Cancel
Save