EKF2 replay matlab vs px4

I attempted to validate the EKF2 replay using MATLAB from the GitHub repository provided (PX4-ECL/EKF/matlab/EKF_replay at master · PX4/PX4-ECL · GitHub). Upon executing the ulg file obtained from a SITL in MATLAB and supplying messages such as sensor_combined, vehicle_air_data, vehicle_magnetometer, and vehicle_gps_position, and configuring the parameters as instructed in MATLAB, mirroring those of the original mission, I executed the RunFilter.m function. Then, I plotted the x-NED coordinates derived from the output of the RunFilter function against the x-NED coordinate message vehicle_local_position. However, I observed that the outcomes were markedly dissimilar.

So, why does MATLAB fail to accurately compute the replay, and what distinguishes it from the calculation performed in the PX4 ekf2 replay?

The sensor data and local position data vs MATLAB replay data can be found in EKF2_Replay - Google Drive

the full log file can be found in: https://review.px4.io/plot_app?log=0c3ad6f8-6791-4bbb-96d1-bf040e6eab4b

I think it’s just because the Matlab replay is not well maintained as the px4 replay that’s why they gave different results, even the timestamps to publish the topics are different so the logic behind the two seems different, maybe @Paul_Riseborough can help since he’s the one in charge of EKF and estimation system

@JulianOes Do you think it’s because the matlab EKF doesn’t give the same results because it not as maintained as the PX4-Autopilot repository or there is a possible another reason?

That old Matlab EKF is now quite different from what’s implemented in PX4’s EKF2. If you want to replay ulog files, please use System-wide Replay | PX4 Guide (main)

Thank you. To understand the EKF2 replay in MATLAB is there a documentations or someway to understand the order of scripts to go through or the sole possibility is going on an arbitrary journey?

I’ve never seen a documentation. Again, you’ll be on you own here, the last update of these files was about 5 years ago and the ECL repo is now archived as we stopped using it 3 years ago. Since then, the development happens in PX4-Autopilot/src/modules/ekf2 at main · PX4/PX4-Autopilot · GitHub

Apologies for any confusion. I’m wondering if there’s a clear sequence of scripts to follow in order to grasp the estimation system, particularly EKF and EKF2 replay in PX4. For instance, in the provided link, there are scripts like ekf.cpp and EKF2.cpp.

Additionally, I’ve noticed that in PX4 documentation, it references both EKF and estimator interchangeably. Moreover, in the published uORB topics, some are attributed to EKF2 while others to estimator. Could “estimator” possibly refer to the output predictor?