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()
if (magYawResetRequest && use_compass()) { if (magYawResetRequest && use_compass()) {
// send initial alignment status to console // send initial alignment status to console
if (!yawAlignComplete) { 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 // set yaw from a single mag sample
@ -102,10 +102,10 @@ void NavEKF3_core::controlMagYawReset()
// send in-flight yaw alignment status to console // send in-flight yaw alignment status to console
if (finalResetRequest) { 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) { } else if (interimResetRequest) {
magYawAnomallyCount++; 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 // 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()
mag_state.q0 = 1; mag_state.q0 = 1;
mag_state.DCM.identity(); mag_state.DCM.identity();
inhibitMagStates = true; inhibitMagStates = true;
magSelectIndex = 0; magSelectIndex = dal.compass().get_first_usable();
lastMagOffsetsValid = false; lastMagOffsetsValid = false;
magStateResetRequest = false; magStateResetRequest = false;
magStateInitComplete = false; magStateInitComplete = false;

Loading…
Cancel
Save