Formula Student Autonomous Systems
The code for the main driverless system
Loading...
Searching...
No Matches
LowPassFilter Class Reference

Low Pass Filter class. More...

#include <low_pass_filter.hpp>

Inheritance diagram for LowPassFilter:
Inheritance graph
Collaboration diagram for LowPassFilter:
Collaboration graph

Public Member Functions

 LowPassFilter (double alpha, double initial_value=0.0)
 Construct a new Low Pass Filter object.
 
double filter (double input) override
 Apply the low pass filter to a new input.
 
void reset (double value=0.0) override
 Reset the filter to a specific value.
 
- Public Member Functions inherited from Filter
virtual ~Filter ()=default
 Virtual destructor for safe polymorphic use.
 

Private Attributes

double alpha_
 Smoothing factor.
 
double prev_value_
 Previous filtered value.
 

Detailed Description

Low Pass Filter class.

This class implements a simple first-order low pass filter.

Definition at line 10 of file low_pass_filter.hpp.

Constructor & Destructor Documentation

◆ LowPassFilter()

LowPassFilter::LowPassFilter ( double  alpha,
double  initial_value = 0.0 
)

Construct a new Low Pass Filter object.

Parameters
alphaSmoothing factor (0 < alpha < 1)
initial_valueInitial filtered value

Definition at line 3 of file low_pass_filter.cpp.

Member Function Documentation

◆ filter()

double LowPassFilter::filter ( double  input)
overridevirtual

Apply the low pass filter to a new input.

Parameters
inputNew input value
Returns
Filtered value

Implements Filter.

Definition at line 6 of file low_pass_filter.cpp.

Here is the caller graph for this function:

◆ reset()

void LowPassFilter::reset ( double  value = 0.0)
overridevirtual

Reset the filter to a specific value.

Parameters
valueValue to reset the filter to

Implements Filter.

Definition at line 11 of file low_pass_filter.cpp.

Member Data Documentation

◆ alpha_

double LowPassFilter::alpha_
private

Smoothing factor.

Definition at line 12 of file low_pass_filter.hpp.

◆ prev_value_

double LowPassFilter::prev_value_
private

Previous filtered value.

Definition at line 13 of file low_pass_filter.hpp.


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