Compass offset learn never initiated/started?

Hello,

It seems that for some reason the compass offset learning is not initiated. There is no events/messages on the log or on the GCS regarding compass offset learning. I saw following mentions on github, but I’m not sure about these.


Compass::use_for_yaw(uint8_t i) const
{
// when we are doing in-flight compass learning the state
// estimator must not use the compass. The learning code turns off
// inflight learning when it has converged
return _state[i].use_for_yaw && _learn.get() != LEARN_INFLIGHT;
}

GitHub

There should be following lines on the LOG

… DataFlash_Class::instance()->Log_Write(“COFS”, “TimeUS,OfsX,OfsY,OfsZ,Var,Yaw,WVar,N”, “QffffffI”…
https://github.com/ArduPilot/ardupilot/blob/8f51bef0f0b629cb903859afda88bea1e6878ef9/libraries/AP_Compass/Compass_learn.cpp#L107

I think that there should be following line shown on GCS (MissionPlanner)?

gcs().send_text(MAV_SEVERITY_INFO, “CompassLearn: finished”)
Github

The main question is does it do the compass offset learning or not and in which cases it shouldn’t do it.

@VDLJu,

The compass offset learning (i.e. COMPASS_LEARN = 3) it didn’t make it into Copter-3.6 I’m afraid. There is this blog post though where it can be tested ahead of Copter-3.7.

i did not get to test it yet - the new switch option 62 to initiate this learning - does it require for compass_learn to be set to 3, prior for it to be used, or is it enough just to set option 62 on a switch for an initiation of this procedure?

But how about that COMPASS_LEARN = 2 (ekf-learning). That should work? Shouldn’t I see logs related to EKF-learning?

If I understood correctly it should save the learned offsets after landing?

Currently I don’t see anything related to compass learning on GCS and/or on Logs.

@VDLJu,

Yes, COMPASS_LEARN = 2 should work. I’m not aware of any logging done from this feature. All that might appear is a PARM message when the offsets are saved after the vehicle is disarmed. But that might not be recorded in the logs unless LOG_DISARMED = 1.