use crate::frames::Body;
use crate::history::History;
use crate::state::State;
use crate::units::{AngularRate, Timestamp};
#[derive(Clone, Debug, Default)]
pub(super) struct Estimate {
state: State,
history: History,
}
impl Estimate {
pub(super) const fn state(&self) -> &State {
&self.state
}
pub(super) fn commit(&mut self, state: State) {
self.history.shift(&self.state, &state);
self.state = state;
}
pub(super) fn step(&mut self, time: Timestamp, state: State) {
self.state = state;
self.history.record(time, &self.state);
}
pub(super) fn restart(&mut self, time: Timestamp, state: State) {
self.state = state;
self.history.clear();
self.history.record(time, &self.state);
}
pub(super) fn at(
&self,
time: Timestamp,
now: Timestamp,
omega: AngularRate<Body>,
) -> (State, Timestamp) {
self.history.at(time, now, &self.state, omega)
}
}