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

Support requested for graphing FFT from ISB messages in DataFlash files #1647

Closed
peterbarker opened this issue Sep 22, 2017 · 2 comments
Closed

Comments

@peterbarker
Copy link
Contributor

Issue details

We have a new feature coming in ArduPilot which allows fft-able data to be contained in many dataflash files, rather than just those with raw IMU sampling data enabled.

There is a new format field type, a. It is an array of 32 16-bit signed integers.

There are two new messages, ISBH and ISBD. One contains header information for a batch sample, the other the data for the batch sample. Many ISBDs are expected for a single ISBH message, and one is related to the other using the N field.

The ISBH message contains type and instance fields, with type specifying an IMU sensor type (gyro or accel) and instance the instance number of that sensor on the flight controller.

Version

These patches are as yet unmerged into master. https://github.com/peterbarker/ardupilot/tree/fft is the WIP for support. We do not expect the format of the messages to change before that's merged in.

Platform

[ * ] All
[ ] AntennaTracker
[ ] Copter
[ ] Plane
[ ] Rover
[ ] Sub

Logs

df-isb-fft-sample.bin.zip

pbarker@bluebottle:~$ mavlogdump.py df-isb-fft-sample.bin --t FMT | grep ISB
Skipped 443 bad bytes in log at offset 3827, type=(163, 149, 248)
2017-09-22 09:33:08.14: FMT {Type : 248, Length : 29, Name : ISBH, Format : QHBBHQf, Columns : TimeUS,N,type,instance,mul,SampleUS,smp_rate}
2017-09-22 09:33:08.14: FMT {Type : 249, Length : 207, Name : ISBD, Format : QHHaaa, Columns : TimeUS,N,seqno,x,y,z}
pbarker@bluebottle:~$ mavlogdump.py df-isb-fft-sample.bin --t ISBH,ISBD | head
Skipped 443 bad bytes in log at offset 3827, type=(163, 149, 248)
2017-09-22 09:33:08.14: ISBH {TimeUS : 98933484, N : 27, type : 1, instance : 0, mul : 938, SampleUS : 0, smp_rate : 1001.12475586}
2017-09-22 09:33:08.14: ISBD {TimeUS : 98933499, N : 27, seqno : 0, x : array('h', [3, 2, 1, 0, 0, 1, 0, 2, 2, 3, 3, 2, 1, 1, 1, 2, 2, 1, 0, 0, 1, 1, 2, 1, 1, 1, 0, 0, 0, 0, 1, 1]), y : array('h', [-1, 0, 0, -1, 0, 0, 1, 1, 2, 1, 0, 0, 0, -1, -1, 0, 1, 0, 0, 0, -1, -1, -1, -1, 0, 0, 0, 0, 0, 0, 2, 1]), z : array('h', [0, 1, 2, 1, 0, 0, -1, -1, -1, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0])}
2017-09-22 09:33:08.14: ISBD {TimeUS : 98933542, N : 27, seqno : 1, x : array('h', [0, 0, 0, 1, 2, 4, 5, 3, 0, 0, 0, 2, 2, 1, 2, 2, 1, 0, 0, 1, 1, 0, 0, 2, 3, 3, 2, 2, 2, 1, 1, 1]), y : array('h', [0, 0, 0, 0, 0, -2, -2, 0, 0, 0, 0, 1, 2, 2, 1, 1, 0, 0, 0, 0, 0, 2, 2, 2, 0, 0, 0, 0, 0, 1, 0, 0]), z : array('h', [0, 0, 0, -1, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0])}
2017-09-22 09:33:08.25: ISBD {TimeUS : 99044768, N : 27, seqno : 2, x : array('h', [1, 0, 1, 2, 2, 2, 2, 1, 0, 2, 2, 3, 2, 2, 3, 2, 1, 1, 1, 1, 1, 0, 0, 1, 1, 1, 3, 4, 2, 0, 1, 3]), y : array('h', [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 0, 0, 0, 0, -1, -2, -1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0]), z : array('h', [0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, -1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0])}
2017-09-22 09:33:08.25: ISBD {TimeUS : 99044832, N : 27, seqno : 3, x : array('h', [3, 0, 0, 0, 0, 1, 2, 1, 0, 0, 0, 1, 2, 0, 0, 0, 2, 2, 1, 2, 2, 2, -1, -2, 2, 5, 8, 9, 3, -2, -3, -1]), y : array('h', [0, 0, 0, 0, 0, 0, -1, 0, 0, 0, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 2, 1, 0, -2, 0, 2, 1, -3, -6]), z : array('h', [0, 0, 0, 0, -1, -1, -2, -2, -2, -2, -1, 0, 1, 1, 0, 0, 2, 1, 0, 0, 2, 1, -4, -4, 0, -6, -1, 8, 2, -2, 0, 0])}

mavfft_isb.py (https://github.com/ArduPilot/pymavlink/blob/master/tools/mavfft_isb.py) interprets these messages to produce pretty pictures:

fft-gyro
fft-accel

Note that this tool takes the average of all of the per-sensor/instance FFTs to produce the graphs, however animating each sensor/instance, or producing overlays on e.g. a motor-output graph might be other good uses for this data.

@meee1
Copy link
Contributor

meee1 commented Oct 4, 2017

added support here 7151df4

@tridge
Copy link
Contributor

tridge commented Oct 4, 2017

thanks Michael!

@meee1 meee1 closed this as completed Oct 9, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants