[pixhawk] orientation estimation is wrong

Situation: new pixhawk 2.4.8 with px4 v13.0 stable written. QGC v4.2.1
Symptom: Yaw angle estimation is wrong.
Details: Regarding the compass display in the upper right corner of QGC, the following display is seen.

  • It is supposed to be pointing north, but it shows that it is pointing in a completely different direction, such as east or south.
  • The compass display keeps rotating even though the board is not moving.
  • When the aircraft is rotated, the compass also rotates at that moment, but after the rotation is stopped, the compass display starts to rotate in the opposite direction.

I would like to know if anyone is experiencing the same symptoms or knows how to solve this problem.

Did you calibrate the compass?
Is there any metal on the drone or near where you are testing it?
What compass model are you using?

Yes I calibrated very carefully.
There was no metal which disturbs the magnetometer near the drone.
Im using the internal magentometer in the Pixhawk2.4.8.

I changed the MAG0 of ROTATION_NONE to ROTATION_PITCH_180 in the sensor calibration tab of QGC and the problem was completely resolved.
Please refer to this if you have faced a similar problem (it took me two months to deal with this problem…)
Does this mean that the orientation of the magnetometer inside pixhawk as assumed by the firmware was different from the actual orientation of the magnetometer as implemented?