GPS, and compass heading error

See this tutorial for the most comprehensive method to calibrate a magnetometer (9 parameter).

https://forum.pololu.com/t/correcting-the-balboa-magnetometer/14315