Skip to content

Commit 0baaa77

Browse files
Add self-consistency test
1 parent c9bff7a commit 0baaa77

File tree

1 file changed

+22
-7
lines changed

1 file changed

+22
-7
lines changed

tests/orbit_determination/blse.rs

Lines changed: 22 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -29,12 +29,15 @@ fn almanac() -> Arc<Almanac> {
2929
/// Tests the robustness of the Batch least squares estimator against large initial state errors.
3030
#[allow(clippy::identity_op)]
3131
#[rstest]
32-
#[case(BLSSolver::NormalEquations, 60.seconds(), 2.minutes())]
33-
#[case(BLSSolver::LevenbergMarquardt, 10.seconds(), 10.minutes())]
32+
#[case(BLSSolver::NormalEquations, 60.seconds(), 2.minutes(), false)]
33+
#[case(BLSSolver::LevenbergMarquardt, 10.seconds(), 10.minutes(), false)]
34+
#[case(BLSSolver::NormalEquations, 60.seconds(), 2.minutes(), true)]
35+
#[case(BLSSolver::LevenbergMarquardt, 10.seconds(), 10.minutes(), true)]
3436
fn blse_robust_large_disp_cov_test(
3537
#[case] solver: BLSSolver,
3638
#[case] sample: Duration,
3739
#[case] offset: Duration,
40+
#[case] disperse: bool,
3841
almanac: Arc<Almanac>,
3942
) {
4043
let _ = pretty_env_logger::try_init();
@@ -133,7 +136,11 @@ fn blse_robust_large_disp_cov_test(
133136

134137
let blse_solution = blse
135138
.estimate(
136-
initial_estimate.nominal_state,
139+
if disperse {
140+
initial_estimate.nominal_state
141+
} else {
142+
initial_state
143+
},
137144
&arc.filter_by_offset(..offset),
138145
)
139146
.expect("blse should not fail");
@@ -159,10 +166,18 @@ fn blse_robust_large_disp_cov_test(
159166
vmag_km_s_imp * 1e3,
160167
);
161168

162-
assert!(
163-
rmag_km_imp > 0.0,
164-
"Position estimate not any better after BLSE"
165-
);
169+
if disperse {
170+
assert!(
171+
rmag_km_imp > 0.0,
172+
"Position estimate not any better after BLSE"
173+
);
174+
} else {
175+
// The RMAG error should be centimeter level, roughly the noise.
176+
assert!(
177+
delta.rmag_km() < 0.1,
178+
"Position estimate without dispersions too large"
179+
);
180+
}
166181

167182
let kf_est: KfEstimate<Spacecraft> = blse_solution.into();
168183
println!("{kf_est}");

0 commit comments

Comments
 (0)