|
|
@ -465,7 +465,6 @@ void GyroFFT::FindPeaks(const hrt_abstime ×tamp_sample, int axis, q15_t *ff |
|
|
|
// keep if peak has been previously seen and SNR > MIN_SNR
|
|
|
|
// keep if peak has been previously seen and SNR > MIN_SNR
|
|
|
|
// or
|
|
|
|
// or
|
|
|
|
// peak has SNR > MIN_SNR_INITIAL
|
|
|
|
// 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?
|
|
|
|
static constexpr float MIN_SNR = 1.f; // TODO: configurable?
|
|
|
|
|
|
|
|
|
|
|
|
int num_peaks_found = 0; |
|
|
|
int num_peaks_found = 0; |
|
|
@ -491,7 +490,7 @@ void GyroFFT::FindPeaks(const hrt_abstime ×tamp_sample, int axis, q15_t *ff |
|
|
|
|
|
|
|
|
|
|
|
// only keep if we're already tracking this frequency or if the SNR is significant
|
|
|
|
// 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++) { |
|
|
|
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))) { |
|
|
|
|| (fabsf(freq_adjusted - peak_frequencies_publish[axis][peak_prev]) < (resolution_hz * 0.5f))) { |
|
|
|
// keep
|
|
|
|
// keep
|
|
|
|
peak_frequencies[num_peaks_found] = freq_adjusted; |
|
|
|
peak_frequencies[num_peaks_found] = freq_adjusted; |
|
|
|