Problem with global position estimation

Hi! I have a VTOL (15kg) ,and i try to optimize it,but i can’t solve is: narrow interior space, so it has problems with high temperature and unreasonable wiring (main power wires close to GNSS and compass modules)
I’ve had a few successful and stable flights before this time (with the occasional airspeed sensor failure, I think because the airspeed sensor is too close to the multi-rotor prop), but this time I’ve had a strange problem:
After the front transition timed out (the reason was that I lowered VT_F_TRANS_THR), I switched to manual mode, tried the front transition again, switched to LOITER mode, and then switched to MISSION mode,after few seconds, the aircraft rolled over and automatically switched to MC, the QGC message shows:

[commander] Stopping compass use! Check calibration on landing
[commander] Failsafe enabled: no global position

Because the battery capacity of the multi-rotor is small, I use manual control to land it at the current position


I’m sure I’m using a good GNSS module (M9N) and IMU (CUAV_X7Pro), but I installed it inside a narrow vehicle, could that be the cause of this problem?
Other than that, what else could cause such a failure?

I would really appreciate someone answering my question

The magnetometer is probably too close to the power cables. As you can see in this plot, there is a strong correlation between the mag field norm and the throttle values. The mag field norm should be constant (at around 0.4Gs) during the whole flight.


Thank you for your answer, now I understand that global position fusion is related to yaw, and i will do some electromagnetic shielding solutions

as you said,Wiring and shielding are important