Skip to content

Commit fe21dac

Browse files
authored
Merge pull request #39 from rtk-rs/track_fit
Track fit
2 parents 8688b4e + 06df07b commit fe21dac

File tree

9 files changed

+543
-365
lines changed

9 files changed

+543
-365
lines changed

Cargo.toml

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,10 @@ default = [] # no features by default
2121
scheduler = []
2222

2323
# Satellite tracker and fit method
24-
tracker = ["polyfit-rs"]
24+
tracker = [
25+
"dep:polyfit-rs",
26+
"dep:log",
27+
]
2528

2629
[dependencies]
2730
thiserror = "2"
@@ -30,13 +33,12 @@ strum = "0.27"
3033
itertools = "0.14"
3134
strum_macros = "0.27"
3235
flate2 = { version = "1", optional = true }
33-
serde = { version = "1.0", optional = true, features = ["derive"] }
36+
log = { version = "0.4", optional = true }
37+
polyfit-rs = { version = "0.2", optional = true }
3438
gnss-rs = { version = "2.3.5", features = ["serde"] }
39+
serde = { version = "1.0", optional = true, features = ["derive"] }
3540
hifitime = { version = "4.0", features = ["serde", "std"] }
3641

37-
# track scheduling
38-
polyfit-rs = { version = "0.2", optional = true }
39-
4042
[dev-dependencies]
4143
rand = "0.8"
4244

src/lib.rs

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -36,9 +36,9 @@ mod header;
3636
#[cfg_attr(docsrs, doc(cfg(feature = "scheduler")))]
3737
mod scheduler;
3838

39-
// #[cfg(feature = "tracker")]
40-
// #[cfg_attr(docsrs, doc(cfg(feature = "tracker")))]
41-
// mod track_fit;
39+
#[cfg(feature = "tracker")]
40+
#[cfg_attr(docsrs, doc(cfg(feature = "tracker")))]
41+
mod tracker;
4242

4343
#[cfg(test)]
4444
mod tests;
@@ -63,8 +63,8 @@ pub mod prelude {
6363
#[cfg(feature = "scheduler")]
6464
pub use crate::scheduler::{calendar::CommonViewCalendar, period::CommonViewPeriod};
6565

66-
// #[cfg(feature = "tracker")]
67-
// pub use crate::track_fit::{Observation, FittedData, SVTracker, SkyTracker, FitError};
66+
#[cfg(feature = "tracker")]
67+
pub use crate::tracker::{FitError, FittedData, Observation, SVTracker, SkyTracker};
6868

6969
// pub re-export
7070
pub use gnss::prelude::{Constellation, SV};
@@ -81,9 +81,6 @@ use crate::{
8181
track::{CommonViewClass, Track},
8282
};
8383

84-
// /// Latest CGGTTS release : only version we truly support
85-
// pub const CURRENT_RELEASE: &str = "2E";
86-
8784
/// [CGGTTS] is a structure split in two:
8885
/// - the [Header] section gives general information
8986
/// about the measurement system and context

src/scheduler/calendar.rs

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -29,15 +29,17 @@ pub struct CommonViewCalendar {
2929
}
3030

3131
impl CommonViewCalendar {
32-
/// Design a new [CommonViewCalendar] (planification table).
32+
/// Design a new [CommonViewCalendar] to plan your common view measurements
33+
/// and CGGTTS realizations.
3334
///
3435
/// ## Input
3536
/// - reference_epoch: reference [Epoch] used in the scheduling process.
36-
/// In historical CGGTTS, this is MJD 50_722 +2'.
37+
/// In [Self::bipm], this is MJD 50_722 00:00:02.
3738
///
3839
/// - period: [CommonViewPeriod] specifications.
3940
/// The total [CommonViewPeriod] must be a perfect multiple of a day,
4041
/// we do not support a fractional number of daily periods.
42+
/// In [Self::bipm], this is [CommonViewPeriod::bipm_common_view_period].
4143
pub fn new(reference_epoch: Epoch, period: CommonViewPeriod) -> Result<Self, Error> {
4244
let total_duration = period.total_duration().to_seconds();
4345
let one_day = Duration::from_days(1.0).to_seconds();
@@ -241,15 +243,15 @@ impl CommonViewCalendar {
241243

242244
/// Returns remaining time (as [Duration]) until start of next
243245
/// [CommonViewPeriod] after specified [Epoch].
244-
pub fn time_to_next_start(&self, t: Epoch) -> Duration {
246+
pub fn time_to_next_period(&self, t: Epoch) -> Duration {
245247
let next_start = self.next_period_start_after(t);
246248
t - next_start
247249
}
248250

249251
/// Returns remaining time (as [Duration]) until start of next
250252
/// active data collection, after specified [Epoch].
251253
pub fn time_to_next_data_collection(&self, t: Epoch) -> Duration {
252-
let mut dt = self.time_to_next_start(t);
254+
let mut dt = self.time_to_next_period(t);
253255
if self.period.setup_duration == Duration::ZERO {
254256
dt += self.period.setup_duration;
255257
}

0 commit comments

Comments
 (0)