Skip to content
Open
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions firmware/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -213,6 +213,7 @@ nalgebra = { version = "0.31", default-features = false, features = [
"macros",
"libm",
] }
approx = "0.5.1"
fugit = "0.3"
firmware_protocol = { path = "../networking/firmware_protocol", features = [
"nalgebra031",
Expand Down
7 changes: 6 additions & 1 deletion firmware/src/imu/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ mod fusion;
use defmt::{debug, info, trace, warn};
use embassy_executor::task;
use firmware_protocol::ImuType;
use approx::AbsDiffEq;

use crate::{
aliases::ඞ::{DelayConcrete, I2cConcrete},
Expand Down Expand Up @@ -46,6 +47,7 @@ pub async fn imu_task(
info!("Initialized IMU!");

let mut i = 0;
let mut prev_q = Quat::identity();
loop {
let q = match imu.next_data().await {
Ok(q) => q.q,
Expand All @@ -64,7 +66,10 @@ pub async fn imu_task(
);
}
i += 1;
quat_signal.signal(q);
if !q.abs_diff_eq(&prev_q, 0.0001) {
prev_q = q;
quat_signal.signal(q);
}
}
}

Expand Down