dcmimu 0.1.1

no_std DCM IMU implementation
Documentation

no_std implementation of Heikki Hyyti and Arto Visala DCM-IMU algorithm. """The DCM-IMU algorithm is designed for fusing low-cost triaxial MEMS gyroscope and accelerometer measurements. An extended Kalman filter is used to estimate attitude in direction cosine matrix (DCM) formation and gyroscope biases online. A variable measurement covariance method is implemented for acceleration measurements to ensure robustness against transient non-gravitational accelerations which usually induce errors to attitude estimate in ordinary IMU-algorithms."""

Usage

# Create DCMIMU:
let mut dcmimu = DCMIMU::new();
let mut prev_t_ms = now();
loop {
    # get gyroscope and accelerometer measurement from your sensors:
    let gyro = sensor.read_gyro();
    let accel = sensor.read_accel();
    # Convert measurements to SI if needed.
    # Get time difference since last update:
    let t_ms = now();
    let dt_ms = t_ms - prev_t_ms
    prev_t_ms = t_ms
    # Update dcmimu states (don't forget to use SI):
    let dcm = dcmimu.update((gyro.x, gyro.y, gyro.z),
                            (accel.x, accel.y, accel.z),
                            dt_ms.seconds());
    println!("Roll: {}; yaw: {}; pitch: {}", dcm.roll, dcm.yaw, dcm.pitch);
    # Measurements can also be queried without updating:
    println!("{:?} == {}, {}, {}", dcmimu.all(), dcmimu.roll(), dcmimu.yaw(), dcmimu.pitch());
}