use anise::prelude::{Almanac, Frame};
use crate::{
bias::Bias,
candidate::Candidate,
cfg::Config,
ephemeris::EphemerisSource,
navigation::PVTSolution,
orbit::OrbitSource,
prelude::{Epoch, Error, Rc, UserParameters},
rtk::RTKBase,
solver::Solver,
time::AbsoluteTime,
};
pub struct KinematicSolver<EPH: EphemerisSource, ORB: OrbitSource, B: Bias, TIM: AbsoluteTime> {
solver: Solver<EPH, ORB, B, TIM>,
}
impl<EPH: EphemerisSource, ORB: OrbitSource, B: Bias, TIM: AbsoluteTime>
KinematicSolver<EPH, ORB, B, TIM>
{
pub fn new(
almanac: Almanac,
earth_cef: Frame,
cfg: Config,
eph_source: Rc<EPH>,
orbit_source: Rc<ORB>,
time_source: TIM,
bias: B,
initial_ecef_m: Option<(f64, f64, f64)>,
) -> Self {
Self {
solver: Solver::<EPH, ORB, B, TIM>::new(
almanac,
earth_cef,
cfg,
eph_source,
orbit_source,
time_source,
bias,
initial_ecef_m,
),
}
}
pub fn new_survey(
almanac: Almanac,
earth_cef: Frame,
cfg: Config,
eph_source: Rc<EPH>,
orbit_source: Rc<ORB>,
time_source: TIM,
bias: B,
) -> Self {
Self {
solver: Solver::<EPH, ORB, B, TIM>::new(
almanac,
earth_cef,
cfg,
eph_source,
orbit_source,
time_source,
bias,
None,
),
}
}
pub fn ppp_solving(
&mut self,
epoch: Epoch,
params: UserParameters,
candidates: &[Candidate],
) -> Result<PVTSolution, Error> {
self.solver.ppp_solving(epoch, params, candidates)
}
pub fn rtk_solving<RTK: RTKBase>(
&mut self,
epoch: Epoch,
params: UserParameters,
candidates: &[Candidate],
base: &RTK,
) -> Result<PVTSolution, Error> {
self.solver.rtk_solving(epoch, params, candidates, base)
}
pub fn reset(&mut self) {
self.solver.reset();
}
}