Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

FFT sliding window #20296

Merged
merged 7 commits into from
Jun 1, 2022
Merged

Conversation

andyp1per
Copy link
Collaborator

@andyp1per andyp1per commented Mar 12, 2022

This PR uses continuous averaging of FFT frames reducing noise in the analysis. Welch's method of FFT averaging requires that the input be stationary, so it is not possible to average very many frames without biasing the data. That said some amount of averaging can help especially in situations where signals may be moving more slowly (e.g. larger copters). The behaviour is enabled by setting:

FFT_NUM_FRAMES=x

where x is the number of frames to average over. In SITL on a noisy test the results are, before:

image

after:

image

it's hard to see the difference, but the test using averaging always completes after one attempt, whereas the non-averaging test takes several attempts to complete

Flew this on my Y6B with FFT_NUM_FRAMES = 5
Before:
image
After:
image

The difference is pretty dramatic in terms of noise reduction

@andyp1per andyp1per force-pushed the pr-fft-sliding-window branch 2 times, most recently from e3bad09 to 81fabc0 Compare May 4, 2022 19:16
@andyp1per andyp1per marked this pull request as ready for review May 5, 2022 19:55
@hendjoshsr71
Copy link
Member

Could you describe how you perform the testing in sitl for this one?

Once i get a chance to look at more I might see about testing it on a large vehicle soon.

@hendjoshsr71 hendjoshsr71 self-requested a review May 25, 2022 06:34
Copy link
Contributor

@tridge tridge left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

a run on a real board with --enable-malloc-guard would be good

libraries/AP_HAL/DSP.cpp Outdated Show resolved Hide resolved
libraries/AP_HAL/DSP.cpp Outdated Show resolved Hide resolved
libraries/AP_HAL/DSP.cpp Outdated Show resolved Hide resolved
@tridge tridge removed the DevCallEU label May 25, 2022
@andyp1per
Copy link
Collaborator Author

Added SITL checks and ran on a KakuteH7Mini with --malloc-guard-enabled - all good

@hendjoshsr71 the PR includes a test to run in SITL - fly.ArduCopter.GyroFFTContinuousAveraging

libraries/AP_HAL/DSP.cpp Outdated Show resolved Hide resolved
@tridge tridge removed the DevCallEU label Jun 1, 2022
@tridge tridge removed the DevCallEU label Jun 1, 2022
@IamPete1 IamPete1 merged commit 7b733da into ArduPilot:master Jun 1, 2022
@andyp1per andyp1per deleted the pr-fft-sliding-window branch June 1, 2022 14:50
@andyp1per andyp1per added the WikiNeeded needs wiki update label Jul 17, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants