Commit Graph

156 Commits

Author SHA1 Message Date
Andy Piper 476713f9e3 Filter: set output slew rate to zero when max is zero. 2021-11-29 19:02:57 +09:00
Andrew Tridgell cd1f5ca494 Filter: use CLASS_NO_COPY 2021-06-08 11:14:52 +10:00
Andy Piper 21d24ebc9d Filter: add harmonic notch option to run at loop rate 2021-05-19 17:35:16 +10:00
Paul Riseborough b969a43074 Filter: Slewlimiter use different filtering for external reporting 2021-04-15 06:57:16 +10:00
Paul Riseborough dd446433f7 Filter: Adjust SlewLimiter tuning 2021-04-15 06:57:16 +10:00
Paul Riseborough 6e6df3df58 Filter: Increase gain modifier action 2021-04-15 06:57:16 +10:00
Paul Riseborough 458c46353d Filter: remove unnecessary fmaxf 2021-04-15 06:57:16 +10:00
Paul Riseborough cb4a770d38 Filter: Reduce spikes in oscillation slew rate metric 2021-04-15 06:57:16 +10:00
Paul Riseborough fdfdb118b9 Filter: Improve SlewLimiter oscillation detection 2021-04-15 06:57:16 +10:00
Paul Riseborough 4622e33255 Filter: Use positive and negative direction changes for slew limiting 2021-04-15 06:57:16 +10:00
Andrew Tridgell 59a805a740 Filter: expose slew rate in slew limiter 2021-04-15 06:57:16 +10:00
Andrew Tridgell 6cae97446a Filter: added auto-init to LowPassFilter
make sure initial filter returns are not a long way off if filtered
input is far from zero
2021-04-15 06:57:16 +10:00
Andrew Tridgell 5ef31a1801 Filter: moved ModeFilter to C++
save flash space for common code
2021-04-15 06:57:16 +10:00
Andrew Tridgell 6144136b61 Filter: fixed reset of filters to first value
the delay elements were set incorrectly
2021-02-05 15:01:22 +11:00
Peter Barker f847758272 Filter: add gtest suite 2021-02-04 20:50:48 +11:00
Andrew Tridgell cf47c19c0d Filter: fixed low pass 2p filter to auto-init
this prevents the init to zero for temperature filters
2021-01-21 13:09:21 +11:00
Andrew Tridgell 4495414d05 Filter: added reset with value to LowPassFilter2p 2021-01-21 13:09:21 +11:00
Andy Piper c291107f50 Filter: correct grammar on HNTCH docs 2020-11-24 10:17:16 +09:00
Andy Piper 726307cb31 Filter: correct harmonic notch docs and provide better defaults. 2020-11-24 10:17:16 +09:00
Andrew Tridgell b0f0c8d842 Filter: use calc_lowpass_alpha_dt() 2020-11-10 16:15:45 +11:00
Andrew Tridgell 709e1f8f93 Filter: added slew rate filter 2020-10-25 10:32:48 +11:00
Andy Piper a93821110e Filter: return active harmonics based on dynamic harmonic enablement 2020-07-14 09:50:06 +10:00
Andy Piper 71f99542a8 Filter: allow harmonic notch center frequencies to be updated individually 2020-06-21 19:09:35 +10:00
Andrew Tridgell bd07e8516f Filter: use GCS_SEND_TEXT() 2020-04-29 07:36:55 +10:00
Andy Piper 8407648316 Filter: make sure the center frequency can never be zero 2020-04-28 09:32:02 +10:00
Andy Piper 1dbde3af09 Filter: add support for double harmonic notches to more effectively target wider noise peaks 2020-04-28 09:32:02 +10:00
Andy Piper 4c1816a983 Copter: port betaflight in-flight fft analysis to arducopter and expose as a log message
add harmonic notch tracking mode
call AP_GyroFFT::update_freq_hover() from update_throttle_hover()
move gyrofft configuration and control to AP_Vehicle
move fft logging to fft library
2020-02-22 11:15:37 +11:00
Andy Piper 6f5b991f28 Filter: add harmonic notch dynamic tracking mode
move definition of HNF_MAX_HARMONICS
2020-02-22 11:15:37 +11:00
Andrew Tridgell f6c3c73037 Filter: switch harmomic notch mode to enum class 2019-11-19 07:08:01 +08:00
Andy Piper 22111f59e8 Filter: add harmonic notch dynamic tracking mode
update harmonic notch REF docs
2019-10-31 11:18:40 +08:00
Andy Piper ef7f8531fb Filter: set the harmonic notch filter ref default to zero (disabled)
Modify parameter descriptions for tradheli
2019-10-10 20:26:02 +09:00
Leonard Hall 6f3be90147 Filter: Alter Notch filter formula to remove /0 and allow perfect notch.
This formulation of the notch equations lets the user specify the depth of the Notch. The presence of a diveide by A prevents the gain going to zero and therefore achieving a perfect notch. It also provides the risk that a user may attempt to do this and cause a divide by zero error. This change adds the ability to achive a perfect notch and removes the possibility of a divide by zero.

