Skip to content

Same-GNSS guard in calc_pvt never throws (missing throw) #39

Description

@zsoerenm

Description

The guard in calc_pvt that is meant to reject mixed-constellation input never actually rejects anything — the ArgumentError is constructed but never thrown:

https://github.com/JuliaGNSS/PositionVelocityTime.jl/blob/master/src/PositionVelocityTime.jl#L238-L239

all(state -> state.system == states[1].system, states) ||
    ArgumentError("For now all satellites need to be base on the same GNSS")

Because condition || ArgumentError(...) only creates the exception object and discards it, a vector mixing GPS and Galileo satellites passes straight through. The code then proceeds with system = first(states).system and derives the week number / system start time from first(healthy_states).decoder only, silently producing a wrong result instead of erroring.

Fix

all(state -> state.system == states[1].system, states) ||
    throw(ArgumentError("For now all satellites need to be based on the same GNSS"))

(also fixes the "base" → "based" typo in the message).

Context

This is a pre-existing bug, surfaced while reviewing #38. That PR's constellation-wide ionospheric model selection assumes a single GNSS per solve, so enforcing this invariant becomes more relevant.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions