Skip to content

Commit

Permalink
Rename time_stamp to timestamp
Browse files Browse the repository at this point in the history
  • Loading branch information
Jan Herlyn committed Mar 10, 2024
1 parent 20b075f commit a2258c5
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 11 deletions.
20 changes: 10 additions & 10 deletions src/fusion_impl.rs
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ impl Fusion {
hard_iron_offset: FusionVector::zero(),
ahrs,
offset: FusionGyrOffset::new(sample_rate),
last_time_stamp: 0f32,
last_timestamp: 0f32,
}
}

Expand Down Expand Up @@ -50,8 +50,8 @@ impl Fusion {
/// }
///
/// ```
pub fn update_no_mag(&mut self, gyr: FusionVector, acc: FusionVector, time_stamp: f32) {
let delta_t = time_stamp - self.last_time_stamp;
pub fn update_no_mag(&mut self, gyr: FusionVector, acc: FusionVector, timestamp: f32) {
let delta_t = timestamp - self.last_timestamp;
// Apply calibration
let mut gyr = self.inertial_calibration(gyr, self.gyr_misalignment, self.gyr_sensitivity, self.gyr_offset);
let acc = self.inertial_calibration(acc, self.acc_misalignment, self.acc_sensitivity, self.acc_offset);
Expand All @@ -60,7 +60,7 @@ impl Fusion {
gyr = self.offset.update(gyr);

self.ahrs.update_no_mag(gyr, acc, delta_t);
self.last_time_stamp = time_stamp;
self.last_timestamp = timestamp;
}

/// Updates the AHRS algorithm based on gyroscope data in degrees/s, acceleration data in g force and a heading in degrees.
Expand Down Expand Up @@ -92,9 +92,9 @@ impl Fusion {
gyr: FusionVector,
acc: FusionVector,
heading: f32,
time_stamp: f32,
timestamp: f32,
) {
let delta_t = time_stamp - self.last_time_stamp;
let delta_t = timestamp - self.last_timestamp;

// Apply calibration
let mut gyr = self.inertial_calibration(gyr, self.gyr_misalignment, self.gyr_sensitivity, self.gyr_offset);
Expand All @@ -104,7 +104,7 @@ impl Fusion {
gyr = self.offset.update(gyr);

self.ahrs.update_external_heading(gyr, acc, heading, delta_t);
self.last_time_stamp = time_stamp;
self.last_timestamp = timestamp;
}

/// Updates the AHRS algorithm based on gyroscope data in degrees/s, acceleration data in g force and magnetic measurements in degrees.
Expand Down Expand Up @@ -136,9 +136,9 @@ impl Fusion {
gyr: FusionVector,
acc: FusionVector,
mag: FusionVector,
time_stamp: f32,
timestamp: f32,
) {
let delta_t = time_stamp - self.last_time_stamp;
let delta_t = timestamp - self.last_timestamp;
// Apply calibration
let mut gyr = self.inertial_calibration(gyr, self.gyr_misalignment, self.gyr_sensitivity, self.gyr_offset);
let acc = self.inertial_calibration(acc, self.acc_misalignment, self.acc_sensitivity, self.acc_offset);
Expand All @@ -148,7 +148,7 @@ impl Fusion {
gyr = self.offset.update(gyr);

self.ahrs.update(gyr, acc, mag, delta_t);
self.last_time_stamp = time_stamp;
self.last_timestamp = timestamp;
}

/// Obtain euler angle current sensor position
Expand Down
2 changes: 1 addition & 1 deletion src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ pub struct Fusion {
pub(crate) hard_iron_offset: FusionVector,
pub(crate) ahrs: FusionAhrs,
pub(crate) offset: FusionGyrOffset,
pub(crate) last_time_stamp: f32,
pub(crate) last_timestamp: f32,
}

pub struct FusionAhrs {
Expand Down

0 comments on commit a2258c5

Please sign in to comment.