gyro_fft: log peak frequency magnitudes

This commit is contained in:
Daniel Agar
2021-03-15 00:47:11 -04:00
committed by Lorenz Meier
parent 3665f9a3c4
commit af3573e464
2 changed files with 8 additions and 1 deletions

View File

@@ -9,3 +9,7 @@ float32 resolution_hz
float32[6] peak_frequencies_x # x axis peak frequencies
float32[6] peak_frequencies_y # y axis peak frequencies
float32[6] peak_frequencies_z # z axis peak frequencies
uint32[6] peak_magnitude_x # x axis peak frequencies magnitude
uint32[6] peak_magnitude_y # y axis peak frequencies magnitude
uint32[6] peak_magnitude_z # z axis peak frequencies magnitude

View File

@@ -318,7 +318,8 @@ void GyroFFT::Run()
}
if (peaks_detected) {
float *peak_frequencies[] { _sensor_gyro_fft.peak_frequencies_x, _sensor_gyro_fft.peak_frequencies_y, _sensor_gyro_fft.peak_frequencies_z};
float *peak_frequencies[] {_sensor_gyro_fft.peak_frequencies_x, _sensor_gyro_fft.peak_frequencies_y, _sensor_gyro_fft.peak_frequencies_z};
uint32_t *peak_magnitude[] {_sensor_gyro_fft.peak_magnitude_x, _sensor_gyro_fft.peak_magnitude_y, _sensor_gyro_fft.peak_magnitude_z};
int num_peaks_found = 0;
@@ -333,6 +334,8 @@ void GyroFFT::Run()
}
peak_frequencies[axis][num_peaks_found] = freq;
peak_magnitude[axis][num_peaks_found] = peaks_magnitude[i];
num_peaks_found++;
}
}