Skip to content

BdotFiniteDiff

Defined in: bdot.rs:166

pub struct BdotFiniteDiff\<F: [MagneticFieldModel](../../../../tobari/api/traits/magneticfieldmodel/) = [tobari::magnetic::TiltedDipole](../../../../tobari/api/structs/tilteddipole/)\>

B-dot controller using finite-difference dB/dt estimation.

Unlike BdotDetumbler which uses the analytical approximation dB_body/dt = -omega x B_body, this controller measures the actual magnetic field at each sample time and computes dB/dt via backward finite difference. This is more realistic (flight software only sees magnetometer readings) but introduces a one-sample delay and produces zero command on the first call.

When no epoch is available, returns zero command.

fn new(gain: f64, max_moment: Vector3<f64>, field: F, sample_period: f64) -> Self

Create a new finite-difference B-dot controller.

max_moment is per-axis maximum [A·m²] for a 3-axis MTQ.

Panics if gain is negative, any component of max_moment is negative, or sample_period is not positive.