Paparazzi UAS  v5.2.2_stable-0-gd6b9f29
Paparazzi is a free software Unmanned Aircraft System.
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Modules Pages
low_pass_filter.h File Reference

Simple first order low pass filter with bilinear transform. More...

#include "std.h"
+ Include dependency graph for low_pass_filter.h:
+ This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Data Structures

struct  FirstOrderLowPass
 First order low pass filter structure. More...
 
struct  SecondOrderLowPass
 Second order low pass filter structure. More...
 
struct  SecondOrderLowPass_int
 
struct  Butterworth4LowPass
 Fourth order Butterworth low pass filter. More...
 
struct  Butterworth4LowPass_int
 Fourth order Butterworth low pass filter(fixed point version). More...
 

Macros

#define INT32_FILT_FRAC   8
 

Typedefs

typedef struct SecondOrderLowPass Butterworth2LowPass
 Second order Butterworth low pass filter. More...
 
typedef struct
SecondOrderLowPass_int 
Butterworth2LowPass_int
 Second order Butterworth low pass filter(fixed point version). More...
 

Functions

static void init_first_order_low_pass (struct FirstOrderLowPass *filter, float tau, float sample_time, float value)
 Init first order low pass filter. More...
 
static float update_first_order_low_pass (struct FirstOrderLowPass *filter, float value)
 Update first order low pass filter state with a new value. More...
 
static float get_first_order_low_pass (struct FirstOrderLowPass *filter)
 Get current value of the first order low pass filter. More...
 
static void init_second_order_low_pass (struct SecondOrderLowPass *filter, float tau, float Q, float sample_time, float value)
 Init second order low pass filter. More...
 
static float update_second_order_low_pass (struct SecondOrderLowPass *filter, float value)
 Update second order low pass filter state with a new value. More...
 
static float get_second_order_low_pass (struct SecondOrderLowPass *filter)
 Get current value of the second order low pass filter. More...
 
static void init_second_order_low_pass_int (struct SecondOrderLowPass_int *filter, float cut_off, float Q, float sample_time, int32_t value)
 Init second order low pass filter(fixed point version). More...
 
static int32_t update_second_order_low_pass_int (struct SecondOrderLowPass_int *filter, int32_t value)
 Update second order low pass filter state with a new value(fixed point version). More...
 
static int32_t get_second_order_low_pass_int (struct SecondOrderLowPass_int *filter)
 Get current value of the second order low pass filter(fixed point version). More...
 
static void init_butterworth_2_low_pass (Butterworth2LowPass *filter, float tau, float sample_time, float value)
 Init a second order Butterworth filter. More...
 
static float update_butterworth_2_low_pass (Butterworth2LowPass *filter, float value)
 Update second order Butterworth low pass filter state with a new value. More...
 
static float get_butterworth_2_low_pass (Butterworth2LowPass *filter)
 Get current value of the second order Butterworth low pass filter. More...
 
static void init_butterworth_2_low_pass_int (Butterworth2LowPass_int *filter, float cut_off, float sample_time, int32_t value)
 Init a second order Butterworth filter. More...
 
static int32_t update_butterworth_2_low_pass_int (Butterworth2LowPass_int *filter, int32_t value)
 Update second order Butterworth low pass filter state with a new value(fixed point version). More...
 
static int32_t get_butterworth_2_low_pass_int (Butterworth2LowPass_int *filter)
 Get current value of the second order Butterworth low pass filter(fixed point version). More...
 
static void init_butterworth_4_low_pass (Butterworth4LowPass *filter, float tau, float sample_time, float value)
 Init a fourth order Butterworth filter. More...
 
static float update_butterworth_4_low_pass (Butterworth4LowPass *filter, float value)
 Update fourth order Butterworth low pass filter state with a new value. More...
 
static float get_butterworth_4_low_pass (Butterworth4LowPass *filter)
 Get current value of the fourth order Butterworth low pass filter. More...
 
