Use yaw source change to handle compass calibration period #48
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Rather than forcing continual resets of the magnetomer use variables which also resets the yaw data buffer, these changes do the following:
Remove calls to InitialiseVariablesMag() based on compass.learn_offsets_enabled();
When compass.learn_offsets_enabled() is true, disable use of magnetometer data as follows:
If yaw_source = AP_NavEKF_Source::SourceYaw::COMPASS set yaw_source to AP_NavEKF_Source::SourceYaw::NONE
if yaw_source = AP_NavEKF_Source::SourceYaw::GPS_COMPASS_FALLBACK set yaw_source to AP_NavEKF_Source::SourceYaw::GPS
Restore parameter selected yaw_source when compass.learn_offsets_enabled() is false. The EKF already resets the body frame mag bias estimates and compass data buffer if the compass offsets have changed so no additional resets should be necessary.
Replay testing on a SITL log shows that after the fix, RPY tracks the SIM values.