IMU Filter Tool

Hi, I want to share a simple python tool to apply FFT to raw IMU logs and then test various filters.

I’m also testing spectral analysis to see how FFT changes over time:


I can clearly see at least 3 different curves, I think relative to the resonance frequency of 3 motors, with their harmonics above.

If you think it can be useful, just tell me where to put it and I’ll make a pull request :slight_smile:

6 Likes

Very nice, I like it!

2 Likes

Thanks, I would like to make it faster, but I think it’s OK for now.

Side note, actually I’m calculating STFT rather than FFT

I love it! Thanks Guglie! Please dev, help this guy to integrate ASAP this in Mission Planner :rofl:

2 Likes

Hello, where we can download your python app for test? Also can you tell how to set ardupilot filters following filter tune done with your app?

@tridge this could be useful / of interest

1 Like

Thanks to all, I have created a pull here in the Tools folder as suggested by @amilcarlucas https://github.com/ArduPilot/ardupilot/pull/11603

I’ve also made a lot of updates to the tool, now it works on all 3 axis, it sets the filter defaults reading the parameters of the log and on closing it prints the parameters to set the filters.

You can run it passing a log as command line argument, if not it should open a file picker GUI.

The code surely needs a cleanup and has some dependencies, I’ve tested only with python 3.

This has been merged in master in Tools/FilterTestTool

Let me know if it is working for you and if you need other features!

1 Like

Thanks @guglie for this useful tool.
One question: the AccX part is only useful if one apply your PR, is it right?

Yes, but now you should not see the notch on the accelerometer if the firmware that recorded the log doesn’t support it.

And you should also see AccY and AccZ. Only on first IMU for now.

1 Like

Hello I tried your python script on windows with python 3.5. I installed all modules requested by the scrip, but finally i cant get it working, nothin happens.

Sorry I’m newbee on this but maybe i forget on detail for it work and maybe you can help me to get it work?

Hi, I don’t use Windows, but I can try to help.
Do you see some kind of error or the program hangs?
Sometimes the file chooser window opens in background.
You can try to call it from a command line with a log file argument, E.g.

python3 run_filter_test.py logfile.bin

What are the log file parameter prerequisites for this to work? I assume this requires the Batch processing parameter like FFT? For high logging rate?

Hi! No, FFT batch logging is not required as this FFT analysis is performed on raw IMU logs, so I think the minimal bitmask to enable this is LOG_BITMASK = 786560

Maybe in the future we can visualize and compare also a batch FFT, but raw imu logging is already a considerable load, so I don’t know how the logger can handle it.

Also if you see holes in the log you can try to increase LOG_FILE_BUFSIZE.

Can the LOG_BITMASK and other parameters required for this to work be documented in the README.md file ?

Hi @guglie nice tool! Im also trying to run it on Windows but have had no success, the program hangs. Tried running it via cmd too but no success there either.

Hi, thanks! Have you tried the following written above?

Hi. Yes I did but it wasnt working. I tried it on another Linux machine and it seems to be working fine now, needed to install some packages (tk and pymavlink) but other than that all good!

Ok it works on Windows too forgot to install pymavlink, my mistake.

Is it complicated to change this to use the batch sampler ?

1 Like