pub struct Lag { /* private fields */ }Expand description
A second-order tracking loop, the shape of a GNSS receiver’s navigation filter: its output
x follows the truth p by ẍ = ωn² (p − x) + 2ζωn (ṗ − ẋ), so under a constant
acceleration a it settles a/ωn² behind.
It integrates the error e = p − x, whose equation ë = p̈ − ωn² e − 2ζωn ė takes the
truth’s acceleration as its input: the error stays small however far and fast the rocket
goes, so the step adds no lag of its own, and a constant acceleration’s fixed point is
a/ωn² exactly.
Implementations§
Source§impl Lag
impl Lag
Sourcepub fn new(omega_rad_s: f64, p: f64) -> Self
pub fn new(omega_rad_s: f64, p: f64) -> Self
A loop of natural frequency omega_rad_s, settled on p.
Sourcepub fn step(&mut self, dt_s: f64, p: f64, p_rate: f64) -> f64
pub fn step(&mut self, dt_s: f64, p: f64, p_rate: f64) -> f64
Steps the loop dt_s to the truth p, moving at p_rate (its acceleration taken from
the change in p_rate over the step), and returns its output. Semi-implicit Euler on the
error, accurate while ωn·dt is small (0.01 at 1 rad/s and 0.01 s).