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

First order low-pass filter with delay. More...

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

Go to the source code of this file.

Data Structures

struct  delayed_first_order_lowpass_filter_t
 

Macros

#define DELAYED_FIRST_ORDER_LOWPASS_FILTER_BUFFER_SIZE   20
 
#define DELAYED_FIRST_ORDER_LOWPASS_FILTER_FILTER_ALPHA_SHIFT   14
 

Functions

static int32_t delayed_first_order_lowpass_propagate (struct delayed_first_order_lowpass_filter_t *f, int32_t input)
 delayed_first_order_lowpass_propagate More...
 
static void delayed_first_order_lowpass_set_omega (struct delayed_first_order_lowpass_filter_t *f, uint32_t omega)
 delayed_first_order_lowpass_set_omega More...
 
static void delayed_first_order_lowpass_set_delay (struct delayed_first_order_lowpass_filter_t *f, uint8_t delay)
 delayed_first_order_lowpass_set_delay More...
 
static void delayed_first_order_lowpass_initialize (struct delayed_first_order_lowpass_filter_t *f, uint32_t omega, uint8_t delay, uint16_t max_inc, uint16_t sample_frequency)
 delayed_first_order_lowpass_initialize More...
 

Detailed Description

First order low-pass filter with delay.

Definition in file delayed_first_order_lowpass_filter.h.


Data Structure Documentation

struct delayed_first_order_lowpass_filter_t

Definition at line 35 of file delayed_first_order_lowpass_filter.h.

Data Fields
int32_t alpha
int32_t buffer[DELAYED_FIRST_ORDER_LOWPASS_FILTER_BUFFER_SIZE]
uint8_t delay
uint8_t idx
uint16_t max_inc
uint32_t omega
uint16_t sample_frequency

Macro Definition Documentation

#define DELAYED_FIRST_ORDER_LOWPASS_FILTER_BUFFER_SIZE   20
#define DELAYED_FIRST_ORDER_LOWPASS_FILTER_FILTER_ALPHA_SHIFT   14

Function Documentation

static void delayed_first_order_lowpass_initialize ( struct delayed_first_order_lowpass_filter_t f,
uint32_t  omega,
uint8_t  delay,
uint16_t  max_inc,
uint16_t  sample_frequency 
)
inlinestatic

delayed_first_order_lowpass_initialize

Parameters
fReference to the filter.
omegaFilter bandwidth in [rad/s], only positive integer values.
delayNumber of timesteps delay in the signal. Maximum defined by buffer size.
sample_frequencyFrequency at which the filter is going to be updated.

Initializes the filter, should be done before using it.

Definition at line 120 of file delayed_first_order_lowpass_filter.h.

References delayed_first_order_lowpass_filter_t::buffer, DELAYED_FIRST_ORDER_LOWPASS_FILTER_BUFFER_SIZE, delayed_first_order_lowpass_set_delay(), delayed_first_order_lowpass_set_omega(), delayed_first_order_lowpass_filter_t::idx, delayed_first_order_lowpass_filter_t::max_inc, and delayed_first_order_lowpass_filter_t::sample_frequency.

Referenced by stabilization_attitude_init().

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

static int32_t delayed_first_order_lowpass_propagate ( struct delayed_first_order_lowpass_filter_t f,
int32_t  input 
)
inlinestatic

delayed_first_order_lowpass_propagate

Parameters
fReference to the filter.
inputValue that needs to be filtered.
Returns
alpha*previous + (1 - alpha)*input

The actual low-pass filter with delay. Delay is accomplished by internal buffer.

Definition at line 54 of file delayed_first_order_lowpass_filter.h.

References delayed_first_order_lowpass_filter_t::alpha, delayed_first_order_lowpass_filter_t::buffer, delayed_first_order_lowpass_filter_t::delay, DELAYED_FIRST_ORDER_LOWPASS_FILTER_BUFFER_SIZE, DELAYED_FIRST_ORDER_LOWPASS_FILTER_FILTER_ALPHA_SHIFT, delayed_first_order_lowpass_filter_t::idx, and delayed_first_order_lowpass_filter_t::max_inc.

Referenced by indi_apply_actuator_models().

+ Here is the caller graph for this function:

static void delayed_first_order_lowpass_set_delay ( struct delayed_first_order_lowpass_filter_t f,
uint8_t  delay 
)
inlinestatic

delayed_first_order_lowpass_set_delay

Parameters
fReference to the filter.
delayNumber of timesteps delay in the signal. Maximum defined by buffer size.

Function to change the number of timesteps delay. This can be done during run-time. It basically changes the offset to the buffer value which is returned on a propagation.

Definition at line 101 of file delayed_first_order_lowpass_filter.h.

References delayed_first_order_lowpass_filter_t::delay, and DELAYED_FIRST_ORDER_LOWPASS_FILTER_BUFFER_SIZE.

Referenced by delayed_first_order_lowpass_initialize().

+ Here is the caller graph for this function:

static void delayed_first_order_lowpass_set_omega ( struct delayed_first_order_lowpass_filter_t f,
uint32_t  omega 
)
inlinestatic

delayed_first_order_lowpass_set_omega

Parameters
fReference to the filter.
omegaFilter bandwidth in [rad/s], only positive integer values.

Function to change the bandwidth of the filter, can be done in run-time.

Definition at line 84 of file delayed_first_order_lowpass_filter.h.

References delayed_first_order_lowpass_filter_t::alpha, DELAYED_FIRST_ORDER_LOWPASS_FILTER_FILTER_ALPHA_SHIFT, delayed_first_order_lowpass_filter_t::omega, and delayed_first_order_lowpass_filter_t::sample_frequency.

Referenced by delayed_first_order_lowpass_initialize().

+ Here is the caller graph for this function: