feat(gps): add timer-based assisted reacquisition

Remove the fixed pseudorange start offset, preserve per-PRN navigation assistance across RF loss and power cycles, and seed coherent navigation measurement phase on reacquisition. Add full LNAV almanac visibility scheduling, power-safe QSPI journaling, RF-domain reset isolation, and PPS Gray CDC hardening with Linux, sanitizer, RTL, and end-to-end coverage.
This commit is contained in:
onur
2026-08-04 02:52:35 +03:00
parent 347e1c671d
commit 30179df8e6
69 changed files with 6162 additions and 247 deletions
+10 -8
View File
@@ -5,7 +5,8 @@ mirrors the conventions used by gps_system/src/gps_ip.c and NavEquations.c:
* corrected_abs = raw_abs - rem_code_phase / CODE_FREQ_BASIS
* modulo-32 ABS_SAMPLE values are unwrapped around the newest channel
* obs_i = c * ((abs_i - min(abs)) / SAMPLES_PER_CODE + STARTOFFSET) / 1000
* obs_i/c = (corrected_abs_i - corrected_abs_ref) / RF_HZ
- (transmit_i - transmit_ref)
* satellite clock correction is added to the observation
* [x, y, z, common_bias_m] are solved together with URA/elevation weights
@@ -27,8 +28,6 @@ RF_HZ = 16_367_981.0
TRACKING_HZ = 125_000_000.0
SAMPLES_PER_CODE = 16_367.981 # physical RF samples/ms used by the C code
CODE_FREQ_BASIS = 1.023e6
START_OFFSET_MS = 68.802
START_OFFSET_S = START_OFFSET_MS / 1000.0
NAV_SOLVE_PERIOD_S = 10 * 0.020
POSTPONE_TOW_S = 0.180
OMEGA_EARTH = 7.2921151467e-5
@@ -680,10 +679,14 @@ class ReceiverEpochSimulator:
corrected_abs = np.asarray(
[measurement.corrected_abs_unwrapped for measurement in measurements]
)
ps_tvl_ms = corrected_abs / SAMPLES_PER_CODE
reference_index = int(np.argmin(ps_tvl_ms))
precise_tx_ms = ps_tvl_ms - ps_tvl_ms[reference_index] + START_OFFSET_MS
observations_m = precise_tx_ms * (C / 1000.0)
reference_index = int(np.argmin(corrected_abs))
# All channels in this synthetic epoch share one transmit time. Mirror
# firmware's wrap-safe corrected RF-sample difference. The fractional
# code residue removes the 61 ns integer-sample quantization; the
# separately captured 125 MHz counter is used only for PPS epoch mapping.
observations_m = (
corrected_abs - corrected_abs[reference_index]
) * (C / RF_HZ)
observations_m += C * np.asarray(
[measurement.satellite_clock_s for measurement in measurements]
)
@@ -711,7 +714,6 @@ class ReceiverEpochSimulator:
gps_reference_estimate = (
self.gps_tow_start_s
+ transmit_true_s
+ START_OFFSET_S
- wls.clock_bias_m / C
)
gps_reference_true = self.gps_tow_start_s + reference.arrival_true_s