From 0c6639ff352665cde326ecfea17d33c34b1de844 Mon Sep 17 00:00:00 2001 From: CL16gtgh Date: Sat, 18 May 2024 14:38:51 -0400 Subject: [PATCH] Added non zero filer alpha --- lib/systems/include/SteeringSystem.h | 14 +++++--------- src/main.cpp | 2 +- 2 files changed, 6 insertions(+), 10 deletions(-) diff --git a/lib/systems/include/SteeringSystem.h b/lib/systems/include/SteeringSystem.h index 75ade62b8..f73254b93 100644 --- a/lib/systems/include/SteeringSystem.h +++ b/lib/systems/include/SteeringSystem.h @@ -12,6 +12,8 @@ // TODO: evalaute reasonable thresholds for agreement #define STEERING_DIVERGENCE_ERROR_THRESHOLD (14.0) // Steering sensors can disagree by x degrees before output is considered erroneous #define STEERING_DIVERGENCE_WARN_THRESHOLD (8.0) // Warning condition will be raised when steering sensors diverge x degrees +#define NUM_SENSORS 2 +#define DEFAULT_STEERING_ALPHA (0.0) // Enums enum class SteeringSystemStatus_e @@ -52,18 +54,12 @@ class SteeringSystem float filteredAngleSecondary_; public: SteeringSystem(SteeringEncoderInterface *primarySensor) - : primarySensor_(primarySensor) + : SteeringSystem(primarySensor, DEFAULT_STEERING_ALPHA) {} SteeringSystem(SteeringEncoderInterface *primarySensor, float filterAlpha) - : primarySensor_(primarySensor) - { - for (int i = 0; i < NUM_SENSORS; i++) - { - steeringFilters_[i] = Filter_IIR(filterAlpha); - } - - } + : SteeringSystem(primarySensor, filterAlpha, filterAlpha) + {} SteeringSystem(SteeringEncoderInterface *primarySensor, float filterAlphaPrimary, float filterAlphaSecondary) : primarySensor_(primarySensor) diff --git a/src/main.cpp b/src/main.cpp index 0e71e20df..381e47a6d 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -142,7 +142,7 @@ struct inverters // */ SysClock sys_clock; -SteeringSystem steering_system(&steering1); +SteeringSystem steering_system(&steering1, 0.8); BuzzerController buzzer(BUZZER_ON_INTERVAL); SafetySystem safety_system(&ams_interface, &wd_interface);