-
Notifications
You must be signed in to change notification settings - Fork 13.5k
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
Fixes for IMU filter settings #9367
Conversation
The description of IMU_GYRO_CUTOFF was incorrectly saying that it only affects the driver filtering, but in fact it also set the on-chip filter to the next higher supported value. This patch fixes that. And because the IMU_GYRO_CUTOFF and not the IMU_ACCEL_CUTOFF was used for the on-chip filter, after #9070 which sets the default gyro filter to 80, we were effectively using a dlpf of 98 Hz. For this reason this patch changes the on-chip cutoff frequency to 98 as well, so that the overall default behavior is unchanged.
#define MPU_GYRO_DLPF_CFG_42HZ 0x03 // delay: 4.8ms | ||
#define MPU_GYRO_DLPF_CFG_20HZ 0x04 // delay: 8.3ms | ||
#define MPU_GYRO_DLPF_CFG_10HZ 0x05 // delay: 13.4ms | ||
#define MPU_GYRO_DLPF_CFG_5HZ 0x06 // delay: 18.6ms |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We should be able to use this delay data to improve IMU timestamping. We should subtract this value (based on selected DLPF) from the hrt_absolute_time() we use to timestamp the accel/gyro data.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm fine with that. You'll have to make sure that it works with the estimators.
Could we also enable the lower delay settings by default? |
Hi Lorenz, IMU's like bmi160, bmi055 supports different bandwidth configurations depends on the application needs. As far I know, all necessary HW configurations are already supported by drivers. What will be your target in terms of group delay/ bandwidth and ODR/read-out rate? BMI160 offers HW configurations: e.g. f_c~150Hz / 90Hz for ODR=1.6kHz/800Hz + OSR4 accordingly. This configs might be good choice for drone application (no special driver adaptation needed if 2nd order IIR filter enough). BMI055 include two chip solution, so every component need to configured separately: Valid for all sensors: if special SW filters in the driver required, the continuous sampling w/o data loss and read-out with >=1kHz might be needed. Please let me know if support on configuration of the filters of IMU are required, or even SW filter tuning for BMI's. Best Regards, P.S. BMI088 will have DLPF in accelerometer chip, in parallel we are working on the API which supports customized SW filters (case which you describe above) |
Hi Sergej Thanks for your quick response. We currently have ODR=1kHz for most of our IMU drivers, but would like to increase it at some point.
|
Hi Beat, Maybe one idea: I was thinking is it not better to have SW filter for all IMU's and let them run at high speed (e.g. 1kHz) --> so you can be almost independent on IMU and you better control of the group delay based more or less on the known group delay of the SW filter. Then you can just change the settings for SW filter and adjust them to frame / drone size used in the projects? Best Regards, |
You are completely right, and ideally we will disable the on-chip filter completely and only have the SW filter. But to avoid aliasing, we need >1kHz readout rate, which as it seems requires DMA, and that is a bigger effort. |
The description of
IMU_GYRO_CUTOFF
says:But this is not correct, it also sets the on-chip DLPF cutoff frequency to the next supported higher value. It means that #9070 had a much larger impact than what I thought (it set the on-chip filter to 98Hz, thus affecting the estimators as well).
But since it seems to work and generally improves flight performance, this PR explicitly sets the DLPF to 98Hz, so it leaves the default behavior unchanged.
The bmi055 and bmi160 drivers both do not support setting the on-chip filter settings. @FAC94 and @scheiermanns do you plan to add support for that? It's an important feature that these drivers should have.
I also tested on my quad setting the DLPF frequency to 188Hz and noticed the following: