Commit Graph

35 Commits

Author SHA1 Message Date
Andy Piper a0b8e22a63 AP_GyroFFT: change default FFT frequency range to something more useful 2023-01-24 10:56:33 +11:00
Andy Piper c3a402a02f AP_GyroFFT: emit notifications for FFT notch tune 2023-01-24 10:56:33 +11:00
Andy Piper 4199ccc292 AP_GyroFFT: correct notch calculation for FFT tune.
use freq_min_ratio for scaling
add harmonic calculation test
set harmonics in notch setup
2023-01-24 10:56:33 +11:00
Andy Piper 449d9814ab AP_GyroFFT: add FFT_OPTIONS to allow post-filter sampling of IMUs
provide method to determine noise at a particular frequency
add ability to record per-peak SnR
correct bad array indexing leading to free memory read
track all three axes for health and peaks
remove slewed frequency values, since slewing is now done in the filters
ReplayGyroFFT initial implementation
allow IMU data to be read and written from a file
only build Replay on SITL
correctly calibrate FFT in Replay
better noise simulation in Replay
FTN3 logging
allow FFT peaks to swap indefinitely as long as they both still exist.
Leads to much smoother frequency transitions
increase the energy gap required to switch the tracked peak
use exit on stop for Replay
filter noise tracking more aggressively for post-filter samples
remove message and use appropriate gyro window
when using post-filter do not fallback to throttle-based estimate

AP_GyroFFT: default SnR to 10 when using post-filter samples
2022-12-28 18:14:56 +11:00
Iampete1 3878e64f97 AP_GyroFFT: params always use set method 2022-08-03 13:43:48 +01:00
Peter Barker e570737154 AP_GyroFFT: remove transitive include dependencies 2022-07-20 17:32:24 +10:00
Andy Piper 619fa021e7 AP_GyroFFT: make sure the parameters are updated at least once on startup 2022-06-14 10:09:18 +10:00
Andy Piper 684cf996e1 AP_GyroFFT: save a sliding window of output frequency bins
allow configuration of DSP averaging frames via FFT_NUM_FRAMES
2022-06-01 15:49:32 +01:00
Andy Piper aaad4ace08 AP_GyroFFT: add notch tuning functions
calculate averaged FFT frequency and enable notch
scale notch frequency down to FFT_MINHZ
calculate harmonics for averaging correctly
expose enable flag
2022-05-04 17:05:51 +10:00
Andrew Tridgell bccca9ed2e AP_GyroFFT: added defaults for FFT with no notch
allow for testing with FFT enabled, and defaulting number of
frequencies to look for
2022-04-19 09:39:03 +10:00
Andrew Tridgell e0bb717231 AP_GyroFFT: skip disabled notches 2022-04-19 09:39:03 +10:00
Andrew Tridgell 492e203fd2 AP_GyroFFT: allow for 2 FFT based notches 2022-04-19 09:39:03 +10:00
Andrew Tridgell 86db91e3b4 AP_GyroFFT: use HarmonicNotch class 2022-04-19 09:39:03 +10:00
Andrew Tridgell 782e4887bc AP_GyroFFT: only allow one harmonic notch filter to be linked to FFT 2022-04-19 09:39:03 +10:00
Andrew Tridgell 622ad2a088 AP_GyroFFT: support two full harmonic notch filters 2022-04-19 09:39:03 +10:00
murata c90e42d10a AP_GyroFFT: Change from division to multiplication 2022-03-16 18:41:52 +11: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