Flight Solver
Real-time solvers for flight controllers. no_std, fully stack-allocated, const-generic over all dimensions.
Solvers
| 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 |
Quick start
RLS - online parameter estimation
use ;
// Inverse QR-RLS: 4 regressors, 3 parallel outputs
let mut rls = new;
let a = new;
let y = new;
rls.update;
WLS control allocation (high-level API)
flight_solver::wls::ControlAllocator owns the problem configuration (A,
γ, normalized wu) and the warm-start solver state across solves. Build
once, then call solve() every control tick to compute the optimal control
allocation for a given desired pseudo-control and preferred motor command.
use ControlAllocator;
use ;
let g: = zeros;
let wv = from_column_slice;
let wu = from_column_slice;
// One-time setup: factor A, compute γ, normalize wu
let mut alloc = new;
// Per-tick solve — warm-start is persisted automatically across calls
let v = zeros;
let ud = from_column_slice;
let umin = from_column_slice;
let umax = from_column_slice;
let stats = alloc.solve;
assert_eq!;
let u = alloc.solution; // optimal motor commands
CLS - raw building blocks
For advanced use — custom A matrices, the unregularised CLS variant, or
non-standard pipeline composition — the cls module exposes the underlying
free functions directly.
use ;
use ;
let g: = zeros;
let wv = from_column_slice;
let mut wu = from_column_slice;
let = ;
let b = ;
let mut us = from_column_slice;
let mut ws = ;
let stats = ;
References
- 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.