Hi Paul,
I've been looking a bit more at the EKF failure logs I showed you
yesterday:
http://uav.tridgell.net/Paul/EKF-fail-2014-12-07/
one of the main issues was the bug that was introduced with the optflow
merge, which has since been fixed:
https://github.com/diydrones/ardupilot/commit/cb9c518ab8f53d658438c3ef8edabdcb8ab2ecbc
but there are other issues that these logs show. I've added some new
features to Replay to help track those down, so I thought I'd send this
to the list so other developers could see the new debugging techniques.
The Replay tool now generates DF logs, as well as consuming them. So you
can run Replay over a log with different EKF or AHRS parameters and see
the resulting flight track. This allows you to use tools like
mavflightview.py to see what impact changing the EKF parameters has.
For example:
cd Tools/Replay
rm -rf logs
make linux -j8
./Replay.elf -- 2014-12-07/107.BIN -pEKF_VEL_GATE=6
mavflightview.py --ekf --ekf-sample=10 logs/1.BIN
what that does is:
1) remove the old logs directory, so the log generates as logs/1.BIN
every time (useful for fast re-graphing)
2) builds the Replay tool
3) runs Replay on the 107.BIN log with EKF_VEL_GATE=6
4) views the resulting DF log, showing the EKF and GPS track, but only
showing every 10th EKF point (to keep the UI fast, as otherwise
there are a huge number of points on the map)
now to look at some results. First here is the output using current
master on the 107.BIN logfile:
http://uav.tridgell.net/Paul/EKF-fail-2014-12-07/107_original.png
you can see that the GPS track (darker orange) and EKF track diverge for
quite a long time.
Now let's run the same log with a larger EKF_VEL_GATE:
http://uav.tridgell.net/Paul/EKF-fail-2014-12-07/107_vel_gate_12.png
so a EKF_VEL_GATE=12 does result in much better tracking. I'm not sure
it is the right approach though. Looking more closely at this log you
can see that it gets a gps velocity timeout. That timeout is 20 seconds,
which is an awfully long time for a fixed wing plane with high vibration
to not be using the GPS velocity. Lowering the _gpsRetryTimeUseTAS from
20000 (20 seconds) to 2000 (2 seconds) while leaving EKF_VEL_GATE=6
gives this:
http://uav.tridgell.net/Paul/EKF-fail-2014-12-07/107_gps_retry_2000.png
I suspect that 20s is just far too long to be trying to dead-reckon the
velocity on a plane with this much vibration without using the GPS.
The same thing happens with log 109:
http://uav.tridgell.net/Paul/EKF-fail-2014-12-07/109_original.png
in that log you can see that the EKF really mucks up the track on
landing. The plane was under DCM control, and did a very nice auto-land
on the runway. The EKF had the plane going over the road.
If we change the gps_retry time to 2000 then it gets this:
http://uav.tridgell.net/Paul/EKF-fail-2014-12-07/109_gps_retry_2000.png
which is much more accurate.
So do we have the GPS retry time set at the right level for fixed wing?
Or is there something else causing this?
Cheers, Tridge