Expand description
Fusion AHRS - A sensor fusion library for attitude and heading reference systems
This is a Rust port of the C library by xioTechnologies: https://github.com/xioTechnologies/Fusion
This library provides a complete implementation of an AHRS algorithm that fuses gyroscope, accelerometer, and magnetometer data to estimate device orientation. It features automatic sensor rejection during motion/interference and recovery mechanisms for robust operation.
§Features
- Complementary filter with sensor fusion
- Automatic accelerometer rejection during motion
- Automatic magnetometer rejection during magnetic interference
- Gyroscope offset correction for temperature drift
- Support for multiple Earth coordinate conventions (NWU, ENU, NED)
#![no_std]
compatible for embedded systems
§Quick Start
use nalgebra::Vector3;
use fusion_ahrs::{Ahrs, AhrsSettings};
let mut ahrs = Ahrs::new();
// Sensor readings
let gyroscope = Vector3::new(0.1, 0.2, 0.3); // deg/s
let accelerometer = Vector3::new(0.0, 0.0, 1.0); // g
let magnetometer = Vector3::new(1.0, 0.0, 0.0); // µT
// Update AHRS
ahrs.update(gyroscope, accelerometer, magnetometer, 0.01); // 10ms
// Get orientation
let quaternion = ahrs.quaternion();
// Convert to Euler angles (roll, pitch, yaw)
let (roll, pitch, yaw) = quaternion.euler_angles();
For more documentation and examples, see: https://github.com/wboayue/fusion-ahrs
Re-exports§
pub use calibration::calibrate_inertial;
pub use calibration::calibrate_magnetic;
pub use compass::calculate_heading;
pub use offset::Offset;
Modules§
- calibration
- Sensor calibration functions for the Fusion AHRS library
- compass
- Tilt-compensated compass implementation for the Fusion AHRS library
- offset
- Gyroscope offset correction for the Fusion AHRS library
Structs§
- Ahrs
- Main AHRS algorithm structure
- Ahrs
Flags - AHRS algorithm flags
- Ahrs
Internal States - AHRS algorithm internal states
- Ahrs
Settings - AHRS algorithm settings
- Offset
Settings - Gyroscope offset correction settings
Enums§
- Convention
- Earth axes convention
Constants§
- DEG_
TO_ RAD - Conversion factor from degrees to radians
- RAD_
TO_ DEG - Conversion factor from radians to degrees
Traits§
- Quaternion
Ext - Extension trait for UnitQuaternion operations
- Vector3
Ext - Extension trait for Vector3 operations