32 #ifndef ONE_EURO_FILTER_H
33 #define ONE_EURO_FILTER_H
115 float tau = 1.0f / (2.f * M_PI * cutoff);
116 float te = 1.0f / filter->
rate;
117 return 1.0f / (1.0f + tau / te);
134 float cutoff = filter->
mincutoff + filter->
beta * fabsf(edx);
145 filter->
rate = 1e6f / (float)(timestamp - filter->
last_time);
float dcutoff
derivative cutoff freq (in Hz)
static float update_1e_filter(struct OneEuroFilter *filter, float x)
Filter a float using the given One Euro Filter.
float mincutoff
min cutoff freq (in Hz)
float rate
data update rate (in Hz)
static float compute_1e_filter_alpha(struct OneEuroFilter *filter, float cutoff)
Compute Alpha for a given One Euro Filter and a given cutoff frequency.
struct OneEuroLPFilter dxfilt
low pass filter for derivative
bool first_time
first time flag
static float update_1e_filter_at_time(struct OneEuroFilter *filter, float x, uint32_t timestamp)
Filter a float using the given One Euro Filter and the given timestamp.
uint32_t last_time
last update time in ms
static void init_1e_filter(struct OneEuroFilter *filter, float rate, float mincutoff, float beta, float dcutoff)
Initialize a 1 Euro Filter instance.
static void reset_1e_filter(struct OneEuroFilter *filter)
Reset filter (gains and parameters unchanged)
struct OneEuroLPFilter xfilt
low pass filter
configuration parameters.
static float compute_1e_filter_lp(struct OneEuroLPFilter *filter, float x, float alpha)
Filter a float using the given low-pass filter and the given alpha value.