Commit Graph

25 Commits

Author SHA1 Message Date
Andy Piper 6f1d0a4e72 AP_GyroFFT: make sure the parameters are updated at least once on startup 2022-06-17 14:07:00 +10:00
Andrew Tridgell c06f69e77d AP_GyroFFT: added defaults for FFT with no notch
allow for testing with FFT enabled, and defaulting number of
frequencies to look for
2022-06-17 14:07:00 +10:00
Andrew Tridgell a6dd296cc8 AP_GyroFFT: skip disabled notches 2022-06-17 14:07:00 +10:00
Andrew Tridgell 66ad3051c3 AP_GyroFFT: allow for 2 FFT based notches 2022-06-17 14:07:00 +10:00
Andrew Tridgell 5080c32197 AP_GyroFFT: use HarmonicNotch class 2022-06-17 14:07:00 +10:00
Andrew Tridgell e763386651 AP_GyroFFT: only allow one harmonic notch filter to be linked to FFT 2022-06-17 14:07:00 +10:00
Peter Barker c9eb7e3eda AP_GyroFFT: make vehicles write notch log messages 2022-01-05 16:34:36 +11:00
Peter Barker 9ea9c15c6a AP_GyroFFT: pass GyroFFT loop rate in Hz rather than period in us
It just calculates this anyway

Also stops assigning a uint16_t value into a uint32_t value
2021-12-31 11:15:20 +11:00
Andy Piper c50ccd1d09 AP_GyroFFT: use harmonics for harmonics and number of notches elsewhere
modify energy based on peak width
always log harmonic notch frequencies
2021-12-22 18:13:38 +11:00
Andy Piper 71c0d9479a AP_GyroFFT: convert APM_BUILD_COPTER_OR_HELI() to APM_BUILD_COPTER_OR_HELI 2021-10-26 11:42:12 +11:00
Gone4Dirt 79787d55cc AP_GyroFFT: Add APM_BUILD_Heli 2021-09-29 19:55:48 +10:00
Pierre Kancir cc39eafe02 AP_GyroFFT: ensure we got float division when there are needed instead of integer divisions 2021-08-27 13:42:03 +10:00
Pierre Kancir 23a67a9e60 AP_GyroFFT: checking that uint16_t is negative is useless 2021-08-27 13:42:03 +10:00
Pierre Kancir 39fd32aa9e AP_GyroFFT: reduce first_harmonic scope 2021-08-27 13:42:03 +10:00
Andrew Tridgell d07bf97da6 AP_GyroFFT: mark logger Write() calls as streaming where appropriate 2021-08-18 10:20:03 +10:00
Patrick José Pereira 98a8e6e370 AP_GyroFFT: Add missing const in member functions
Signed-off-by: Patrick José Pereira <patrickelectric@gmail.com>
2021-02-03 18:45:14 +11:00
Andy Piper 4f7047797e AP_GyroFFT: reduce locking to avoid contention and match thread priority to IO
remove previous scheduling hack
2020-09-21 20:44:34 +10:00
Andy Piper 9013432d27 AP_GyroFFT: slew FFT frequency output 2020-08-05 17:20:03 +10:00
Andy Piper adb9f70bc9 AP_GyroFFT: correctly count the number of active harmonics 2020-07-14 09:50:06 +10:00
Peter Barker edba1cca4a AP_GyroFFT: cast to unsigned to avoid signed/unsigned comparison
https://discuss.ardupilot.org/t/a-compile-error-about-sitl/57319/14
seems to show older compilers getting confused about what the type of
the RHS is here.  Make it unambiguous for them.
2020-06-29 10:19:14 +10:00
Andy Piper d402761a4b AP_GyroFFT: allow all three peaks to be returned so that we can have three independent harmonic notches
log dynamic harmonic notch per-peak
move health check into update() and make accessors const
use AP_Vehicle log function when necessary
2020-06-21 19:09:35 +10:00
Andy Piper 6da1f3bf2e AP_GyroFFT: filter energy, harmonic and amplitude fit. Make a better guess at harmonic matching
add filtered second and third harmonics and log them
make sure we use all of the gyro samples available on each axis rather than skipping
separate gyro update from fft start to minimize time in fast loop
add FFT_HMNC_PEAK to allow users to select which noise peak and which axis will be tracked.
make sure the self-test runs once and display the results
report self-test failure reason. make sure self-test runs for all windows.
always give logging a chance to run at IO_PRIORITY
add log message documentation
make sure the engine still runs even when the arming check has been disabled
record last FFT update time and cycle time and fallback to throttle estimate when update is too old
delay for longer in FFT thread between cycles to cope on F4
try really hard to get a viable frequency estimate
change range on MAXHZ/MINHZ to reflect that 50Hz is actually quite dangerous
swap the center peak for one of the shoulders if there is temporarily a closer match with the frequency trend
when FFT is disabled still log harmonic notch frequency
use distance matrix to find most appropriate peak
use a median filter to remove outliers before filtering
discount peaks that are relatively too low in energy
make sure harmonic fit is tracked for both potential targets
convert all gyro buffers to ObjectBuffer<float> for lock-free access
run all FFT steps inside the FFT thread
calculate cycle time and loop delay correctly
drop samples when the ring buffer is full
2020-05-24 07:43:34 +10:00
Peter Barker af62d7d7b6 AP_GyroFFT: inline used-only-once Log_Write parameters
This simplifies the code a little (no need to make these constants you
need to go and look up), and also makes external parsing easier.
2020-03-22 18:35:14 +11:00
Andy Piper 3b25a8ae2e AP_GyroFFT: adjust default FFT lengths for boards that can cope and are likely to have BMI088 2020-02-25 08:35:09 +11:00
Andy Piper 7d36bc4422 AP_GyroFFT: new FFT library for motor peak analysis using HAL DSP abstraction
add dynamic gyro windows
control inclusion based on HAL_WITH_DSP and GYROFFT_ENABLED
target appropriate ARM cpus
constrain window sizes to be achievable
improve FFT signal accuracy through configurable window overlap and quinn's estimator
calculate energy weighted center frequency
add support for learning hover frequency and throttle reference
calculate power spectrum rather than amplitude
record noise as a per-bin power spectrum
calculate true SNR per-bin and use that to determine there is a signal
add user config for SNR signal level
constrain frequency scanning to MAXHZ
calculate and learn the peak bandwidth at the configured attenuation
allow enabling/disabling dynamically through rc function
MAXHZ should be below Nyquist
Incorporate full range of MAXHZ to MINHZ
update FFT analysis in a separate thread
allocate memory in a specific region
constrain window size by CPU class
do not allocate any resources when not enabled
Prevent self-check and analysis interfering with each other
put configuration and initialization to AP_Vehicle
add logging
fix significant issues with threading, locking and sample buffer access
use both calculated noise peaks together with the harmonic notch configuration to detemine which peak represents the fundamental harmonic that should be tracked
record harmonic fit
add CMSIS 5 libraries and headers
allow larger FFT lengths on Linux and SITL
2020-02-22 11:15:37 +11:00