SoftFilters  0.1.0
Arduino framework and library of software data filters.
DifferentialFilter< VAL_T, TS_T, INTERNAL_T > Class Template Reference

A differential filter calculates the speed and acceleration from its raw scalar input. More...

#include <SoftFilters.h>

Inheritance diagram for DifferentialFilter< VAL_T, TS_T, INTERNAL_T >:
Collaboration diagram for DifferentialFilter< VAL_T, TS_T, INTERNAL_T >:

Public Types

typedef Reading< VAL_T, TS_T > IN_T
 
typedef Reading< Differential< VAL_T >, TS_T > OUT_T
 

Protected Member Functions

virtual bool update (void const *const input) override
 Internally update the filter output based on the given input. More...
 
- Protected Member Functions inherited from BaseFilter< Reading< VAL_T, TS_T >, Reading< Differential< VAL_T >, TS_T > >
virtual void const *const get_output_val_ptr () final
 Push a new data through the filter. More...
 
virtual void copy_to_client (void *const output) final
 Copy the output to client memory.
 

Private Attributes

INTERNAL_T bef_spd
 
INTERNAL_T bef_ts
 
INTERNAL_T aft_spd
 
INTERNAL_T aft_ts
 
VAL_T next_pos
 
TS_T next_ts
 
bool seen_first
 
bool seen_second
 
IN_T const * in_ptr
 

Additional Inherited Members

- Public Member Functions inherited from Filter
bool push (void const *const input, void *const output)
 Push a new data through the filter. More...
 
- Protected Attributes inherited from BaseFilter< Reading< VAL_T, TS_T >, Reading< Differential< VAL_T >, TS_T > >
Reading< Differential< VAL_T >, TS_T > out_val
 Internally managed storage of the output value.
 

Detailed Description

template<typename VAL_T, typename TS_T = unsigned long, typename INTERNAL_T = double>
class DifferentialFilter< VAL_T, TS_T, INTERNAL_T >

A differential filter calculates the speed and acceleration from its raw scalar input.

Time chart of a data structure to support second and third order (speed & acceleration):

+-- previous
| +-- before
| | +-- (current)
| | | +-- after
| | | | +-- next
| | | | |
pos * | * | *
\|/|\|/ spd = d_pos / d_t
spd *-+-* interpolate two speeds to get the current speed
\|/ acc = d_spd / d_t
acc *

Member Function Documentation

◆ update()

template<typename VAL_T , typename TS_T = unsigned long, typename INTERNAL_T = double>
virtual bool DifferentialFilter< VAL_T, TS_T, INTERNAL_T >::update ( void const *const  input)
inlineoverrideprotectedvirtual

Internally update the filter output based on the given input.

This method behaves similarly to the public Filter::push method, but without copying the output to the client memory. This method is for internal workings of the filter framework.

Implements Filter.


The documentation for this class was generated from the following file: