Commit Graph

18 Commits

Author SHA1 Message Date
Iampete1 1d589c5244 AP_GyroFFT: move to new constant dt low pass filter class 2024-08-20 09:09:41 +10:00
Mykhailo Kuznietsov 83b7bb387d AP_GyroFFT: Fix some typos
Fixed some typos found in the code.
2023-10-12 18:30:42 +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
Peter Barker 4056c749ba AP_GyroFFT: move definition of HAL_GYROFFT_ENABLED to AP_HAL_Boards.h
So we can make HAL_WITH_DSP dependent on it
2022-11-05 14:52:10 +11:00
Peter Barker f8a348112a AP_GyroFFT: remove unneccesary includes of AP_Vehicle_Type.h 2022-11-02 18:35:48 +11:00
jackhong12 4a4f361a17 all: use CLASS_NO_COPY() macro 2022-10-04 11:23:04 +11: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
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
Jaaaky 60fcfae2de AP_GyroFFT: Fix multi #include's 2021-12-21 10:38:46 +11: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 9013432d27 AP_GyroFFT: slew FFT frequency output 2020-08-05 17:20:03 +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
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