EKF2 tuning for MOCAP tracking

I am trying to fly a quadcopter autonomously using MOCAP measurements. So far, it seems PX4 is receiving these measurements correctly. However, when I fly this manually in ALTITUDE HOLD mode (which works reliably since the Z local position tracks the Z MOCAP position well) the X and Y local position either drift or seem to lag behind the MOCAP measurements, as shown in the figures below.

I am currently using EKF2 and the MOCAP measurements have a transmission rate of approximately 100 Hz. I’ve tried tuning the EKF2 parameters and have had small improvements. I have also made the changes illustrated in the following link, which supposedly fix some syncing issues:

Could someone suggest what I should do next to improve the EKF2 estimates tracking of the MOCAP measurements? I am also attaching a pdf showing the parameters I had in my last flight. Thank you in advance!

paramsQC_MOCAP.pdf (49.3 KB)

Hello, how u solved this problem? my ekf2 has large drift in x and y position too, but good orientation estimation

My issue was a coordinate axis issue. I was feeding the MOCAP data incorrectly (X axis to -Y axis and Y axis to X axis). Once I solved this, the drift disappeared.

If you want to tune how close the estimates follow the measurements, you can tune the EKF2_ACC_NOISE and EKF2_GYR_NOISE to see if you can get better estimates. Increasing this values should help.

1 Like