Class GNSSMeasurements

Class Documentation

class GNSSMeasurements

Public Types

using VectorProvider = std::function<Vec3(Real)>
using CustomIonospherePlasmaDelayModel = std::function<Real(Real, const Vec3&, const Vec3&, GnssFreq)>
using BatchCustomIonospherePlasmaDelayModel = std::function<std::vector<std::vector<Real>>(const std::vector<Real>&, const std::vector<State>&, const std::vector<std::vector<GnssChannel>>&)>

Public Functions

GNSSMeasurements() = default
explicit GNSSMeasurements(Ptr<GnssConstellation> constellation)

Construct with a single GNSS constellation on L1 (convenience overload).

void AddConstellation(Ptr<GnssConstellation> constellation, GnssFreq frequency)

Add a constellation/frequency pair to process in BuildChannels().

Channels from all added (constellation, frequency) pairs are concatenated.

inline void SetConstellation(Ptr<GnssConstellation> constellation)

Replace the first (or only) constellation; clears all others.

inline Ptr<GnssConstellation> GetConstellation() const

Get the first constellation (backward-compat accessor).

inline void SetFrequency(GnssFreq frequency)

Set the frequency for all current constellations (and as default for future ones).

inline GnssFreq GetFrequency() const

Get the frequency of the first constellation (backward-compat accessor).

inline void SetOptions(const GnssMeasurementOptions &options)

Replace the measurement options (observable selection, state layout, light-time/relativity/Shapiro/plasma settings, etc.) used by BuildChannels()/Compute().

inline const GnssMeasurementOptions &GetOptions() const

Get the measurement options currently in use.

inline void SetSunPositionProvider(VectorProvider provider)

Set the callback used by SunPosition() to get the Sun’s position at a given epoch (used for Shapiro delay and GNSS transmitter attitude/antenna-gain computations).

If unset, SunPosition() falls back to a fixed (0, AU, 0) placeholder.

inline void SetBoresightTargetProvider(VectorProvider provider)

Set the callback used by BoresightTarget() to get the receiver’s nadir/boresight-pointing target position (e.g. the Moon or Earth center), used by ComputeCN0() to evaluate the receiver antenna’s off-boresight angle to the transmitter.

inline void SetOccludingBodies(const std::vector<GnssOccludingBody> &bodies)

Set the spherical bodies (e.g. the Moon or Earth) checked for line-of-sight occlusion by BuildChannels() when options.apply_visibility is true (via ComputeVisibility()).

inline void SetReceiverParams(const GnssReceiverParams &params)

Set the receiver tracking-loop parameters (DLL/PLL/FLL bandwidths, integration time, etc.) used by ComputeSigmaRange(), ComputeSigmaRangeRate(), and ComputeSigmaCarrierPhase() to derive per-channel measurement noise sigmas from CN0.

inline void SetReceiverAntenna(const Antenna &antenna)

Set the receiver antenna gain pattern used by ComputeCN0() to evaluate G_rx in the link budget.

inline void SetCN0Threshold(Real cn0_threshold_dbhz)

Set the CN0 threshold [dB-Hz] below which a channel is dropped by BuildChannels() when options.apply_cn0_threshold is true. Sets both acquisition and tracking thresholds to the same value.

inline void ResetTracking()

Reset the internal tracking state, forcing all satellites to re-acquire at the acquisition threshold on the next BuildChannels() call.

inline void SetCustomIonospherePlasmaDelayModel(CustomIonospherePlasmaDelayModel model)

Set a custom per-channel ionosphere/plasma delay model, overriding the ray-trace and default-constant delay options.

If set, ComputeIonospherePlasmaDelay() calls this model instead of using ionosphere_plasma_raytrace_options_ or options_.default_ionosphere_plasma_delay_m, taking the receive time and receiver/transmitter ECI positions and returning the (dispersive) delay for a given GNSS frequency.

inline void SetBatchCustomIonospherePlasmaDelayModel(BatchCustomIonospherePlasmaDelayModel model)

Set a custom batch ionosphere/plasma delay model evaluated once per epoch for all channels, used by Precompute() instead of per-channel calls to ComputeIonospherePlasmaDelay() when options.apply_ionosphere_plasma_delay is true.

inline void SetIonospherePlasmaDelayProvider(CustomIonospherePlasmaDelayModel provider)

Deprecated alias for SetCustomIonospherePlasmaDelayModel().

inline void SetBatchIonospherePlasmaDelayProvider(BatchCustomIonospherePlasmaDelayModel provider)