static void init_butterworth_4_low_pass_int (Butterworth4LowPass_int *filter, float cut_off, float sample_time, int32_t value)
 Init a fourth order Butterworth filter(fixed point version). More...
 
static int32_t update_butterworth_4_low_pass_int (Butterworth4LowPass_int *filter, int32_t value)
 Update fourth order Butterworth low pass filter state with a new value(fixed point version). More...
 
static int32_t get_butterworth_4_low_pass_int (Butterworth4LowPass_int *filter)
 Get current value of the fourth order Butterworth low pass filter(fixed point version). More...
 

Detailed Description

Simple first order low pass filter with bilinear transform.

Definition in file low_pass_filter.h.

Macro Definition Documentation

#define INT32_FILT_FRAC   8

Definition at line 32 of file low_pass_filter.h.

Referenced by init_second_order_low_pass_int().

Typedef Documentation

Second order Butterworth low pass filter.

Definition at line 239 of file low_pass_filter.h.

Second order Butterworth low pass filter(fixed point version).

Definition at line 278 of file low_pass_filter.h.

Function Documentation

static float get_butterworth_2_low_pass ( Butterworth2LowPass filter)
inlinestatic

Get current value of the second order Butterworth low pass filter.

Parameters
filtersecond order Butterworth low pass filter structure
Returns
current value of the filter

Definition at line 272 of file low_pass_filter.h.

References SecondOrderLowPass::o.

static int32_t get_butterworth_2_low_pass_int ( Butterworth2LowPass_int filter)
inlinestatic

Get current value of the second order Butterworth low pass filter(fixed point version).

Parameters
filtersecond order Butterworth low pass filter structure
Returns
current value of the filter

Definition at line 311 of file low_pass_filter.h.

References SecondOrderLowPass_int::o.

static float get_butterworth_4_low_pass ( Butterworth4LowPass filter)
inlinestatic

Get current value of the fourth order Butterworth low pass filter.

Parameters
filterfourth order Butterworth low pass filter structure
Returns
current value of the filter

Definition at line 360 of file low_pass_filter.h.

References Butterworth4LowPass::lp2, and SecondOrderLowPass::o.

static int32_t get_butterworth_4_low_pass_int ( Butterworth4LowPass_int filter)
inlinestatic

Get current value of the fourth order Butterworth low pass filter(fixed point version).

Parameters
filterfourth order Butterworth low pass filter structure
Returns
current value of the filter

Definition at line 409 of file low_pass_filter.h.

References Butterworth4LowPass_int::lp2, and SecondOrderLowPass_int::o.

static float get_first_order_low_pass ( struct FirstOrderLowPass filter)
inlinestatic

Get current value of the first order low pass filter.

Parameters
filterfirst order low pass filter structure
Returns
current value of the filter

Definition at line 80 of file low_pass_filter.h.

References FirstOrderLowPass::last_out.

static float get_second_order_low_pass ( struct SecondOrderLowPass filter)
inlinestatic

Get current value of the second order low pass filter.

Parameters
filtersecond order low pass filter structure
Returns
current value of the filter

Definition at line 167 of file low_pass_filter.h.

References SecondOrderLowPass::o.

static int32_t get_second_order_low_pass_int ( struct SecondOrderLowPass_int filter)
inlinestatic

Get current value of the second order low pass filter(fixed point version).

Parameters
filtersecond order low pass filter structure
Returns
current value of the filter

Definition at line 233 of file low_pass_filter.h.

References SecondOrderLowPass_int::o.

static void init_butterworth_2_low_pass ( Butterworth2LowPass filter,
float  tau,
float  sample_time,
float  value 
)
inlinestatic

Init a second order Butterworth filter.

based on the generic second order filter with Q = 0.7071 = 1/sqrt(2)

http://en.wikipedia.org/wiki/Butterworth_filter

Parameters
filtersecond order Butterworth low pass filter structure
tautime constant of the second order low pass filter
sample_timesampling period of the signal
valueinitial value of the filter

Definition at line 253 of file low_pass_filter.h.

References init_second_order_low_pass().

