-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
2 changed files
with
20 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
use imu_fusion::FusionAhrsSettings; | ||
use nalgebra::{Vector3}; | ||
|
||
const SAMPLE_RATE_HZ: u32 = 100; | ||
|
||
fn main() { | ||
let ahrs_settings = FusionAhrsSettings::new(); | ||
let mut fusion = imu_fusion::Fusion::new(SAMPLE_RATE_HZ, ahrs_settings); | ||
loop { | ||
let gyr = Vector3::new(0f32, 0f32, 0f32); // replace this with actual gyroscope data in degrees/s | ||
let acc = Vector3::new(0f32, 0f32, 1.0f32); // replace this with actual accelerometer data in g | ||
fusion.update_no_mag(gyr.into(), acc.into(), 1.0 / SAMPLE_RATE_HZ as f32); | ||
let euler = fusion.euler(); | ||
println!("Roll {}, Pitch {}, Yaw {}", euler.angle.roll, euler.angle.pitch, euler.angle.yaw); | ||
} | ||
} |