Paparazzi UAS  v7.0_unstable
Paparazzi is a free software Unmanned Aircraft System.
notch_filter_float.h File Reference
#include "std.h"
+ Include dependency graph for notch_filter_float.h:
+ This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Data Structures

struct  SecondOrderNotchFilter
 

Functions

static void notch_filter_set_sampling_frequency (struct SecondOrderNotchFilter *filter, uint16_t frequency)
 Set sampling frequency of the notch filter. More...
 
static void notch_filter_set_bandwidth (struct SecondOrderNotchFilter *filter, float bandwidth)
 Set bandwidth of the notch filter. More...
 
static void notch_filter_set_filter_frequency (struct SecondOrderNotchFilter *filter, float frequency)
 Set notch filter frequency in Hz. More...
 
static void notch_filter_update (struct SecondOrderNotchFilter *filter, float *input_signal, float *output_signal)
 Notch filter propagate. More...
 
static float notch_filter_get_output (struct SecondOrderNotchFilter *filter)
 Get notch filter output. More...
 
static void notch_filter_init (struct SecondOrderNotchFilter *filter, float cutoff_frequency, float bandwidth, uint16_t sample_frequency)
 Initialize second order notch filter. More...
 

Data Structure Documentation

◆ SecondOrderNotchFilter

struct SecondOrderNotchFilter

Definition at line 32 of file notch_filter.h.

Data Fields
float costheta
float d2
float Ts
int32_t xn1
float xn1
int32_t xn2
float xn2
int32_t yn1
float yn1
int32_t yn2
float yn2

Function Documentation

◆ notch_filter_get_output()

static float notch_filter_get_output ( struct SecondOrderNotchFilter filter)
inlinestatic

Get notch filter output.

Parameters
filterSecondOrderNotchFilter data
Returns
Laterst filtered value

Definition at line 104 of file notch_filter_float.h.

References SecondOrderNotchFilter::yn1.

◆ notch_filter_init()

static void notch_filter_init ( struct SecondOrderNotchFilter filter,
float  cutoff_frequency,
float  bandwidth,
uint16_t  sample_frequency 
)
inlinestatic

Initialize second order notch filter.

Discrete implementation: y[n] = b * y[n-1] - d^2 * y[n-2] + a * x[n] - b * x[n-1] + a * x[n-2]

Parameters
filterSecondOrderNotchFilter data
cutoff_frequencyfrequency to attenuate [Hz]
bandwidthbandwidth of the filter [Hz]
sample_frequencyfrequency at which the filter is updated

Definition at line 121 of file notch_filter_float.h.

References notch_filter_set_bandwidth(), notch_filter_set_filter_frequency(), notch_filter_set_sampling_frequency(), SecondOrderNotchFilter::xn1, SecondOrderNotchFilter::xn2, SecondOrderNotchFilter::yn1, and SecondOrderNotchFilter::yn2.

+ Here is the call graph for this function:

◆ notch_filter_set_bandwidth()

static void notch_filter_set_bandwidth ( struct SecondOrderNotchFilter filter,
float  bandwidth 
)
inlinestatic

Set bandwidth of the notch filter.

Parameters
filterSecondOrderNotchFilter data
bandwidthbandwidth of the filter [Hz]

Definition at line 57 of file notch_filter_float.h.

References SecondOrderNotchFilter::d2, and SecondOrderNotchFilter::Ts.

Referenced by notch_filter_init().

+ Here is the caller graph for this function:

◆ notch_filter_set_filter_frequency()

static void notch_filter_set_filter_frequency ( struct SecondOrderNotchFilter filter,
float  frequency 
)
inlinestatic

Set notch filter frequency in Hz.

Parameters
filterSecondOrderNotchFilter data
frequencyto attenuate [Hz]

Definition at line 68 of file notch_filter_float.h.

References SecondOrderNotchFilter::costheta, and SecondOrderNotchFilter::Ts.

Referenced by notch_filter_init().

+ Here is the caller graph for this function:

◆ notch_filter_set_sampling_frequency()

static void notch_filter_set_sampling_frequency ( struct SecondOrderNotchFilter filter,
uint16_t  frequency 
)
inlinestatic

Set sampling frequency of the notch filter.

Parameters
filterSecondOrderNotchFilter data
frequencyfrequency at which the filter is updated

Definition at line 47 of file notch_filter_float.h.

References SecondOrderNotchFilter::Ts.

Referenced by notch_filter_init().

+ Here is the caller graph for this function:

◆ notch_filter_update()

static void notch_filter_update ( struct SecondOrderNotchFilter filter,
float *  input_signal,
float *  output_signal 
)
inlinestatic

Notch filter propagate.

Discrete implementation: y[n] = b * y[n-1] - d^2 * y[n-2] + a * x[n] - b * x[n-1] + a * x[n-2]

Parameters
filterSecondOrderNotchFilter data
input_signalinput x[n]
output_signaloutput y[n]

Definition at line 83 of file notch_filter_float.h.

References b, SecondOrderNotchFilter::costheta, SecondOrderNotchFilter::d2, SecondOrderNotchFilter::xn1, SecondOrderNotchFilter::xn2, SecondOrderNotchFilter::yn1, and SecondOrderNotchFilter::yn2.