+ Here is the call graph for this function:

static void init_butterworth_2_low_pass_int ( Butterworth2LowPass_int filter,
float  cut_off,
float  sample_time,
int32_t  value 
)
inlinestatic

Init a second order Butterworth filter.

based on the generic second order filter with Q = 0.7071 = 1/sqrt(2)

http://en.wikipedia.org/wiki/Butterworth_filter

Parameters
filtersecond order Butterworth low pass filter structure
cut_offCutoff frequency of the filter with -3dB
sample_timesampling period of the signal
valueinitial value of the filter

Definition at line 292 of file low_pass_filter.h.

References init_second_order_low_pass_int().

Referenced by b2_hff_init().

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

static void init_butterworth_4_low_pass ( Butterworth4LowPass filter,
float  tau,
float  sample_time,
float  value 
)
inlinestatic

Init a fourth order Butterworth filter.

based on two generic second order filters with Q1 = 1.30651 and Q2 = 0.541184

http://en.wikipedia.org/wiki/Butterworth_filter

Parameters
filterfourth order Butterworth low pass filter structure
tautime constant of the fourth order low pass filter
sample_timesampling period of the signal
valueinitial value of the filter

Definition at line 337 of file low_pass_filter.h.

References init_second_order_low_pass(), Butterworth4LowPass::lp1, and Butterworth4LowPass::lp2.

+ Here is the call graph for this function:

static void init_butterworth_4_low_pass_int ( Butterworth4LowPass_int filter,
float  cut_off,
float  sample_time,
int32_t  value 
)
inlinestatic

Init a fourth order Butterworth filter(fixed point version).

based on two generic second order filters with Q1 = 1.30651 and Q2 = 0.541184

http://en.wikipedia.org/wiki/Butterworth_filter

Parameters
filterfourth order Butterworth low pass filter structure
cut_offCutoff frequency of the filter with -3dB
sample_timesampling period of the signal
valueinitial value of the filter

Definition at line 386 of file low_pass_filter.h.

References init_second_order_low_pass_int(), Butterworth4LowPass_int::lp1, and Butterworth4LowPass_int::lp2.

+ Here is the call graph for this function:

static void init_first_order_low_pass ( struct FirstOrderLowPass filter,
float  tau,
float  sample_time,
float  value 
)
inlinestatic

Init first order low pass filter.

Laplace transform in continious time: 1 H(s) = ------— 1 + tau*s

Parameters
filterfirst order low pass filter structure
tautime constant of the first order low pass filter
sample_timesampling period of the signal
valueinitial value of the filter

Definition at line 56 of file low_pass_filter.h.

References FirstOrderLowPass::last_in, FirstOrderLowPass::last_out, FirstOrderLowPass::time_const, and value.

static void init_second_order_low_pass ( struct SecondOrderLowPass filter,
float  tau,
float  Q,
float  sample_time,
float  value 
)
inlinestatic

Init second order low pass filter.

Parameters
filtersecond order low pass filter structure
tautime constant of the second order low pass filter
QQ value of the second order low pass filter
sample_timesampling period of the signal
valueinitial value of the filter

Definition at line 133 of file low_pass_filter.h.

References SecondOrderLowPass::a, SecondOrderLowPass::b, SecondOrderLowPass::i, SecondOrderLowPass::o, and value.

Referenced by init_butterworth_2_low_pass(), and init_butterworth_4_low_pass().

+ Here is the caller graph for this function:

static void init_second_order_low_pass_int ( struct SecondOrderLowPass_int filter,
float  cut_off,
float  Q,
float  sample_time,
int32_t  value 
)
inlinestatic

Init second order low pass filter(fixed point version).

Parameters
filtersecond order low pass filter structure
cut_offCutoff frequency of the filter with -3dB
QQ value of the second order low pass filter
sample_timesampling period of the signal
valueinitial value of the filter

Definition at line 187 of file low_pass_filter.h.

