my team and I are currently building a drone, but we have issues with the compass. It seems that the current which goes to the motors is so strong that it influences the internal magnetometer quite significantly. Hence, we installed the GPS module with a magnetometer installed as far away as possible from the power lines. Our problem is that px4 seems not to select the magnetometer from the external GPS module, although we gave it a high priority.
In the debug process, we came along the EKF module. It seems that the EKF module is used to determine the heading of the aircraft (but I’m not 100% sure about this). The problem is that the EKF instances are chosen according to a best error term, where the magnetometer seems not to be taken into account.
My question is at first how the heading is determined by px4 in detail and why the CAL_MAG_PRIO parameter seems to have no influence at all.