gyro_fft: add IMU_GYRO_FFT_SNR parameter

This commit is contained in:
Daniel Agar
2021-11-08 19:14:32 -05:00
parent 6fab6242db
commit dd3e0b723a
3 changed files with 12 additions and 3 deletions
+1 -2
View File
@@ -465,7 +465,6 @@ void GyroFFT::FindPeaks(const hrt_abstime &timestamp_sample, int axis, q15_t *ff
// keep if peak has been previously seen and SNR > MIN_SNR
// or
// peak has SNR > MIN_SNR_INITIAL
static constexpr float MIN_SNR_INITIAL = 15.f; // TODO: configurable?
static constexpr float MIN_SNR = 1.f; // TODO: configurable?
int num_peaks_found = 0;
@@ -491,7 +490,7 @@ void GyroFFT::FindPeaks(const hrt_abstime &timestamp_sample, int axis, q15_t *ff
// only keep if we're already tracking this frequency or if the SNR is significant
for (int peak_prev = 0; peak_prev < MAX_NUM_PEAKS; peak_prev++) {
if ((snr > MIN_SNR_INITIAL)
if ((snr > _param_imu_gyro_fft_snr.get())
|| (fabsf(freq_adjusted - peak_frequencies_publish[axis][peak_prev]) < (resolution_hz * 0.5f))) {
// keep
peak_frequencies[num_peaks_found] = freq_adjusted;