References SecondOrderLowPass::a, SecondOrderLowPass_int::a, SecondOrderLowPass::b, SecondOrderLowPass_int::b, BFP_OF_REAL, SecondOrderLowPass_int::i, INT32_FILT_FRAC, SecondOrderLowPass_int::loop_gain, SecondOrderLowPass_int::o, and value.

Referenced by init_butterworth_2_low_pass_int(), and init_butterworth_4_low_pass_int().

+ Here is the caller graph for this function:

static float update_butterworth_2_low_pass ( Butterworth2LowPass filter,
float  value 
)
inlinestatic

Update second order Butterworth low pass filter state with a new value.

Parameters
filtersecond order Butterworth low pass filter structure
valuenew input value of the filter
Returns
new filtered value

Definition at line 263 of file low_pass_filter.h.

References update_second_order_low_pass().

+ Here is the call graph for this function:

static int32_t update_butterworth_2_low_pass_int ( Butterworth2LowPass_int filter,
int32_t  value 
)
inlinestatic

Update second order Butterworth low pass filter state with a new value(fixed point version).

Parameters
filtersecond order Butterworth low pass filter structure
valuenew input value of the filter
Returns
new filtered value

Definition at line 302 of file low_pass_filter.h.

References update_second_order_low_pass_int().

Referenced by b2_hff_propagate().

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

static float update_butterworth_4_low_pass ( Butterworth4LowPass filter,
float  value 
)
inlinestatic

Update fourth order Butterworth low pass filter state with a new value.

using two cascaded second order filters

Parameters
filterfourth order Butterworth low pass filter structure
valuenew input value of the filter
Returns
new filtered value

Definition at line 350 of file low_pass_filter.h.

References Butterworth4LowPass::lp1, Butterworth4LowPass::lp2, and update_second_order_low_pass().

+ Here is the call graph for this function:

static int32_t update_butterworth_4_low_pass_int ( Butterworth4LowPass_int filter,
int32_t  value 
)
inlinestatic

Update fourth order Butterworth low pass filter state with a new value(fixed point version).

using two cascaded second order filters

Parameters
filterfourth order Butterworth low pass filter structure
valuenew input value of the filter
Returns
new filtered value

Definition at line 399 of file low_pass_filter.h.

References Butterworth4LowPass_int::lp1, Butterworth4LowPass_int::lp2, and update_second_order_low_pass_int().

+ Here is the call graph for this function:

static float update_first_order_low_pass ( struct FirstOrderLowPass filter,
float  value 
)
inlinestatic

Update first order low pass filter state with a new value.

Parameters
filterfirst order low pass filter structure
valuenew input value of the filter
Returns
new filtered value

Definition at line 68 of file low_pass_filter.h.

References FirstOrderLowPass::last_in, FirstOrderLowPass::last_out, FirstOrderLowPass::time_const, and value.

static float update_second_order_low_pass ( struct SecondOrderLowPass filter,
float  value 
)
inlinestatic

Update second order low pass filter state with a new value.

Parameters
filtersecond order low pass filter structure
valuenew input value of the filter
Returns
new filtered value

Definition at line 149 of file low_pass_filter.h.

References SecondOrderLowPass::a, SecondOrderLowPass::b, SecondOrderLowPass::i, SecondOrderLowPass::o, and value.

Referenced by update_butterworth_2_low_pass(), and update_butterworth_4_low_pass().

+ Here is the caller graph for this function:

static int32_t update_second_order_low_pass_int ( struct SecondOrderLowPass_int filter,
int32_t  value 
)
inlinestatic

Update second order low pass filter state with a new value(fixed point version).

Parameters
filtersecond order low pass filter structure
valuenew input value of the filter
Returns
new filtered value

Definition at line 214 of file low_pass_filter.h.

References SecondOrderLowPass_int::a, SecondOrderLowPass_int::b, SecondOrderLowPass_int::i, SecondOrderLowPass_int::loop_gain, SecondOrderLowPass_int::o, and value.

Referenced by update_butterworth_2_low_pass_int(), and update_butterworth_4_low_pass_int().

+ Here is the caller graph for this function: