Skip to content
This repository has been archived by the owner on Sep 29, 2024. It is now read-only.

Commit

Permalink
kalman with integral drift correction (adj mean)
Browse files Browse the repository at this point in the history
  • Loading branch information
mgrouch committed Nov 13, 2022
1 parent b3b134f commit d483967
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion rust/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,10 @@ fn get_f64(record: &StringRecord, index: usize) -> f64 {
record.get(index).expect(&*format!("Missing field {index}")).trim().parse::<f64>().unwrap()
}

fn mean(numbers: &Vec<f64>) -> f64 {
numbers.iter().sum::<f64>() as f64 / numbers.len() as f64
}

fn main() {
let (time, acc, pos, _ /*vel*/) = read_data("../test-data.txt");

Expand Down Expand Up @@ -69,7 +73,7 @@ fn main() {
data.push(Vector::new(vec![0.0]));
}

let acc_mean = -0.08; // TODO: calculate it
let acc_mean = mean(&acc);

// With no integral drift correction
let mut predicted: Vec<KalmanState> = Vec::with_capacity(n_timesteps+1);
Expand Down

0 comments on commit d483967

Please sign in to comment.