Real-time solvers for flight controllers. no_std, fully stack-allocated, const-generic over all dimensions.
| Module | Algorithm | Description |
|---|---|---|
cls |
Constrained Least Squares | Active-set solver with incremental Givens QR |
cls::setup::wls |
WLS formulation | Weighted LS with actuator-preference regularisation |
cls::setup::ls |
LS formulation | Plain (unregularised) least-squares |
rls::standard |
Standard RLS | Covariance-form with numerical guards |
rls::inverse_qr |
Inverse QR-RLS | Information-form via Givens rotations |
use flight_solver::rls::{InverseQrRls, RlsParallel, CovarianceGuards};
// Inverse QR-RLS: 4 regressors, 3 parallel outputs
let mut rls = InverseQrRls::<4, 3>::new(1e2, 0.995);
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);
rls.update(&a, &y);use flight_solver::cls::{solve, ExitCode, Mat, VecN};
use flight_solver::cls::setup::wls::{setup_a, setup_b};
let g: Mat<6, 4> = Mat::zeros();
let wv = VecN::<6>::from_column_slice(&[10.0, 10.0, 10.0, 1.0, 0.5, 0.5]);
let mut wu = VecN::<4>::from_column_slice(&[1.0; 4]);
let (a, gamma) = setup_a::<4, 6, 10>(&g, &wv, &mut wu, 2e-9, 4e5);
let b = setup_b::<4, 6, 10>(&VecN::zeros(), &VecN::from_column_slice(&[0.5; 4]), &wv, &wu, gamma);
let mut us = VecN::<4>::from_column_slice(&[0.5; 4]);
let mut ws = [0i8; 4];
let stats = solve::<4, 6, 10>(&a, &b, &VecN::zeros(), &VecN::from_element(1.0), &mut us, &mut ws, 100);- Haykin, S. Adaptive Filter Theory, 5th ed., Pearson, 2014. Ch. 15 - Square-root adaptive filtering (inverse QR-RLS derivation).
- ActiveSetCtlAlloc - C reference implementation of the active-set WLS solver.
- Indiflight - C reference implementation of the standard RLS with numerical guards.