Commit Graph

218 Commits

Author SHA1 Message Date
Iampete1 8f2b2cfe31 Filter: HarmonicNotchFilter: convert harmonics as a bitmask 2024-04-17 22:15:22 +01:00
Henry Wurzburg b69b2324e6 Filter:correct vehicles which can use throttle based notches 2024-04-08 23:11:03 +01:00
Andrew Tridgell 148c176a59 Filter: use a define for nyquist cutoff 2024-03-16 06:54:27 +11:00
Andrew Tridgell 90c8359ff6 Filter: log up to 6 harmonics 2024-03-16 06:54:27 +11:00
Andrew Tridgell fd1a260d46 Filter: added logging of notch centers and 1st harmonic
log up to 5 sources in new FCN message, or FCNS for single source
2024-03-16 06:54:27 +11:00
Andrew Tridgell 2286f2ce27 Filter: added test for attenuation adjustment 2024-03-16 06:54:27 +11:00
Andrew Tridgell 8b9fe4d21d Filter: adjust attenuation properly at low frequencies
use sqrt() adjustment from Leonard
2024-03-16 06:54:27 +11:00
Andrew Tridgell ae75ea94eb Filter: fixed filter expansion for other than motors based RPM sources
this also fixes the uint8_t storage of a number than can be greater
than 256. Max total notches in a single HarmonicNotchFilter is
currently 12*16*3 for 12 ESCs, with INS_HNTCH_HMNCS=0xFFFF and triple
notch
2024-03-16 06:54:27 +11:00
Andrew Tridgell 304890fc7d Filter: fixed test suite
fill in a parameters structure
2024-03-16 06:54:27 +11:00
Andrew Tridgell 72d235a8a8 Filter: rework harmonic notch
do all frequenct clamping in one place in
set_center_frequency(). Allow for zero frequency to disable the
notch. Add an option to treat inactive RPM source as min frequency
2024-03-16 06:54:27 +11:00
Andrew Tridgell 0d932e8a54 Filter: fixed uint8_t bug in total filters and expand_filter_count bug
this gets the right number of notches on quadplanes, but is still very
bad in fwd flight
2023-11-28 18:05:37 +11:00
Andrew Tridgell 002f1076d7 Filter: added optional notch debug logging
this has helped find multiple bugs
2023-11-28 18:05:37 +11:00
Andy Piper a61fc423f0 Filter: allow zero centre frequency to passthrough and disable notch 2023-11-28 18:05:37 +11:00
Peter Barker 8eb5baa4ae Filter: correct AP_Filter defines
- checking the build type is very rarely used and definitely not required here
 - fix boilerplate to conform to normal pattern of including the config header and #if'ing based on the _ENABLED directly after that
2023-11-21 21:13:42 +11:00
Andy Piper e729c8ccfa Filter: add AP_Filter support
enable filters with AP_FILTER_ENABLED
allow filters to be compiled out
add dynamic updates, remove load/save and enable
2023-11-21 13:26:23 +11:00
Andy Piper 6a40843a9e Filter: provide accessors for center and sample frequencies on NotchFilter 2023-11-21 13:26:23 +11:00
Andrew Tridgell b79e96ab57 Filter: protect against extremely low notch filter frequencies
an incorrectly configured ESC telemetry source can lead to a notch
running at very low frequencies. A simple example is a lua script like
this:

function update()
   esc_telem:update_rpm(12, 0, 0)
   return update, 10
end
return update()

where motor 12 is unused.

with that script in place we get a 1.0078 Hz filter which leads to
massive phase lag and a crashed aircraft

