Debugging EKF2 With MoCap Data

I’m trying to achieve a stable position hold in a small motion capture arena. I’m using ROS kinetic and an Odroid xu4 to stream Optitrack Mocap data to a pixhawk 2 with px4 1.8. I can pick up the drone with my hands and move it around the arena and changes in position and angle match the data from mocap. If I do a very short and simple flight (takeoff to .5m then land again within a few seconds), I have no problems. However, any flights longer than about 30 seconds start to experience drift and I must land or hit kill switch. I’ve read through all the EKF2 documentation and forum entries, but I haven’t taken a non-linear controls class yet, so some parts of the algorithm are admittedly over my head right now.

From ekf2_innovations and estimator_status logs, it’s clear ekf2 failure is due to horizontal position drift. I’ve read this could be due to gyroscope and/or magnetometer misalignment. I have calibrated sensors many times, but I have not tried changing EKF2 gains. Much appreciated if anyone has advice or experience with this issue. Please let me know if I should provide other information or format differently. Thank you in advance for any suggestions!Flight Review - Quadrotor.pdf (1.1 MB)
log_11_2018-7-24-12-34-36.ulg.pdf (97.6 KB)