mirror of
https://github.com/PX4/PX4-Autopilot.git
synced 2026-05-30 12:50:37 +08:00
LPF: add sample frequency getter
This commit is contained in:
@@ -43,6 +43,7 @@ namespace math
|
|||||||
void LowPassFilter2pVector3f::set_cutoff_frequency(float sample_freq, float cutoff_freq)
|
void LowPassFilter2pVector3f::set_cutoff_frequency(float sample_freq, float cutoff_freq)
|
||||||
{
|
{
|
||||||
_cutoff_freq = cutoff_freq;
|
_cutoff_freq = cutoff_freq;
|
||||||
|
_sample_freq = sample_freq;
|
||||||
|
|
||||||
// reset delay elements on filter change
|
// reset delay elements on filter change
|
||||||
_delay_element_1.zero();
|
_delay_element_1.zero();
|
||||||
|
|||||||
@@ -74,12 +74,16 @@ public:
|
|||||||
// Return the cutoff frequency
|
// Return the cutoff frequency
|
||||||
float get_cutoff_freq() const { return _cutoff_freq; }
|
float get_cutoff_freq() const { return _cutoff_freq; }
|
||||||
|
|
||||||
|
// Return the sample frequency
|
||||||
|
float get_sample_freq() const { return _sample_freq; }
|
||||||
|
|
||||||
// Reset the filter state to this value
|
// Reset the filter state to this value
|
||||||
matrix::Vector3f reset(const matrix::Vector3f &sample);
|
matrix::Vector3f reset(const matrix::Vector3f &sample);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
||||||
float _cutoff_freq{0.0f};
|
float _cutoff_freq{0.0f};
|
||||||
|
float _sample_freq{0.0f};
|
||||||
|
|
||||||
float _a1{0.0f};
|
float _a1{0.0f};
|
||||||
float _a2{0.0f};
|
float _a2{0.0f};
|
||||||
|
|||||||
Reference in New Issue
Block a user