Problem with different AHRS_ORIENTATION and COMPASS_ORIENTATION

I have plane with Cube Orange and Here3 CAN GPS setup where Cube is mounted 180 degrees yaw (facing tail) and Here3 GPS is mounted normally towards nose.

When using AHRS_ORIENTATION: 4 (ie Yaw180) and COMPASS_ORIENTATION: 0 settings and using only Here3 external compass (disabled internal) Im facing problems with Here3 compass readings - Mission Planner shows 100 degrees when reference phone compass shows 342 degrees.

The only way Im getting compass readings to match roughly is when I also rotate Here3 compass physically 180 degrees (facing tail) and set COMPASS_ORIENTATION: 4 (ie Yaw180).

Reading previous forum threads about AHRS_ORIENTATION and COMPASS_ORIENTATION there is lot of confusion still.
It is not exactly clear what is the relation between these 2 settings - is COMPASS_ORIENTATION relative to the aiframe or relative to autopilot/AHRS_ORIENTATION?

Could it be that there is a bug in Ardupilot with AHRS_ORIENTATION: 4 and COMPASS_ORIENTATION: 0?

I suspect that compass orientation shouldnt actually matter once calibrated. Have you gone outside with a 3D fix and done the compass calibration after setting the orientations? - just checking, sometimes the obvious question needs to be asked :slight_smile:

Yes - I did all the calibrations with GPS 3DFix outside. IMU, Level, CompassCal. The only way compass shows correct heading is when I physically orient Here3 GPS the same way as my Cube flightcontroller board (Yaw180).

Thanks for this Andres, I seem to be having a similar problem with a Durandal. Calibration gives COMPASS_OFS_X -1785 mGauss and pre-arm fails with EKF3 complaining of a 148 degree yaw problem.

This is a link to a log of one of my calibration attempts out at the field - away from any potential interference. Dropbox - log_7_2022-4-13-19-26-00.bin - Simplify your life

I’ll try your suggestion of pointing the external compass backwards too and see if it helps.