Is a magnetometer always required to initalize EKF even with vision measurments?

Hi

I’ve been trying to use an external vision source for yaw fusion using the following parameters:

EKF2_AID_MASK = 16 (EV yaw fusion only)
MAG_TYPE = None

I have been playing with the parameter SYS_HAS_MAG = 0

If SYS_HAS_MAG is set to 0 then the EKF doesn’t seem to start, and instead gets stuck in a loop trying to sum the nonexistent mag data in, if I change the parameter to 1 and then back to 0, the filter is able to initalize and I can fly just fine with my external vision being used for yaw.

I have also tried disabling the individual mag sensors and CAL_MAG0_ID with the same result, disabling both magnetometers (I am using the SITL for now) results in filter failing to initialize.

I don’t want to use the compass at all on my drone, however this doesn’t appear to be possible.

Is my only option to implement some ‘fake compass’, which will publish some value to allow the filter to start?

I have seen a couple of other posts on the topic which appear to directly contradict each other.

This indicates that as of 1.9 the EKF will work without mag, however a more recent post

This post that’s still not the case, as he implemented a fake magnetometer driver.

If I ensure that MAG_TYPE = None, can I be sure that no magnetometer fusion is occurring even though a mag is seemingly required to start the EKF?

I am using the latest stable release, which I believe is 1.11.

Thanks for any help

For anyone who finds this- I can confirm that yes, as of 1.11 magnetometer and barometer are required to initialize the filter even if they’re not actually set to be used with EKF2_AID_MASK and MAG_TYPE- they still need to be enabled at boot!

Correct, as per the discussion on slack related to Crazyfly optical flow flight: https://px4.slack.com/archives/C0V533X4N/p1610307160344400

@Paul_Riseborough experimented and shared an unsupported draft branch that at the time allowed him to fly without a valid mag: https://github.com/PX4/PX4-ECL/compare/master...priseborough:noMagOptFlowBugFix-wip2

Since there seems to be some interest it would be nice if someone could take that up and do further testing and development for the particular use case.