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: fetch samples at max rate in invensensev3 #24787

Open
wants to merge 3 commits into
base: master
Choose a base branch
from

Conversation

tridge
Copy link
Contributor

@tridge tridge commented Aug 28, 2023

This changes the Invensensev3 driver to fetch samples at the max ODR, then downsample to the desired backend rate. This is the strategy used for the v2 driver.
The motivation is a set of logs that seems to show aliasing in the gyro signal on the ICM-42688 (first IMU in this graph)
image
this implies that the internal filter in the ICM-42688 is not doing a good job of preventing gyro aliasing.
This PR also fixes 2 bugs found while making the change:

  • fixes the orientation of the samples in batch sampling when AHRS_ORIENTATION is not zero
  • ensures that accel_instance and gyro_instance are initialised before they are used

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.

It looks right to me - will need a lot of testing.

I notice that we don't have the clipping code in the v3 driver - is this deliberate or an oversight?

we use the instance numbers during filter configuration to check if
fast sampling is enabled. We need to ensure these instance numbers
have been setup before the filtering functions get called
we need to rotate the data so that FFT displays match the configured
orientation
this makes the v3 driver match the v2 driver by fetching samples on
the bus at the maximum rate when fast sampling is enabled. This should
reduce the chance of aliasing for high frequency noise
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.

2 participants