Skip to main content

Module rls

Module rls 

Source
Expand description

Recursive Least Squares (RLS) solvers for online parameter estimation.

Two solver variants are provided:

VariantInternal stateNumerical properties
standardCovariance PRequires numerical guards; matches indiflight C reference
inverse_qrInfo-matrix factor LInherently well-conditioned; no guards needed

Both support exponential forgetting (λ) and parallel multi-output mode with shared regressors.

§Quick start

use flight_solver::rls::{RlsParallel, CovarianceGuards};

// 4 regressors, 3 parallel outputs (e.g. motor → roll/pitch/yaw)
let mut rls = RlsParallel::<4, 3>::new(1e2, 0.995, CovarianceGuards::default());

// Each control loop iteration:
let a = nalgebra::SVector::<f32, 4>::new(0.1, -0.2, 0.3, 0.05);
let y = nalgebra::SVector::<f32, 3>::new(0.5, -0.3, 0.1);
let _stats = rls.update(&a, &y);

let params = rls.params(); // 4×3 estimated parameter matrix

Re-exports§

pub use self::types::CovarianceGuards;
pub use self::types::ExitCode;
pub use self::types::UpdateStats;
pub use inverse_qr::InverseQrRls;
pub use standard::Rls;
pub use standard::RlsParallel;

Modules§

inverse_qr
Inverse QR-RLS solver using Givens rotations on the information matrix factor.
standard
Standard (covariance-form) Recursive Least Squares.
types
Types specific to the RLS solvers.