June 11, 2018, 11:29pm
I’m not sure this is specific to the new firmware.
Trying to use compass learning, but can’t get it to generate new offsets:
COMPASS_LEARN = 2
EK3_ENABLE = 1
AHRS_EKF_TYPE = 3
I found instructions before, but can’t for the life of me find them again. I’m setting those parameters, then ARMING, running around in circles for 10 minutes or so, then DISARMING, and the COMPASS_OFS_xyz aren’t changing even after a “refresh parameters”.
What am I missing?
June 12, 2018, 1:53am
saves the compass offsets once per minute and I’ve seen the PARM messages in the logs that show that the compass offsets are being saved. I’m unsure if the learning actually works though…
June 18, 2018, 10:04am
Hmm, yup, I can see them in the dataflash logs … entirely unchanged.
You’ve referenced the “saving” here -
What do you need to set to have them saved, and/or where are they being saved? I know they are in the MAG messages in the dataflash logs, but they never seem to change.
Can you post your relevant parameters for how you’re seeing them being saved / changed?
June 18, 2018, 1:52pm
Ahh, I’ve dug through the dataflash - it IS writing the offsets, they’re just the same ones set in MP over and over again!
It looks a lot like learning isn’t working, although the EKF is successfully calculating the required delta in offsets (XKF2.MagX etc). Maybe it’s the transcription of those that’s the problem.
June 18, 2018, 11:51pm
Yes, it’s saving unchanged compass offsets. You may be right that it’s some kind of copying that’s going wrong. I see Copter has
this bit of code in motors.cpp that gets the offsets from the EKF and saves them to the compass… so perhaps we need to do this as well in rover… I’ve created an issue for this item as well.
June 19, 2018, 7:28am
For reference, with EK3_MAG_CAL set to 4, it calculates good offsets as long as you’ve been driving around and not reversing.
I’m not sure what the optimal MAG_CAL setting is for Rover.