Add Notch Filter parameter checking
2019-09-11 18:41:05 +10:00
Andy Piper 9b9fb0d593 Filter: sanity check the harmonic notch sample rate on initialization. do not allow harmonics to go above the nyquist frequency 2019-09-11 18:41:05 +10:00
Andy Piper bc5916ebc9 Filter: comment on reserved config. cope with notch allocation failure. 2019-09-11 18:41:05 +10:00
Andy Piper 334ebadd5a Filter: add comments and address review comments for harmonic notch 2019-09-11 18:41:05 +10:00
Andy Piper 366bc06089 Filter: New HarmonicNotchFilter
This delegates updates to a bank of NotchFilters located at an rpm frequency and harmonics. Center frequency can be updated dynamically. Notch parameters are configurable, including the number of harmonics to filter on. Updates to the filter parameters are optimized across the notch bank. Convert notch bandwidth and frequency to floats.

allow all filter harmonics to be controlled.

add destructor to harmonic notch.

don't allocate sub-filters for harmonic notch if no harmonics set.
2019-09-11 18:41:05 +10:00
Andy Piper 52e4676564 Filter: Allow all filter frequencies to be 16bit. 2019-06-06 17:09:17 +10:00
Andy Piper 1a8475cf9f Filter: Decouple notch filter configuration from the filter itself.
Allow multiple notch filters to be instantiated using the same configuration.
2019-06-06 17:09:17 +10:00
Peter Barker 30749b92d9 Filter: add missing override keyword 2019-02-20 19:23:54 +11:00
Peter Barker deb25ed9a9 Filter: remove keywords.txt 2019-02-17 00:29:38 -08:00
Andrew Tridgell 6c09b268d8 Filter: fixed crash on zero cutoff frequency
this fixes #10435
2019-02-08 13:54:54 +11:00
Peter Barker 1056321457 Filter: add override keyword 2018-11-08 11:30:12 +11:00
Andrew Tridgell 50dcca39bd Filter: added a notch filter
maths from Leonard
2017-08-29 13:52:29 +10:00
Pierre Kancir 892a999ba5 Filter: example fix travis warning
missing function declaration
implicit cast
some style fix
2017-04-13 19:56:16 +01:00
Andrew Tridgell b165e025d9 Filter: added new constructor for 1p filter
allow both sample rate and cutoff to be specified in constructor
2016-11-25 17:49:57 +11:00
Andrew Tridgell f94e4b4375 Filter: allow 1P LowPassFilter to work without alpha recalc per sample
this makes the 1P filter optionally syntax compatible with the 2P
filter and much more CPU efficient.
2016-11-10 11:43:29 +11:00
Mathieu OTHACEHE 152edf7189 Global: remove mode line from headers
Using a global .dir-locals.el file is a better alternative than
reincluding the same emacs header in every file of the project.
2016-10-24 09:42:01 -02:00
Lucas De Marchi ae53920e5b build: don't build examples with old build system
We currently check examples are buildable with waf which doesn't need
the libraries to be specified in a make.inc file.  Having the makefiles
there is misleading since people try to build and realize the build is
broken.
2016-10-11 13:03:08 +11:00
Lucas De Marchi 18f1f8bea8 Filter: add AverageFilter variant to save current sum
When the the variable in which we are saving the current sum is of
integral type we can use a much more optimized apply() method: instead
of looping the entire number of samples adding them up, we always keep
the current sum in a member.  It also allows the caller to decide the
type it wants to use to get the average: this may be dictated by another
interface it uses or it may want to avoid the implicit truncate in the
return of apply().
2016-05-10 14:24:59 -03:00
Ricardo de Almeida Gonzaga 5bd034a5a8 Global: start using cmath instead of math.h 2016-04-05 21:06:19 -07:00