mirror of
https://github.com/wpilibsuite/allwpilib
synced 2026-07-05 03:21:42 +00:00
Add back tau variable
This commit is contained in:
@@ -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,
|
||||
|
||||
@@ -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(
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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(
|
||||
|
||||
@@ -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 =
|
||||
|
||||
Reference in New Issue
Block a user