Compass issue - calibration

hi. I have some problem with the compass on my rov. my rov is working around the steel ships it can attach to the ship’s hull by magnets on her chain wheel. so in this situation, my compass can’t work correctly and the output data in turning 360 degrees is about 40 degree :expressionless:
Does anybody have any idea for solving this problem? can I calibrate my compass?
my last compass module was cmps11
do you have any advice or any compass or gyro that can work in this situation? also, this a student project and I have money issue and I can’t buy expensive modules like imu or usbl method.

A compass measures the local magnetic field. If you are applying any significant magnetic field or distorting earth’s magnetic field (steel ship/ferrous metals), then the compass will measure that. That’s not what you want, but there isn’t any way around it.

If your applied field is constant, then you might be able to calibrate the compass while your applied field is on in order to ‘subtract’ this constant from your measurements, leaving you with the remaining field. Another option is to fuse the compass reading with a gyroscope, and trust the gyroscope measurements when your magnet is on.

It is a difficult problem to solve… let us know if you fix it!

i can’t understand your second recommendation. can you explain more about it? “fuse the compass reading with a gyroscope”

It is a common thing. Check here.