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 configurable backend gyro and accel rates on Invensense sensors to support 8k gyros and fast-sampling on MPU6000 #14423

Merged
merged 1 commit into from
Jul 28, 2020

Conversation

andyp1per
Copy link
Collaborator

@andyp1per andyp1per commented May 21, 2020

This PR decouples the accel and gyro backend sample rates so that they can run at different speeds. This allows gyro samples to be delivered more quickly than accel samples meaning that we can run gyros at 8k regardless of the maximum sensor rate for accels.
This also means that we can now support fast sampling on IMU's that only have fast sampling for gyros - e.g. the MPU6000.

Flown on a KakuteF7Mini v2 (MPU6000) @2khz and 8kHz

@andyp1per andyp1per force-pushed the pr-accel-downsample branch 2 times, most recently from 549e84c to b1adb74 Compare May 21, 2020 20:54
@andyp1per andyp1per changed the title Support configurable backend gyro rates on Invensense sensors Support configurable backend gyro and accel rates on Invensense sensors May 24, 2020
@andyp1per andyp1per force-pushed the pr-accel-downsample branch 3 times, most recently from 9fff833 to a835753 Compare July 15, 2020 18:34
@andyp1per andyp1per changed the title Support configurable backend gyro and accel rates on Invensense sensors Support configurable backend gyro and accel rates on Invensense sensors to support 8k gyros and fast-sampling on MPU6000 Jul 15, 2020
@andyp1per andyp1per marked this pull request as ready for review July 15, 2020 18:51
@andyp1per andyp1per requested a review from tridge July 15, 2020 18:51
@andyp1per
Copy link
Collaborator Author

I flew 9 packs on this on an MPU9250, MPU6000, ICM20689 - all great. I flew the MPU 6000 at 2kHz, 4kHz and 8Khz. All worked, although more noise was getting through at 8kHz and my motors were getting hot.

@Hwurzburg Hwurzburg added the WikiNeeded needs wiki update label Jul 19, 2020
@kd0aij
Copy link
Contributor

kd0aij commented Jul 19, 2020

more noise was getting through at 8kHz

Does this say that the MPU6000 is noisier than the others, or is there a difference in filtering?

@andyp1per
Copy link
Collaborator Author

@kd0aij before this change it was impossible to try 8kHz because the accel and gyro rates had to be the same and accels only go up to 4kHz. With this change 8kHz is possible - I'm just remarking that it may not be advisable. @lthall thinks that its simply a case of 8kHz being too CPU hungry for my little copter and so the notch is not able to track the noise properly.

@kd0aij
Copy link
Contributor

kd0aij commented Jul 19, 2020

Would be interesting to look at timing jitter and the load value in those logs then.

@andyp1per
Copy link
Collaborator Author

Found a very subtle bug to do with the sensor rate update. Fixed now.

@andyp1per
Copy link
Collaborator Author

@kd0aij - also after talking to @lthall the conclusion is that the 188Hz on gyros in the invensense backend is not achieving anything other than some delay. I am running an experiment taking it out, but will do that in a separate PR. But it will likely reduce the load a little.

@tridge
Copy link
Contributor

tridge commented Jul 27, 2020

I tested on a Pixhawk1 and it seems fine, with INS_GYRO_RATE=3 I see 8kHz gyro, 1kHz accels from mpu6k. Still see 750Hz from lsm303d

@andyp1per
Copy link
Collaborator Author

Here is a log from a short hover:
log2.zip
Shows that GHz and AHz are correct and flies normally with fast sampling on

Copy link
Contributor

@rmackay9 rmackay9 left a comment

Choose a reason for hiding this comment

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

Can you remove the the extra debug? As discussed on the dev call this can go in after this. txs!

…ndependent from the accel rate

allow fast sampling of gyros on MPU6000 and MPU6500
@andyp1per andyp1per requested a review from rmackay9 July 28, 2020 06:48
@tridge tridge merged commit d4ba821 into ArduPilot:master Jul 28, 2020
@andyp1per andyp1per deleted the pr-accel-downsample branch July 28, 2020 11:07
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

6 participants