Add back tau variable

This commit is contained in:
Gold856
2024-06-05 12:41:27 -04:00
parent 3d32efc776
commit 6b7f0d25f6
6 changed files with 8 additions and 4 deletions

View File

@@ -668,7 +668,7 @@ void ADIS16448_IMU::Acquire() {
// Store timestamp for next iteration
previous_timestamp = buffer[i];
// Calculate alpha for use with the complementary filter
m_alpha = 0.5 / (0.5 + m_dt);
m_alpha = kTau / (kTau + m_dt);
// Run inclinometer calculations
double accelAngleX = atan2f(
-accel_x_si,

View File

@@ -695,7 +695,7 @@ void ADIS16470_IMU::Acquire() {
// Store timestamp for next iteration
previous_timestamp = buffer[i];
m_alpha = 1.0 / (1.0 + m_dt);
m_alpha = kTau / (kTau + m_dt);
// Run inclinometer calculations
double accelAngleX = atan2f(

View File

@@ -383,6 +383,7 @@ class ADIS16448_IMU : public wpi::Sendable,
// Complementary filter variables
double m_dt, m_alpha = 0.0;
static constexpr double kTau = 0.5;
double m_compAngleX, m_compAngleY, m_accelAngleX, m_accelAngleY = 0.0;
// vector for storing most recent imu values

View File

@@ -490,6 +490,7 @@ class ADIS16470_IMU : public wpi::Sendable,
// Complementary filter variables
double m_dt, m_alpha = 0.0;
static constexpr double kTau = 1.0;
double m_compAngleX, m_compAngleY, m_accelAngleX, m_accelAngleY = 0.0;
// Complementary filter functions

View File

@@ -156,6 +156,7 @@ public class ADIS16448_IMU implements AutoCloseable, Sendable {
// Complementary filter variables
private double m_dt = 0.0;
private double m_alpha = 0.0;
private static final double kTau = 1.0;
private double m_compAngleX = 0.0;
private double m_compAngleY = 0.0;
private double m_accelAngleX = 0.0;
@@ -757,7 +758,7 @@ public class ADIS16448_IMU implements AutoCloseable, Sendable {
// Store timestamp for next iteration
previous_timestamp = buffer[i];
// Calculate alpha for use with the complementary filter
m_alpha = 1.0 / (1.0 + m_dt);
m_alpha = kTau / (kTau + m_dt);
// Run inclinometer calculations
double accelAngleX =
Math.atan2(

View File

@@ -205,6 +205,7 @@ public class ADIS16470_IMU implements AutoCloseable, Sendable {
// Complementary filter variables
private double m_dt = 0.0;
private double m_alpha = 0.0;
private static final double kTau = 1.0;
private double m_compAngleX = 0.0;
private double m_compAngleY = 0.0;
private double m_accelAngleX = 0.0;
@@ -743,7 +744,7 @@ public class ADIS16470_IMU implements AutoCloseable, Sendable {
// Store timestamp for next iteration
previous_timestamp = buffer[i];
m_alpha = 1.0 / (1.0 + m_dt);
m_alpha = kTau / (kTau + m_dt);
// Run inclinometer calculations
double accelAngleX =