Checking EKF2 Consistency via Log Files
It's important to make sure that EKF2 estimator provides accurate enough estimates of the states for your flight controller to perform well. A quick way to debug that is through the log files.
The default log file format in PX4 is Ulog. Usually, the default setting, is that the logs start after arming the vehicle and stopped after disarm.
- Use QGC to download a Ulog file you wish to analyze
- Download the FlightPlot software to open your logs.
- Plot the fields
ekf2_innovations_0.vel_pos_innov[3]
,ekf2_innovations_0.vel_pos_innov[4]
,ekf2_innovations_0.vel_pos_innov[5]
Those are the innovations on the x/y/z position estimates reported by the EKF2. They should very small values, (ideally zero!), see the picture below for reasonable values. If those values are large, then EKF2 is not providing accurate estimation. This is most likely because of the inconsistency of timestamps of the fused measurements. For that, you will need to start adjusting theEKF2_<sensor>_DELAY
paramters that affect the position estimates. For example, if you are using mocap, then you will need to adjustEKF2_EV_DELAY
. It should be decreased if you are feeding mocap data at high rate.