gnss_rtk/
error.rs

1use thiserror::Error;
2
3use anise::{
4    almanac::{metaload::MetaAlmanacError, planetary::PlanetaryDataError},
5    errors::{AlmanacError, PhysicsError},
6};
7
8use crate::prelude::{Epoch, SV};
9
10#[derive(Debug, PartialEq, Error)]
11pub enum Error {
12    /// Not enough candidates were proposed, with respect to navigation parameters.
13    #[error("not enough candidates provided")]
14    NotEnoughCandidates,
15
16    /// Survey initialization (no apriori = internal guess)
17    /// requires at least 4 SV in sight temporarily, whatever
18    /// your navigation technique.
19    #[error("survey initialization requires at least 4 SV temporarily")]
20    NotEnoughInitializationCandidates,
21
22    /// PreFit (signal quality, other..) criterias
23    /// have been applied but we're left with not enough vehicles that match
24    /// the navigation technique: no attempt.
25    #[error("not enough candidates match pre-fit criteria")]
26    NotEnoughPreFitCandidates,
27
28    /// PostFit (state solver and other) have been resolved,
29    /// but we're left with not enough vehicles that match
30    /// the navigation technique: no attempt.
31    #[error("not enough candidates match post-fit criteria")]
32    NotEnoughPostFitCandidates,
33
34    /// Failed to parse navigation method
35    #[error("invalid navigation method")]
36    UnknownNavigationMethod,
37
38    #[error("not enough post-fit candidates to form a matrix")]
39    MatrixMinimalDimension,
40
41    #[error("internal error: invalid matrix setup")]
42    MatrixDimension,
43
44    #[error("failed to form matrix (invalid input or not enough data)")]
45    MatrixFormationError,
46
47    /// Invalid orbital states or bad signal data may cause the algebric calculations
48    /// to wind up here.
49    #[error("failed to invert matrix")]
50    MatrixInversion,
51
52    /// Invalid orbital states or bad signal data may cause the algebric calculations
53    /// to abort.
54    #[error("internal navigation error")]
55    NavigationError,
56
57    /// Failed to initialize navigation filter
58    #[error("nav filter initialization error")]
59    NavigationFilterInitError,
60
61    #[error("missing pseudo range observation")]
62    MissingPseudoRange,
63
64    /// [Method::CPP] requires the special signal combination to exist.
65    /// This require the user to sample PR on two separate frequencies.
66    #[error("failed to form pseudo range combination")]
67    PseudoRangeCombination,
68
69    /// [Method::PPP] requires the special signal combination to exist.
70    /// This require the user to sample PR + PH on two separate frequencies.
71    #[error("failed to form phase range combination")]
72    PhaseRangeCombination,
73
74    /// Each [Candidate] state needs to be resolved to contribute to any PPP resolution attempt.
75    #[error("unresolved candidate state")]
76    UnresolvedState,
77
78    /// Each [Candidate] presented to the Bancroft solver needs a resolved state.
79    #[error("bancroft requires 4 fully resolved candidates")]
80    UnresolvedStateBancroft,
81
82    /// When [Modeling.sv_clock_bias] is turned on and we attempt PPP resolution,
83    /// it is mandatory for the user to provide [ClockCorrection].
84    #[error("missing clock correction")]
85    UnknownClockCorrection,
86
87    /// Physical non sense due to bad signal data or invalid orbital state, will cause us
88    /// abort with this message.
89    #[error("physical non sense: rx prior tx")]
90    PhysicalNonSenseRxPriorTx,
91
92    /// Physical non sense due to bad signal data or invalid orbital state, will cause us
93    /// abort with this message.
94    #[error("physical non sense: t_rx is too late")]
95    PhysicalNonSenseRxTooLate,
96
97    /// Error during surveying initialization, without apriori knowledge.
98    /// The solver initialization requires a minimum of 4 SV in sight temporarily,
99    /// whatever the navigation technique being used.
100    #[error("survey initialization error: invalid input ?")]
101    BancroftError,
102
103    /// [Bancroft] initialization process (see [BancroftError]) will wind up here
104    /// in case unrealistic or bad signal observation or orbital states were forwarded.
105    #[error("bancroft solver error: invalid input (imaginary solution)")]
106    BancroftImaginarySolution,
107
108    /// Ambiguity factorization failed
109    #[error("ambiguity factorization error")]
110    AmbiguityFactorization,
111
112    /// Matrix inversion error during ambiguity solving process
113    #[error("ambiguity inverse error")]
114    AmbiguityInverse,
115
116    /// Floating Ambiguities solving issue
117    #[error("floating ambiguities solving error")]
118    FloatAmbiguitiesSolving,
119
120    /// PPP navigation technique requires phase ambiguity to be solved prior any attempt.
121    /// It is Okay to wind up here for a few iterations, until the ambiguities are fixed
122    /// and we may proceed to precise navigation. We will reject solving attempt until then.
123    /// Hardware and external events may reset the ambiguity fixes and it is okay to need to
124    /// rerun through this phase for a short period of time. Normally not too often, when good
125    /// equipment is properly operated.
126    #[error("unresolved signal ambiguity")]
127    UnresolvedAmbiguity,
128
129    /// [Solver] requires [Almanac] determination at build up and may wind-up here this step is in failure.
130    #[error("issue with Almanac: {0}")]
131    Almanac(AlmanacError),
132
133    /// [Solver] uses local [Almanac] storage for efficient deployments
134    #[error("almanac setup issue: {0}")]
135    MetaAlmanac(MetaAlmanacError),
136
137    /// [Solver] requires to determine a [Frame] from [Almanac] and we wind-up here if this step is in failure.
138    #[error("frame model error: {0}")]
139    EarthFrame(PlanetaryDataError),
140
141    /// Any physical non sense detected by ANISE will cause us to abort with this error.
142    #[error("physics issue: {0}")]
143    Physics(PhysicsError),
144
145    /// Post fit (pre nav) error
146    #[error("post-fit error")]
147    PostfitPrenav,
148
149    /// Remote observation is required for a [Candidate] to contribute in RTK solving attempt.
150    /// You need up to four of them to resolve. We may print this internal message and still
151    /// proceed to resolve, as [SV] may go out of sight of rover or reference site.
152    #[error("missing observation on remote site {0}({1})")]
153    MissingRemoteRTKObservation(Epoch, SV),
154
155    /// In RTK resolution attempt, you need to observe all pending [SV] on reference site as well.
156    /// If that is not the case, we abort with this error.
157    #[error("missing observations on remote site")]
158    MissingRemoteRTKObservations,
159
160    #[error("invalid frequency")]
161    InvalidFrequency,
162
163    #[error("unknown carrier frequency")]
164    UnknownCarrierFrequency,
165
166    #[error("rejected troposhere delay: model is diverging.")]
167    RejectedTropoDelay,
168
169    #[error("rejected ionosphere delay: model diverging.")]
170    RejectedIonoDelay,
171
172    #[error("converged to physically invalid state")]
173    StateUpdate,
174
175    #[error("bad operation: negative time")]
176    TimeUnderflow,
177
178    #[error("cannot resolve absolute time: unknown time correction")]
179    UnknownTimeCorection,
180
181    #[error("outdated time correction (need at least weekly update!)")]
182    OutdatedTimeCorrection,
183
184    #[error("unknown SV timescale: cannot proceed")]
185    UnknownTimescale,
186
187    #[error("postfit filter converged to physically invalid state")]
188    PostFitUpdate,
189
190    #[error("internal error: filter is not initialized (bad op)")]
191    UninitializedFilter,
192
193    #[error("rejected solution: GDOP limit exceeded")]
194    MaxGdopExceeded,
195
196    /// [Error::MissingPhaseRangeMeasurements] is returned when using PPP
197    /// strategy and CP measurements were not associated to PR measurements
198    /// (which is mandatory).
199    #[error("missing phase range measurements")]
200    MissingPhaseRange,
201
202    /// Unable to elect pivot satellite for SD algorithm,
203    /// empty dataset ? (should not happen, and potentially even be reached)
204    #[error("rtk prefit: unable to select pivot satellite")]
205    SdPivotSatellite,
206
207    /// RTK baseline is most liekly too long, and we
208    /// are limited to short baseliens currently.
209    #[error("rtk baseline most likely too long - internal limitation")]
210    RtkBaselineTooLong,
211
212    /// RTK resolution non feasible: missing DD measurement postfit
213    #[error("missing rtk measurement DD post-fit")]
214    RtkDDPostfitMissing,
215}