GPS Parameters for EKF

I’m still working on getting the ECL EKF connected to my flight controller project. It’s pretty close - pitch, roll, yaw, and altitude estimation work - but I’m not getting good results for position or horizontal velocity. I’m sure that’s down to my inputs and parameters. Could someone help me with these questions? Thanks! Also, is this the first project outside of PX4 to use the ECL?

EPH / EPV / SACC GPS Parameters

What are typical values for these? Do they have a large effect on position and velocity estimates? Are they derived from GPS data, or are they parameters of the GPS itself? I’m using an M8N GPS.

Position reference

The EKF outputs position in meters, relative - I think? - to the position supplied right before params->gps_pos_body.setZero(); is called. Is this correct? And the input is in degrees lat/lon multiplied by 1e7.

Horizontal Velocity estimation

I’m noticing that the velocity and position estimates really want to track the GPS position. Especially if I test indoors with working-but-marginal GPS reception, I notice that I can move in some direction and I’ll see the position update instantly (presumably based mainly on the IMU data), but that almost immediately it jumps back to the GPS position, which isn’t moving as quickly or accurately. Is this expected behavior? Are there parameters I should adjust to tell the system how much to trust the GPS versus inertial data?

Sorry for all the questions, but I’m excited to get the EKF working after a ton of integration work!

Edit: I’m not sure if the GPS parameters are the problem anymore, because it looks like something is backwards with my inertial velocity. In the attached chart, you can see that when I move N/E/S/W, the initial EKF output says that I’m moving in the opposite direction. Then I assume it corrects itself based on the GPS.

Edit 2: I fixed the reversal thing. I had some acc and gyro inputs backwards. Now I think I’m nearly working, but I’m still having a problem with overshoot. Also, I’d still love to hear about those parameters and position reference topics I mentioned initially.

@Paul_Riseborough since you’re the author of the ECL, any thoughts?

Ok, last post of the day. Here’s as far as I’ve gotten. There’s definitely a bounceback problem in the north and east velocity estimates (lines 2 and 4). The GPS output (lines 1 and 3) is a pretty good description of what’s actually going on (for this test I’m holding the drone on the ground, and making sudden movements in the cardinal directions).

Finally, in case it helps, here’s how I’m populating the GPS data. The source data are in single-precision feet and double-precision degrees when applicable. HDOP and VDOP come straight off of the GPS and aren’t modified.