veloxity_core/
estimator.rs1use crate::{
2 comm::messages::messages::ExternalAttitudeMsg, math::FlightFloat, params::Params,
3 sensors::ProcessedSensors,
4};
5pub mod quad;
6
7pub struct EstimatorCtx<'a, R: FlightFloat> {
8 pub sensors: &'a ProcessedSensors<R>,
9 pub params: &'a Params,
10 pub dt: R,
11 pub external_attitude: Option<ExternalAttitudeMsg>,
12}
13
14pub trait Estimator<R: FlightFloat> {
15 type State: AttitudeEstimate;
16 fn estimate(&mut self, ctx: EstimatorCtx<'_, R>) -> Self::State;
17
18 fn update_params(&mut self, _params: &Params) {}
19
20 fn reset(&mut self) {}
21
22 fn reset_adaptive_bias(&mut self) {}
23}
24
25pub trait AttitudeEstimate {
26 fn q(&self) -> [f32; 4];
27 fn q_dot(&self) -> [f32; 4];
28 fn is_healthy(&self) -> bool;
29}