Expand description
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
let mut dcmimu = DCMIMU::new();
let mut prev_t_ms = now();
loop {
let gyro = sensor.read_gyro();
let accel = sensor.read_accel();
let t_ms = now();
let dt_ms = t_ms - prev_t_ms
prev_t_ms = t_ms
dcmimu.update_only((gyro.x, gyro.y, gyro.z), (accel.x, accel.y, accel.z), dt_ms.seconds());
let dcm = dcmimu.to_euler_angles();
println!("Roll: {}; yaw: {}; pitch: {}", dcm.roll, dcm.yaw, dcm.pitch);
}
Structs§
- DCMIMU
- Euler
Angles - Represents three dimensions:
- Gyro
Biases - Calculated gyro biases