Skip to content

Commit

Permalink
CLIPPYgit add .! and also half-assed acceleration calculation:
Browse files Browse the repository at this point in the history
  • Loading branch information
misha7b committed Nov 21, 2024
1 parent 34105ec commit 55c0c26
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions lib/localisation/src/control/localizer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,9 @@ const STRIPE_WIDTH: f64 = 1.0;
pub struct Localizer {
displacement: f64,
velocity: f64,
previous_velocity: f64,
acceleration: f64,
kalman_filter: KalmanFilter,
accelerometer_preprocessor: AccelerometerPreprocessor,
keyence_checker: KeyenceAgrees,
keyence_val: f64,
optical_val: f64,
Expand Down Expand Up @@ -69,9 +69,10 @@ impl Localizer {
Localizer {
displacement: 0.0,
velocity: 0.0,
previous_velocity: 0.0,
acceleration: 0.0,
kalman_filter,
accelerometer_preprocessor: AccelerometerPreprocessor::new(),
//accelerometer_preprocessor: AccelerometerPreprocessor::new(),
keyence_checker: KeyenceAgrees::new(),
keyence_val: 0.0,
optical_val: 0.0,
Expand Down Expand Up @@ -116,7 +117,7 @@ impl Localizer {
let processed_accelerometer_data = processed_accelerometer_data.unwrap();
self.accelerometer_val = 0.0;
for i in 0..K_NUM_ACCELEROMETERS {
for j in 0..K_NUM_AXIS {
for _ in 0..K_NUM_AXIS {
self.accelerometer_val += processed_accelerometer_data[i] as f64;
}
}
Expand Down Expand Up @@ -147,6 +148,8 @@ impl Localizer {

self.displacement = state[0];
self.velocity = state[1];
//TODOLater: Acceleration!
self.acceleration = (self.velocity - self.previous_velocity) / DELTA_T; //TODOLater: is this good enough?
self.previous_velocity = self.velocity;

}
}

0 comments on commit 55c0c26

Please sign in to comment.