Well I can get the compass calibrated so that it does point north at first (when facing north), but if I rotate the robot 360 degrees it does not still point at north like it should. Additionally some calibrations will drift over time while not moving! Calibration is not straight forward as I could not do it successfully inside, on top of buildings built with steel, near cars, or while wearing metal (these were determined experimentally). I would assume metal pipes under the concrete are also messing things up for me, but I can only control so many variables.
The compass I am using is the one that is part of the Neo-M8. I have configured APM to ignore the one on the PXFMini as it is too close to metal and motors to be of any use. Additionally I have experimentally discovered that APM takes into account the accelerometers while determining heading. I determined this by rotating only the GPS unit with compass (Neo-M8) and noticing that the heading was not changing by as much as I was rotating. I'm not sure if the compass is what is creating heading error while rotating, or if it is the accelerometers. I have yet to attempt heading estimating by using dead reckoning to determine if it really is the accelerometers, but I don't think dead reckoning is going to do me any good as the bot vibrates a lot while moving. This may seem to be the main reason for the heading drift, but even when I pick the bot up and rotate it carefully myself the drift is still present. Of course the EKF complains a lot while the robot is turning. I frequently will get errors about bad vert or hori pos while rotating in place, which I don't know how to make sense of.
My offsets after compass calibration are not crazy(X=Usually 4-19, Y= Usually -177 - -135, Z= Usually 140-146) , which indicates there is little interference ( because their absolute values are less than 300). Why do the values change and not the same every time? I don't know. I only have so much patience to keep recalibrating hoping to find the magic offsets. Even if I did find them I am supposed to do this on 3 rovers and 3 kayaks so I'll have to get this down to a science somehow if I figure it out.
I have tried a different GPS unit. I have tried EKF3. I have tried the firmware provided by Lander on MEGA.nz. I have tried apm-rover-3.2-erlebrain. I have tried APMrover2, which doesn't even have onboard calibration (which is supposed to be better than offboard). Obviously I have tried onboard and offboard calibration, only the onboard one gives me a good north (at first), but both drift when the bot rotates. I have tried setting the compass offsets manually. I have tried all 4 levels of strictness when calibrating. I have tried calibrating the accelerometers after the compass calibration. None of this has solved the drifting heading problem. I don't know if there is anything that Erle can do to fix my problem as I think it has more to do with the APM software.
Here is what the bot looks like:
The GPS tower is 7 inches tall and an old needle compass does not indicate that there is magnetic interference where the GPS is. The body is aluminum. Today I am going to try again, but this time with all of the hardware mounted on a wooden board.
I do not really have a plan for how I am going to go about troubleshooting this more. I think I may start reading the code for AP_Compass and see what I could modify there to give me more information about what is going on in ardurover. I would very much appreciate help with this, ideas on how to troubleshoot it, or other websites to post this to get more help. I understand that this forum is more for Erle hardware, and that Erle did not write most of ardurover software, but I figured I would give this thread an update. If by some miracle I figure out how to solve my problem, I will most definitely make that information available here.