HRI board firmware  v2.1
Microcontroller firmware of the board used during the HRI labs.
Data Structures | Functions
Lib / Basic filter

Basic iterative filter for smoothing. More...

Data Structures

struct  bfilt_BasicFilter
 Basic filter structure. More...
 

Functions

void bfilt_Init (bfilt_BasicFilter *filter, float32_t tau, float32_t initialValue)
 Initialize a BasicFilter structure. More...
 
float32_t bfilt_Step (bfilt_BasicFilter *filter, float32_t newValue)
 Step a BasicFilter structure. More...
 

Detailed Description

Basic iterative filter for smoothing.

First, instance a bfilt_BasicFilter structure (e.g. "bfilt_BasicFilter b;"), then initialize it once with bfilt_Init(). Then, every time a new value of the signal is received, call bfilt_Step().

Function Documentation

◆ bfilt_Init()

void bfilt_Init ( bfilt_BasicFilter filter,
float32_t  tau,
float32_t  initialValue 
)

Initialize a BasicFilter structure.

Parameters
filterpointer on the structure to initialize.
tauthe contribution of every new value. 0.0 (max filtering) to 1.0 (no filtering).
initialValueinitial value for the filter.

◆ bfilt_Step()

float32_t bfilt_Step ( bfilt_BasicFilter filter,
float32_t  newValue 
)

Step a BasicFilter structure.

Parameters
filterpointer on the structure to initialize.
newValuethe new value of the signal to filter.
Return values
thefiltered value.
Note
this implementation is very basic, and does not take the timestep (dt) into account.