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

AP_InertialSensor: use batch logging options to allow pre-post raw gyro logging #24311

Merged
merged 1 commit into from
Oct 2, 2023

Conversation

IamPete1
Copy link
Member

This expands the capability of raw sensor logging to allow post filter and pre-post. If the board can keep up with it raw sensor is much nicer than batch logging.

  • logs as float, much less quantization noise
  • its continuous so you can change FFT window size after the fact, also much better for seeing how the frequency tracking is doing
  • Pre-post is of the same samples so a true comparison can be made in dynamic flight

This re-uses the batch sampler options, which means we loose this functionality if batch sampler is compiled out. This will be a change in behavior if users have left over options from filter setup but now have disabled the batch mask. We could also add a new param for just raw sensor logging, this would allow us to add a new bits "primary IMU only" and "gyro only" that would reduce the logging rate.

@IamPete1 IamPete1 requested a review from andyp1per July 14, 2023 21:10
@andyp1per
Copy link
Collaborator

Nice, any idea what the logging data rate is with this?

@IamPete1
Copy link
Member Author

IamPete1 commented Jul 14, 2023

Its a 32 byte log packet, so 3 IMUs, pre and post at 2khz would be 32 * 2 * 3 * 2000 = 384000 Bps, 3.072 Mb/s. Its a lot, but I think we can keep up, certainly on the faster boards.

Copy link
Collaborator

@andyp1per andyp1per left a comment

Choose a reason for hiding this comment

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

Looks right to me - presumably you have tested all the different options?

@IamPete1
Copy link
Member Author

Rebased.

@IamPete1
Copy link
Member Author

IamPete1 commented Sep 23, 2023

Test logs here: https://drive.google.com/file/d/1tcZ5kfnru_8Pl9n58yfHzoi30Kmpyj5Q/view?usp=sharing

Log1, batch logging pre filter:

image

image

Log2, batch logging post filter:

image

image

Log3, batch logging pre and post:

image

image

Log4, raw sensor logging pre:

image

image

Log5, raw sensor logging post:

image

image

Log6, raw sensor pre and post:

image

image

Note that it does need a minor change to the filter review tool to take the new options into account when plotting raw sensor.

@IamPete1
Copy link
Member Author

IamPete1 commented Sep 23, 2023

I hope those plots also clearly show why raw sensor logging is better. The white bands in the sepctogram show where logging could not keep up. None in the batch logs, a couple in raw sensor logging, more in pre+post raw. Tested on CubeOrange with default logging settings.

Maybe as future PR we could add a raw logging mask so you can raw log on just a single sensor, currently its all or nothing. Unfortunately we can't just reuse the batch logging mask as we would need to default to log all.

@IamPete1
Copy link
Member Author

The new pre-post option also allows for a direct evaluation of the filter tools post-filter estimate. No notches enabled for this test, so just low pass.
newplot (7)

tridge
tridge previously requested changes Sep 26, 2023
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.

maybe INS_LOG_OPTION bitmask, where INS_LOG_OPTIONS=1 means log primary gyro raw

@IamPete1
Copy link
Member Author

Some more testing.

New param not set, RAW IMU log bitmask.
image

image

RAW IMU log bitmask off, new INS_RAW_LOG_OPT - primary only - happened to have a change of primary in the log. First half on gyro 2 and the second half on gyro 1.

image

image

INS_RAW_LOG_OPT - all gyro.

image

INS_RAW_LOG_OPT - all gyro + post filter

image

INS_RAW_LOG_OPT - all gyro + pre/post filter

image

@IamPete1 IamPete1 requested a review from tridge September 30, 2023 13:54
@IamPete1 IamPete1 dismissed tridge’s stale review September 30, 2023 13:55

Added new param INS_RAW_LOG_OPT

@Hwurzburg Hwurzburg added the WikiNeeded needs wiki update label Oct 2, 2023
@tridge tridge merged commit 3429276 into ArduPilot:master Oct 2, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
WikiNeeded needs wiki update
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants