mirror of
https://github.com/PX4/PX4-Autopilot.git
synced 2026-06-01 11:06:04 +08:00
gyro_fft: add IMU_GYRO_FFT_SNR parameter
This commit is contained in:
@@ -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;
|
||||||
|
|||||||
@@ -161,7 +161,8 @@ private:
|
|||||||
DEFINE_PARAMETERS(
|
DEFINE_PARAMETERS(
|
||||||
(ParamInt<px4::params::IMU_GYRO_FFT_LEN>) _param_imu_gyro_fft_len,
|
(ParamInt<px4::params::IMU_GYRO_FFT_LEN>) _param_imu_gyro_fft_len,
|
||||||
(ParamFloat<px4::params::IMU_GYRO_FFT_MIN>) _param_imu_gyro_fft_min,
|
(ParamFloat<px4::params::IMU_GYRO_FFT_MIN>) _param_imu_gyro_fft_min,
|
||||||
(ParamFloat<px4::params::IMU_GYRO_FFT_MAX>) _param_imu_gyro_fft_max
|
(ParamFloat<px4::params::IMU_GYRO_FFT_MAX>) _param_imu_gyro_fft_max,
|
||||||
|
(ParamFloat<px4::params::IMU_GYRO_FFT_SNR>) _param_imu_gyro_fft_snr
|
||||||
)
|
)
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@@ -74,3 +74,12 @@ PARAM_DEFINE_FLOAT(IMU_GYRO_FFT_MAX, 150.f);
|
|||||||
* @group Sensors
|
* @group Sensors
|
||||||
*/
|
*/
|
||||||
PARAM_DEFINE_INT32(IMU_GYRO_FFT_LEN, 512);
|
PARAM_DEFINE_INT32(IMU_GYRO_FFT_LEN, 512);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* IMU gyro FFT SNR.
|
||||||
|
*
|
||||||
|
* @min 1
|
||||||
|
* @max 30
|
||||||
|
* @group Sensors
|
||||||
|
*/
|
||||||
|
PARAM_DEFINE_FLOAT(IMU_GYRO_FFT_SNR, 10.f);
|
||||||
|
|||||||
Reference in New Issue
Block a user