Skip to content

Commit

Permalink
configuration for testing
Browse files Browse the repository at this point in the history
  • Loading branch information
CL16gtgh committed May 13, 2024
1 parent c76391e commit e7dceb7
Show file tree
Hide file tree
Showing 2 changed files with 50 additions and 2 deletions.
48 changes: 48 additions & 0 deletions lib/mock_interfaces/Filter_IIR.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
/* IIR digital low pass filter */
#ifndef __FILTER_IIR__
#define __FILTER_IIR__

#include <stdint.h>

#define DEFAULT_ALPHA 0.0

template <typename dataType>
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 <typename dataType, int N>
class FilterIIRMulti
{
protected:
Filter_IIR<dataType> filter_channels_[N];
public:
virtual void setAlphas(int channel, float alpha)
{
filter_channels_[channel].set_alpha(alpha);
}
};

#endif
#pragma once
4 changes: 2 additions & 2 deletions test/test_systems/main.cpp
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
#include <gtest/gtest.h>

#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)
Expand Down

0 comments on commit e7dceb7

Please sign in to comment.