Paparazzi UAS  v7.0_unstable
Paparazzi is a free software Unmanned Aircraft System.
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

◆ delayed_first_order_lowpass_filter_t

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

◆ DELAYED_FIRST_ORDER_LOWPASS_FILTER_BUFFER_SIZE

#define DELAYED_FIRST_ORDER_LOWPASS_FILTER_BUFFER_SIZE   20

Definition at line 32 of file delayed_first_order_lowpass_filter.h.

◆ DELAYED_FIRST_ORDER_LOWPASS_FILTER_FILTER_ALPHA_SHIFT

#define DELAYED_FIRST_ORDER_LOWPASS_FILTER_FILTER_ALPHA_SHIFT   14

Definition at line 33 of file delayed_first_order_lowpass_filter.h.

Function Documentation

◆ delayed_first_order_lowpass_initialize()

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 delay, DELAYED_FIRST_ORDER_LOWPASS_FILTER_BUFFER_SIZE, delayed_first_order_lowpass_set_delay(), delayed_first_order_lowpass_set_omega(), and f.

Referenced by stabilization_attitude_heli_indi_init().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ delayed_first_order_lowpass_propagate()

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_BUFFER_SIZE, DELAYED_FIRST_ORDER_LOWPASS_FILTER_FILTER_ALPHA_SHIFT, and f.

Referenced by indi_apply_actuator_models().

+ Here is the caller graph for this function:

◆ delayed_first_order_lowpass_set_delay()

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 delay, DELAYED_FIRST_ORDER_LOWPASS_FILTER_BUFFER_SIZE, and f.

Referenced by delayed_first_order_lowpass_initialize().

+ Here is the caller graph for this function:

◆ delayed_first_order_lowpass_set_omega()

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_FILTER_ALPHA_SHIFT, and f.

Referenced by delayed_first_order_lowpass_initialize().

+ Here is the caller graph for this function: