From c91b1151f9fba5555be1cbe25f408d97b3aa0276 Mon Sep 17 00:00:00 2001 From: siebc <226531417+siebc@users.noreply.github.com> Date: Tue, 7 Jul 2026 12:22:56 +0000 Subject: [PATCH] fix: gate PVT satellites on decoding completeness MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Pair GNSSDecoder's newly exported is_decoding_completed_for_positioning with the existing is_sat_healthy check in calc_pvt. A satellite now enters the solve only once its decoder has recovered the full navigation data set a fix needs (TOW, ephemeris, SV clock polynomial, …) and promoted raw_data to data. Checking completeness first guarantees the broadcast health bit is already decoded, so the two predicates compose without a separate nothing guard. Requires the export, so bump the GNSSDecoder compat to 3.7. Co-Authored-By: Claude Opus 4.8 (1M context) --- Project.toml | 2 +- src/PositionVelocityTime.jl | 7 ++++++- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/Project.toml b/Project.toml index dd69408..3e76187 100755 --- a/Project.toml +++ b/Project.toml @@ -33,7 +33,7 @@ Dates = "1" Dictionaries = "0.4" DocStringExtensions = "0.6, 0.7, 0.8, 0.9" Downloads = "1" -GNSSDecoder = "3.6" +GNSSDecoder = "3.7" GNSSSignals = "3.3" Geodesy = "0.5, 1.0" LinearAlgebra = "1" diff --git a/src/PositionVelocityTime.jl b/src/PositionVelocityTime.jl index c0f1ef9..aede5b6 100755 --- a/src/PositionVelocityTime.jl +++ b/src/PositionVelocityTime.jl @@ -552,7 +552,12 @@ function calc_pvt( ) length(states) < 4 && throw(ArgumentError("You'll need at least 4 satellites to calculate PVT")) - healthy_indices = findall(x -> is_sat_healthy(x.decoder), states) + # Keep a satellite only if its full nav-data set is decoded and it reports healthy. + # Checking completeness first guarantees the health bit has been decoded. + healthy_indices = findall( + x -> is_decoding_completed_for_positioning(x.decoder) && is_sat_healthy(x.decoder), + states, + ) length(healthy_indices) < 4 && return prev_pvt healthy_states = view(states, healthy_indices) num_sats = length(healthy_states)