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

Fixing BMI088 IMU connected via I2C #23141

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open

Conversation

slgrobotics
Copy link
Contributor

Solved Problem

In my testing of Bosch Sensortec BMI088 IMU data logged to an ulg file had strange spikes and was not good for EKF either.

Fixes #23111

Solution

It looks like there's a problem reading FIFO - at least for I2C connected devices.

Reading data directly from device registers (for both accelerometer and gyroscope) - using NormalRead() functions seem to solve this issue.

Test coverage

I use a Raspberry Pi 4 and SeeedStudio BMI088 breakboard to test this code, as this is what I have on my two rovers.

More testing on Bitcraze CrazyFlie 2.1 hardware should be done, as this is the only PX4-supported platform that uses I2C for this IMU. All others connect BMI088 via SPI and therefore use different driver.

make bitcraze_crazyflie21

Notes:

  1. I believe that the code for SPI-connected devices has an error when incoming values are compared with INT16_MIN. If any of X, Y or Z values are equal to INT16_MIN - whole sample must be discarded.
    This is described in BMI088 connected via I2C does not work right[Bug]  #23111

  2. There's a lot of unused FIFO-related code in bmi088_i2c driver. It can be removed as we progress with this PR.

@slgrobotics
Copy link
Contributor Author

@mrpollo - here is a log file - rover makes a couple turns in manual mode. I have MPU9250/SPI as #01 and BMI088/I2C as #00 - and their data seems close enough:
two_gyros-fixed

https://review.px4.io/plot_app?log=e4e0e80c-3d80-490c-ae9b-821a76a0f3a0

@slgrobotics
Copy link
Contributor Author

slgrobotics commented May 16, 2024

Related PRs and Issues:

#15361

#17082

#22684

@slgrobotics
Copy link
Contributor Author

Just FYI: I have a version of bmi088_i2c driver that works for my rovers well. It is cleaned off all the FIFO code and I revamped some register settings for clarity. I use low frequencies for low pass filters too, so that all vibrations are filtered out. I also added additional EMA filter to smooth the data even further in controlled manner.

https://github.com/slgrobotics/PX4-Autopilot/tree/main/src/drivers/imu/bosch/bmi088_i2c

two_gyros-fixed-lowpass

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

Successfully merging this pull request may close these issues.

BMI088 connected via I2C does not work right[Bug]
1 participant