this is a safety protection. We should also try to find out why the
INS_HNTCH_FREQ lower limit is not working
2023-11-03 08:08:31 +11:00
Iampete1 3c6ddda5e8 Flter: notchfilter: remove unneeded value and pre-multiply for speed 2023-10-17 10:03:43 +11:00
Iampete1 d8e18a0fc7 Filter: LowPassFilter2p: constrain cuttoff to 40% of sample rate 2023-10-10 08:26:05 +09:00
Iampete1 b68ece1007 Filter: HarmonicNotch: convert harmonics to int32 param 2023-10-10 08:07:16 +09:00
Andy Piper f726ca1809 Filter: fix notch filter test. 2023-08-02 16:22:59 +01:00
Randy Mackay 07ecbd18ec Filter: add SlewCalculator2D 2023-08-01 09:16:17 +10:00
Randy Mackay f91cda7b6e Filter: SlewLimiter definitions moved to cpp 2023-08-01 09:16:17 +10:00
Andy Piper 0b20328756 Filter: fix notch filter test. 2023-07-18 11:06:02 +10:00
Iampete1 f77635a5a6 Filter: Examples: Add Transfer function check and MATLAB 2023-05-23 10:31:13 +10:00
Iampete1 4406570391 Filter: NotchFilter: private varables to protected 2023-05-23 10:31:13 +10:00
Peter Barker ae349b6d40 Filter: correct description of filter tracking mode 2023-05-17 12:24:01 +10:00
Iampete1 e613a2d812 Filter: examples: add SlewLimiter example to test functionality 2023-05-02 09:36:03 +10:00
Iampete1 8a4b30ec3f Filter: SlewLimiter: always caculate slew limit 2023-05-02 09:36:03 +10:00
Iampete1 8bd374d835 Filter: HarmonicNotch: update FREQ description 2023-03-15 18:53:55 +11:00
Randy Mackay e4d60347fb Filter: implement 3 element mode filter 2023-03-01 18:22:22 +11:00
Andy Piper 1e003871b0 Filter: save freq_min_ratio when saving parameters 2023-01-31 10:58:12 +11:00
Andy Piper 500f59d839 Filter: allow freq_min_ratio to be set on harmonic notch filter
allow harmonics to be set
2023-01-24 10:56:33 +11:00
Leonard Hall f0822e5121 Filter: Support changing update period 2022-12-13 17:10:06 +11:00
Andrew Tridgell 02c06167c1 Filter: allow for expansion of dynamic filters
this allows for the number of dynamic filters on a harmonic notch
filter to expand at runtime, which allows for ESC RPMs to be populated
from other than AP_Motors, such as with lua scripts or for fwd motors
in a SLT quadplane
2022-10-16 20:38:19 +11:00
Andy Piper 1fe7fb8f35 Filter: optimize notch filter frequency updates when the requested frequency has not changed 2022-09-22 11:48:28 +10:00
Andy Piper b8f01323ec Filter: constrain harmonic notch center frequency changes to be within a slew limit
raise notch filter slew for smaller aircraft
ensure NotchFilter init() resets the center frequency
2022-09-21 17:41:38 +10:00
Andrew Tridgell 4ed55d9e21 Filter: fixed out of bound access in ModeFilter 2022-09-06 10:49:50 +10:00
Iampete1 338779d27d Filter: params always use set method 2022-08-03 13:43:48 +01:00
Andrew Tridgell 0103776d83 Filter: fixed test_notchfilter for the change in allocate_filters()
changed for triple notch
2022-07-10 06:57:29 +10:00
Andy Piper dfba938e63 Filter: add triple harmonic notches 2022-07-03 18:21:41 +10:00
Andrew Tridgell eefc41fe30 Filter: added a way to plot attenuation and phase lag for complex filters 2022-06-30 20:58:37 +10:00
Andrew Tridgell 366aa7154c Filter: added FM_RAT for throttle notch frequency ratio
allow for configurable min frequency ratio for throttle based notches
2022-06-30 20:58:37 +10:00
Andrew Tridgell 7928fa6e69 Filter: added a NotchFilter test suite 2022-06-12 15:39:44 +10:00
Andrew Tridgell 7c782dda88 Filter: fixed ordering of samples in notch reset 2022-06-12 15:39:44 +10:00
Andrew Tridgell d07761cfd9 Filter: fixed reset of notch filters
when we reset a notch we need to init the stored values to the current
value, rather than assuming that zero is the right value

this matters when switching IMUs in flight when we are only running
notch filters on the active gyro
2022-06-12 15:39:44 +10:00
Andrew Tridgell 9e3a29bf86 Filter: added EnableOnAllIMUs option to harmonic notch filter 2022-06-12 15:39:44 +10:00
Dr.-Ing. Amilcar do Carmo Lucas d3eae308da Filter: NFC spell corrections in comments 2022-06-11 08:43:03 +09:00
Andy Piper 39d928aa49 Filter: add mutators for notch filter parameters 2022-05-04 17:05:51 +10:00
Peter Barker c3cd733f26 Filter: tidy includes 2022-05-03 09:14:58 +10:00