Assistance Needed: GPS relaying to Cube Orange

Hi everyone,
We’ve been tackling a challenging issue and are seeking assistance from the community. Our project revolves around solving a vision-aided positioning problem for non-GPS navigation. We’ve made significant progress on the vision component, successfully extracting (longitude, latitude) coordinates from camera frames matched with a reference map. Now, our aim is to replace the conventional GPS receiver with our vision system.
Initially, we’re attempting to relay real GPS messages from a Ublox M8N device to the Cube Orange through the GPS1 port. If this integration works smoothly, we plan to gradually transition to using vision-derived coordinates.
However, we’ve encountered a hurdle in our efforts. While the quadcopter remains stationary on the ground, the Cube Orange reliably receives GPS coordinates, allowing us to arm it in Loiter mode without issues. However, during flight, after a short duration, we experience GPS glitches, resulting in a drone crash.
We’re eager to share both the BIN log file and our Python code for relaying GPS data to the Cube. We’re hopeful that by collaborating with the community, we can pinpoint the missing piece of the puzzle.
https://drive.google.com/file/d/1jv5feZ3QlGBvZiqmYxzrl_DxjlTR9WR6/view?usp=sharing
https://drive.google.com/file/d/1kflvq2FVsqsgb9-epLiL16MAmT06NKF1/view?usp=sharing
https://drive.google.com/file/d/19YzYGodKPNwJZvw3oO_yn-NmJXlWxm1m/view?usp=sharing

Your support and insights would be immensely appreciated, and we’ll be sure to keep you updated on our progress.
Thank you in advance!
Pls see the analyzed log below:
Log File C:\Users\Admin\AppData\Local\Temp\tmp1A20.tmp.log
Size (kb) 3894.7041015625
No of lines 45503
Duration 0:01:18
Vehicletype ArduCopter
Firmware Version V4.3.2
Firmware Hash fcef79e7
Hardware Type
Free Mem 0
Skipped Lines 0
Test: Autotune = UNKNOWN - No ATUN log data
Test: Brownout = GOOD -
Test: Compass = FAIL - FAIL: Large compass offset params (X:406.15, Y:-321.06, Z:234.17)
FAIL: Large compass offset in MAG data (X:406.00, Y:-321.00, Z:234.00)
Large change in mag_field (130.85%)
Max mag field length (595.66) > recommended (550.00)
Test: Dupe Log Data = GOOD -
Test: Empty = GOOD -
Test: Event/Failsafe = FAIL - ERR found: CRASH
Test: GPS = GOOD -
Test: IMU Mismatch = NA -
Test: Motor Balance = UNKNOWN - ‘OCTAQUAD/H’
Test: NaNs = FAIL - Found NaN in CTUN.DSAlt
Test: OpticalFlow = FAIL - ‘FLOW_FXSCALER’ not found
Test: Parameters = FAIL - ‘MAG_ENABLE’ not found
Test: PM = UNKNOWN - ‘NLoop’
Test: Pitch/Roll = UNKNOWN - ‘BarAlt’
Test: Thrust = GOOD -
Test: VCC = UNKNOWN - No CURR log data