use deep_causality_algebra::RealField;
#[derive(Clone, Copy, Debug)]
pub struct ImuModel<R> {
accel_bias: [R; 3],
gyro_bias: [R; 3],
process_noise_diag: [R; 17],
}
impl<R: RealField> ImuModel<R> {
pub fn new(accel_bias: [R; 3], gyro_bias: [R; 3], process_noise_diag: [R; 17]) -> Self {
Self {
accel_bias,
gyro_bias,
process_noise_diag,
}
}
pub fn sense_specific_force(&self, true_specific_force: [R; 3]) -> [R; 3] {
core::array::from_fn(|i| true_specific_force[i] + self.accel_bias[i])
}
pub fn sense_angular_rate(&self, true_angular_rate: [R; 3]) -> [R; 3] {
core::array::from_fn(|i| true_angular_rate[i] + self.gyro_bias[i])
}
pub fn accel_bias(&self) -> [R; 3] {
self.accel_bias
}
pub fn gyro_bias(&self) -> [R; 3] {
self.gyro_bias
}
pub fn process_noise(&self) -> [R; 17] {
self.process_noise_diag
}
}