Skip to main content

SensorFusionMath

Trait SensorFusionMath 

Source
pub trait SensorFusionMath: Sized {
    // Required methods
    fn estimate_gravity(q: Quaternion<Self>) -> Vector3d<Self>;
    fn derivative(q: Quaternion<Self>, gyro: Vector3d<Self>) -> Quaternion<Self>;
    fn madgwick_step_acc(
        q: Quaternion<Self>,
        acc: Vector3d<Self>,
        max_acc_magnitude_squared: Self,
    ) -> Quaternion<Self>;
    fn madgwick_step_acc_mag(
        q: Quaternion<Self>,
        acc: Vector3d<Self>,
        mag: Vector3d<Self>,
        max_acc_magnitude_squared: Self,
    ) -> Quaternion<Self>;
}

Required Methods§

Source

fn estimate_gravity(q: Quaternion<Self>) -> Vector3d<Self>

Source

fn derivative(q: Quaternion<Self>, gyro: Vector3d<Self>) -> Quaternion<Self>

Source

fn madgwick_step_acc( q: Quaternion<Self>, acc: Vector3d<Self>, max_acc_magnitude_squared: Self, ) -> Quaternion<Self>

Source

fn madgwick_step_acc_mag( q: Quaternion<Self>, acc: Vector3d<Self>, mag: Vector3d<Self>, max_acc_magnitude_squared: Self, ) -> Quaternion<Self>

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementations on Foreign Types§

Source§

impl SensorFusionMath for f32

Source§

fn madgwick_step_acc( q: Quaternion<Self>, acc: Vector3d<Self>, max_acc_magnitude_squared: Self, ) -> Quaternion<Self>

Features of this implementation:

  1. Parallel Throughput: Instead of 12 separate floating-point multiplications and 8 additions, the SIMD unit performs 3 vector multiplications and 2 vector additions.

  2. Instruction Density: The simd_swizzle! maps directly to the VREV or VMOV instructions on the M33.

  3. Register Reuse: q_v stays in its SIMD register the entire time. The compiler will likely use VFMA (Vector Fused Multiply-Add) to combine the terms, meaning this whole function could resolve in under 15 clock cycles.

Source§

fn estimate_gravity(q: Quaternion<Self>) -> Vector3d<Self>

Source§

fn derivative(q: Quaternion<Self>, gyro: Vector3d<Self>) -> Quaternion<Self>

Source§

fn madgwick_step_acc_mag( q: Quaternion<Self>, acc: Vector3d<Self>, mag: Vector3d<Self>, max_acc_magnitude_squared: Self, ) -> Quaternion<Self>

Source§

impl SensorFusionMath for f64

Source§

fn estimate_gravity(q: Quaternion<Self>) -> Vector3d<Self>

Source§

fn derivative(q: Quaternion<Self>, gyro_rps: Vector3d<Self>) -> Quaternion<Self>

Source§

fn madgwick_step_acc( q: Quaternion<Self>, acc: Vector3d<Self>, max_acc_magnitude_squared: Self, ) -> Quaternion<Self>

Source§

fn madgwick_step_acc_mag( q: Quaternion<Self>, _acc: Vector3d<Self>, _mag: Vector3d<Self>, _max_acc_magnitude_squared: Self, ) -> Quaternion<Self>

Implementors§