API Reference
Types
PositionVelocityTime.SatelliteState — Type
SatelliteState{CP<:Real}Combines the GNSS decoder state with code and carrier phase measurements for a single satellite.
Fields
decoder::GNSSDecoderState: GNSS decoder state containing decoded navigation datasystem::AbstractGNSS: GNSS system (e.g.,GPSL1(),GalileoE1B())code_phase::CP: Code phase measurementcarrier_doppler: Carrier Doppler frequency in Hzcarrier_phase::CP: Carrier phase measurement (default:0.0)
Constructors
SatelliteState(; decoder, system, code_phase, carrier_doppler, carrier_phase=0.0)
SatelliteState(decoder, system, sat_state::SatState)The second constructor extracts code phase, carrier Doppler, and carrier phase from a Tracking.SatState.
PositionVelocityTime.PVTSolution — Type
PVTSolutionComplete Position, Velocity, and Time solution from GNSS measurements.
Fields
position::ECEF: User position in ECEF coordinates (meters)velocity::ECEF: User velocity in ECEF coordinates (m/s)time_correction::Float64: Estimated receiver clock bias (meters)time::Union{TAIEpoch{Float64}, Nothing}: Estimated time as a TAI epochrelative_clock_drift::Float64: Relative receiver clock drift (dimensionless)dop::Union{DOP, Nothing}: Dilution of precision valuessats::Dict{Int, SatInfo}: Dictionary mapping PRN to satellite info (position and time)
PVT Computation
PositionVelocityTime.calc_pvt — Function
calc_pvt(states::AbstractVector{<:SatelliteState}, prev_pvt::PVTSolution=PVTSolution()) -> PVTSolutionCalculate Position, Velocity, and Time (PVT) from GNSS satellite measurements.
Requires at least 4 healthy satellites from the same GNSS system. Uses least-squares estimation for position and time, and solves for velocity and clock drift from carrier Doppler measurements.
Arguments
states: Vector ofSatelliteStatefor observed satellitesprev_pvt: Previous PVT solution used as initial guess (default: origin)
Returns
A PVTSolution containing position, velocity, time, DOP values, and satellite information. Returns prev_pvt if fewer than 4 healthy satellites are available or if the GDOP is negative.
Throws
ArgumentError: If fewer than 4 satellite states are provided
Position and Velocity
PositionVelocityTime.get_LLA — Function
get_LLA(pvt::PVTSolution) -> LLAConvert the ECEF position in the PVT solution to geodetic coordinates (latitude, longitude, altitude) using the WGS84 ellipsoid.
PositionVelocityTime.calc_satellite_position — Function
calc_satellite_position(decoder::GNSSDecoder.GNSSDecoderState, t)
calc_satellite_position(state::SatelliteState)Calculate the satellite ECEF position from orbital parameters at time t.
The first method takes a decoder state and explicit time. The second method computes the corrected transmission time from the SatelliteState automatically.
Arguments
decoder: GNSS decoder state containing ephemeris datat: Transmission time in system time (seconds)state: ASatelliteStatecombining decoder, system, and phase measurements
Returns
An SVector{3, Float64} with the satellite position in ECEF coordinates (meters).
PositionVelocityTime.calc_satellite_position_and_velocity — Function
calc_satellite_position_and_velocity(decoder::GNSSDecoder.GNSSDecoderState, t)
calc_satellite_position_and_velocity(state::SatelliteState)Calculate the satellite ECEF position and velocity from orbital parameters at time t.
Uses Keplerian orbital mechanics with perturbation corrections (harmonic corrections for argument of latitude, radius, and inclination) to propagate the satellite ephemeris.
Arguments
decoder: GNSS decoder state containing ephemeris datat: Transmission time in system time (seconds)state: ASatelliteStatecombining decoder, system, and phase measurements
Returns
A named tuple (position, velocity) where each is an SVector{3, Float64} in ECEF coordinates (meters and m/s respectively).
PositionVelocityTime.get_sat_enu — Function
get_sat_enu(user_pos_ecef::ECEF, sat_pos_ecef::ECEF) -> SphericalConvert satellite position to East-North-Up (ENU) spherical coordinates (azimuth and elevation) relative to the user position.
Arguments
user_pos_ecef::ECEF: User position in ECEF coordinatessat_pos_ecef::ECEF: Satellite position in ECEF coordinates
Returns
Spherical coordinates containing azimuth and elevation of the satellite as seen from the user position.
Dilution of Precision
PositionVelocityTime.get_gdop — Function
get_gdop(pvt_sol::PVTSolution) -> Float64Return the Geometric Dilution of Precision (GDOP) from the PVT solution.
PositionVelocityTime.get_pdop — Function
get_pdop(pvt_sol::PVTSolution) -> Float64Return the Position Dilution of Precision (PDOP) from the PVT solution.
PositionVelocityTime.get_hdop — Function
get_hdop(pvt_sol::PVTSolution) -> Float64Return the Horizontal Dilution of Precision (HDOP) from the PVT solution.
PositionVelocityTime.get_vdop — Function
get_vdop(pvt_sol::PVTSolution) -> Float64Return the Vertical Dilution of Precision (VDOP) from the PVT solution.
PositionVelocityTime.get_tdop — Function
get_tdop(pvt_sol::PVTSolution) -> Float64Return the Time Dilution of Precision (TDOP) from the PVT solution.
Utilities
PositionVelocityTime.get_num_used_sats — Function
get_num_used_sats(pvt_solution::PVTSolution) -> IntReturn the number of satellites used in the PVT solution.
PositionVelocityTime.get_frequency_offset — Function
get_frequency_offset(pvt::PVTSolution, base_frequency) -> typeof(base_frequency)Calculate the receiver frequency offset from the relative clock drift and a base frequency.
Arguments
pvt::PVTSolution: PVT solution containing the relative clock driftbase_frequency: Reference frequency (e.g., the carrier frequency of the GNSS signal)
Returns
The frequency offset as relative_clock_drift * base_frequency.