Crates.io | vqf |
lib.rs | vqf |
version | 0.3.0 |
source | src |
created_at | 2024-11-03 18:17:20.470381 |
updated_at | 2024-11-06 00:45:38.323887 |
description | Implementation of the Versatile Quaternion-based Filter (VQF) algorithm for sensor fusion. |
homepage | |
repository | https://github.com/oxkitsune/vqf |
max_upload_size | |
id | 1434039 |
size | 48,029 |
A Rust implementation of the Versatile Quaternion-based Filter (VQF) algorithm, as described in this paper.
[!NOTE] Currently this crate does not implement the magnometer update.
use nalgebra::Vector3;
use std::time::Duration;
use vqf::{Vqf, VqfParameters};
let gyro_rate = Duration::from_secs_f32(0.01); // 100Hz
let accel_rate = Duration::from_secs_f32(0.01);
let params = VqfParameters::default();
let mut vqf = Vqf::new(gyro_rate, accel_rate, params);
let gyro_data = Vector3::new(0.01, 0.02, -0.01); // rad/s
let accel_data = Vector3::new(0.0, 0.0, 9.81); // m/s^2
vqf.update(gyro_data, accel_data);
let orientation = vqf.orientation();
println!("Current orientation: {:?}", orientation);