moonbitstack/moonmcl/estimation does not have a README file

    AlphaBetaGamma

    pub(all) struct AlphaBetaGamma {
    alpha : Double
    beta : Double
    gamma : Double
    position : Double
    velocity : Double
    acceleration : Double
    } derive(
    Debug
    )

    An alpha-beta-gamma tracker: position, velocity and acceleration of one axis from a position measurement.

    The three gains trade noise against lag the way a Kalman filter does with a fixed model: alpha corrects the position, beta the velocity and gamma the acceleration. The preset is the critically damped set for a steady-state model of a constant acceleration.

    AlphaBetaGamma::new

    fn AlphaBetaGamma::new(alpha? : Double, beta? : Double, gamma? : Double, position? : Double) -> AlphaBetaGamma raise
    Refused

    A tracker with the given gains and starting position.

    AlphaBetaGamma::update

    fn AlphaBetaGamma::update(self : AlphaBetaGamma, measurement~ : Double, dt~ : Double) ->
    Sample

    The state after folding in one position measurement.

    Complementary

    pub(all) struct Complementary {
    alpha : Double
    angle : Double
    } derive(
    Debug
    )

    A complementary filter for one angle: the gyro is trusted for the fast motion, the measurement for the slow drift.

    alpha is the fraction of the integrated rate kept each period. At 0.98 with a period of a hundredth of a second the time constant is about half a second, which is the usual balance for a hobby-grade inertial sensor.

    Complementary::angle

    fn Complementary::angle(self : Complementary) -> Double

    The current angle.

    Complementary::new

    fn Complementary::new(alpha? : Double, angle? : Double) -> Complementary raise
    Refused

    A complementary filter with the given blend and starting angle.

    Complementary::update

    fn Complementary::update(self : Complementary, rate~ : Double, measurement~ : Double, dt~ : Double) -> Double

    The corrected angle after one period.

    ExtendedKalman

    An extended Kalman filter: the linear recursion with the Jacobians the model supplies, whether analytically or by the contract's default differences.

    ExtendedKalman::covariance

    ExtendedKalman::new

    An extended Kalman filter for any plant that implements the model contract.

    ExtendedKalman::predict

    fn ExtendedKalman::predict(self : ExtendedKalman, u :
    Vec
    , dt : Double) -> Unit

    ExtendedKalman::to_repr

    Kalman

    A linear Kalman filter for a discrete state-space plant.

    Kalman::covariance

    Kalman::new

    A Kalman filter for model with the given noise covariances and prior.

    Kalman::predict

    fn Kalman::predict(self : Kalman, u :
    Vec
    , dt : Double) -> Unit

    Kalman::state

    ParticleFilter

    A particle filter over any plant that implements the model contract.

    The particles are drawn around the prior at construction and then carried by the model itself, so the filter never assumes the state distribution stays Gaussian. Resampling is systematic and only runs when the effective sample size falls below half the cloud, which keeps the diversity a plain resample-every-step filter loses.

    ParticleFilter::covariance

    ParticleFilter::particles

    The particles, for a caller that plots the cloud.

    ParticleFilter::predict

    fn ParticleFilter::predict(self : ParticleFilter, u :
    Vec
    , dt : Double) -> Unit

    ParticleFilter::to_repr

    ParticleFilter::weights

    fn ParticleFilter::weights(self : ParticleFilter) -> Array[Double]

    The weight of each particle.

    UnscentedConfig

    pub(all) struct UnscentedConfig {
    alpha : Double
    beta : Double
    kappa : Double
    } derive(
    Debug
    )

    The spread of the sigma points in the unscented transform.

    alpha sets how far the points sit from the mean, beta folds in the knowledge that the distribution is Gaussian, and kappa is the usual secondary scaling. The preset is the one the reference implementations use.

    UnscentedKalman

    An unscented Kalman filter.

    UnscentedKalman::covariance

    UnscentedKalman::new

    An unscented Kalman filter for any plant that implements the model contract.

    UnscentedKalman::predict

    fn UnscentedKalman::predict(self : UnscentedKalman, u :
    Vec
    , dt : Double) -> Unit

    UnscentedKalman::to_repr

    rts

    The Rauch-Tung-Striebel smoother: the forward filter's estimates refined by a backward pass over the same record.

    states and covariances are the filtered estimates, transitions the state matrices between consecutive steps, and process the process covariance. The result is the smoothed state and covariance at every step, whose covariances are never larger than the filtered ones.

    unscented_config

    let unscented_config : UnscentedConfig

    The preset spread: a narrow alpha, the Gaussian beta and a zero kappa.