LPE vs EKF2 position control with only GPS

Hello all

This is a position control effort with EKF2 with current stable

This is a position control effort with LPE with current stable

Has anyone got an idea why local position x and y differ this much? I haven’t seen a weird behaviour like this on local position x and y before with LPE.

@Paul_Riseborough @jgoppert @LorenzMeier any thoughts here?

The local coordinate reference latitude/longitude is incorrectly set to Zurich. This is set as default for flights where GPS is not used. Somehow this logic was reached:

So somehow you got a valid xy positoin without the map ref being initialized. GPS intializes the map ref here:

This is what it takes for validXY to be true:

So you must have initialized flow, vision, or mocap before GPS which if you are going to do that you need to set LPE_LAT, LPE_LON to the correct values before takeoff.

@jgoppert I didn’t actually use anything but GPS on these tests, but there is a strange behaviour when I use LPE, the map starts at Zurich and very rapidly converges to my current position. Sometimes it starts at Zurich and doesn’t converge, but the copter acts as if it was really in Zurich and when I fly it thinks that it flies around eth zurich :smiley: . Its really strange and I couldn’t debug. The exact same thing you’ve described is happening.

There must be some bug that we didn’t catch in the release that you are running into as a result of your particular setup. We recently added LPE_FAKE_ORIGIN (1 enable fake initialization at LPE_LAT, LPE_LON, 0 disable it). So whatever is happening with your system, this would probably resolve it.