From e7dceb740d831226a64781a118fe671c93b078b7 Mon Sep 17 00:00:00 2001 From: CL16gtgh Date: Sun, 12 May 2024 22:06:24 -0400 Subject: [PATCH] configuration for testing --- lib/mock_interfaces/Filter_IIR.h | 48 ++++++++++++++++++++++++++++++++ test/test_systems/main.cpp | 4 +-- 2 files changed, 50 insertions(+), 2 deletions(-) create mode 100644 lib/mock_interfaces/Filter_IIR.h diff --git a/lib/mock_interfaces/Filter_IIR.h b/lib/mock_interfaces/Filter_IIR.h new file mode 100644 index 000000000..312b2f795 --- /dev/null +++ b/lib/mock_interfaces/Filter_IIR.h @@ -0,0 +1,48 @@ +/* IIR digital low pass filter */ +#ifndef __FILTER_IIR__ +#define __FILTER_IIR__ + +#include + +#define DEFAULT_ALPHA 0.0 + +template +class Filter_IIR +{ + +public: + /** + * Constructors + */ + Filter_IIR(float alpha, dataType init_val=0) { + set_alpha(alpha); + prev_reading = init_val; + } + Filter_IIR() { + Filter_IIR(DEFAULT_ALPHA); + } + + void set_alpha(float alpha); + dataType get_prev_reading() const {return prev_reading;} + + dataType filtered_result(dataType new_val); + +private: + float alpha; + dataType prev_reading; +}; + +template +class FilterIIRMulti +{ +protected: + Filter_IIR filter_channels_[N]; +public: + virtual void setAlphas(int channel, float alpha) + { + filter_channels_[channel].set_alpha(alpha); + } +}; + +#endif +#pragma once \ No newline at end of file diff --git a/test/test_systems/main.cpp b/test/test_systems/main.cpp index 6a3061db6..8a56a607e 100644 --- a/test/test_systems/main.cpp +++ b/test/test_systems/main.cpp @@ -1,11 +1,11 @@ #include #include "state_machine_test.h" -#include "pedals_system_test.h" +// #include "pedals_system_test.h" #include "torque_controller_mux_test.h" #include "drivetrain_system_test.h" #include "safety_system_test.h" -#include "test_CASE.h" +// #include "test_CASE.h" // #include "param_system_test.h" int main(int argc, char **argv)