In a rc boat, I use a compass + GPS sensor. I calculate the angle of the compass in relation to the angle of the target point. When the compass is perfectly calibrated everything is ok. Problems begin when the compass mounts eg 10 or 20 degrees in a different direction, or when the compass is incorrectly calibrated and deflects by 10-20 degrees left or right. I deal with it like this:
Subtracts the heading from the gps module (nmea with GPGGA) from the compass heading, that is:
error = (heading_gps - heading_compass)
I am doing a compass correction:
new_bearing = (heading_compass + error) % 360
The effect is that when the error is a few degrees it is ok, but when it is 30-40 error it is too big a correction in relation to the target point.
Usually the error in the GPS heading is much more than the compass error. On my capstone project that made it basically useless as we were pinging the GPS sensor very frequently and the vehicle would still be in the error range of the previous ping. That made that heading very unhelpful.
The compass is probably your most viable way of getting a heading. The compass can be very sensitive to magnetic interference. I would keep it away from fast switching circuits and high inductive loads. I would also recommend a moving average filter that could keep your heading from drifting too quickly.
Using waypoints with a built in error range could also be helpful to not have the system over correcting or over shooting.
Having the compass correctly mounted ought to be a one time work. Having it calibrated is obvious. Why try to make a second solution?
The aeroplanes I flew had a magnetic compass. Of course the various installations surrounding the compass affected the reading. That was compensated by installing small magnets to balance the disturbing magnetic fields. Even then a correction table could be found. "For heading X, stear X + y degrees".
Because I often change compasses, test different imu sensors, sometimes I am above the water over which it is very difficult for me to calibrate the compass. I want the boat to go relatively straight even when my compass is not fully calibrated correctly.
If You change compasses often You should work out a way to do it in a way giving an accurate result. The time doing that might match or be less then fiddling with GPS & Co.
What do you mean ? do you mean how to calibrate? Im uses the standard 360 degree rotation and I get the offset and scale. Unfortunately, sometimes the conditions are unfavorable and in some places I cannot calibrate the compass perfectly.
It has little to do with laziness My module is used by a dozen people at work, I would like to make it easier for them and inform them if the compass is badly calibrated ...