Deprecated alias for SetBatchCustomIonospherePlasmaDelayModel().

inline void SetIonospherePlasmaRayTraceOptions(const GnssIonospherePlasmaRayTraceOptions &options)

Configure ray-traced ionosphere/plasma delay computation (used by ComputeIonospherePlasmaRayTraceDelay() via ComputeIonospherePlasmaDelay()) when no custom model is set.

inline void ClearIonospherePlasmaRayTraceOptions()

Disable ray-traced ionosphere/plasma delay computation, reverting ComputeIonospherePlasmaDelay() to the custom model (if any) or options_.default_ionosphere_plasma_delay_m.

std::vector<GnssChannel> BuildChannels(Real receive_time, const State &user_state) const

Build the set of visible, above-CN0-threshold GNSS channels for every PRN in the constellation at a receiver epoch/state.

This is the main entry point used by Compute()/Precompute() (and, via GnssMeasurement::Precompute, by truth/filter pipelines) to turn a receiver state into the list of GnssChannel transmitters that should contribute measurements at this epoch: for each non-faulted PRN it resolves the light-time-corrected transmitter state (BuildChannelForPrn), applies the visibility test (ComputeVisibility), computes CN0 (ComputeCN0) and drops channels below options_.cn0_threshold_dbhz if options_.apply_cn0_threshold is set, and fills in the per-channel measurement-noise sigmas.

Parameters:
  • receive_timeReceiver signal-reception epoch [s, options_.receive_time_scale]

  • user_stateReceiver state; must contain position/velocity at options_.indices.position/velocity [m, m/s] in options_.frame

Returns:

One GnssChannel per visible, sufficiently-strong transmitter

GNSSMeasurementsEpoch Compute(Real receive_time, const State &user_state, MatXd *H = nullptr) const

Build channels and compute the full GNSS measurement epoch (values, and optionally the Jacobian/covariance) for a receiver epoch/state.

This is the primary per-epoch API used by the EKF/UKF measurement update (directly or via CreateFunction()) and by GnssMeasurement::Precompute: it calls BuildChannels() to get the visible transmitters, then ComputeFromChannels() to evaluate each channel’s pseudorange/Doppler/carrier-phase observables.

Parameters:
  • receive_timeReceiver signal-reception epoch [s, options_.receive_time_scale]

  • user_stateReceiver state, as in BuildChannels()

  • H[out] If non-null, filled with the stacked measurement Jacobian (same as epoch.jacobian)

Returns:

GNSSMeasurementsEpoch containing the built channels, stacked measurement vector, Jacobian, and diagonal covariance

std::vector<GNSSMeasurementsEpoch> Precompute(const std::vector<Real> &receive_times, const std::vector<State> &user_states, bool compute_jacobians = false)

Compute and cache a GNSSMeasurementsEpoch for each of a series of receiver epochs/states.

Used to generate a full simulation-length sequence of GNSS measurement epochs (e.g. for truth-data generation ahead of a filter run). If options_.apply_ionosphere_plasma_delay is set and a batch custom ionosphere/plasma delay model has been installed (SetBatchCustomIonospherePlasmaDelayModel), channels for all epochs are built first (without per-channel delays), the batch model is evaluated once for all epochs/channels, and the resulting delays are applied before computing each epoch’s measurement values; otherwise each epoch is computed independently via Compute(). Results are also stored in precomputed_ (see GetPrecomputed()).

Parameters:
  • receive_timesReceiver signal-reception epochs [s, options_.receive_time_scale]

  • user_statesReceiver states, one-to-one with receive_times

  • compute_jacobians – If true, also compute and store each epoch’s measurement Jacobian

Returns:

One GNSSMeasurementsEpoch per receive_times entry

inline const std::vector<GNSSMeasurementsEpoch> &GetPrecomputed() const

Get the measurement epochs computed by the most recent Precompute() call.

FilterMeasurementFunction CreateFunction(Real t) const

Build a FilterMeasurementFunction that calls Compute() at a fixed receive time t.

The returned closure captures a copy of this GNSSMeasurements (constellation, options, antennas, providers, etc.) and is suitable for direct use as a filter’s measurement model at epoch t, returning the stacked measurement vector and (if requested) Jacobian/covariance for all visible channels.

Parameters:

tReceiver signal-reception epoch [s, options_.receive_time_scale]

Returns:

Function (x, H, R) -> y computing the full GNSS measurement epoch at t for receiver state x