Repository navigation
Gyro reading rate is automatically adjusted to the IMU update rate. Does filter constants adjusted too? #10643
|
Are the constants of all filters recalculated if the gyroscope update frequency is different from 4 kHz? |
Replies: 1 comment 1 reply
|
Yes. No filter assumes 4 kHz. Every filter's coefficients are computed at boot from the period it actually runs at. There are two time bases: 1. Gyro sampling rate (gyro task). gyroDev[0].requestedSampleIntervalUs = TASK_GYRO_LOOPTIME;
gyroDev[0].initFn(&gyroDev[0]);
gyro.targetLooptime = gyroDev[0].sampleRateIntervalUs;The gyro task is rescheduled to that period ( 2. PID loop rate (
So if your IMU runs at, say, 1 kHz or 3.2 kHz, the anti-aliasing filter still has the correct cutoff in Hz. Changing One thing to know: the coefficients are computed once, in To check: in the CLI, |
Yes. No filter assumes 4 kHz. Every filter's coefficients are computed at boot from the period it actually runs at. There are two time bases:
1. Gyro sampling rate (gyro task).
gyroInit()asks the driver forTASK_GYRO_LOOPTIME(250 µs = 4 kHz). The driver'sinitFnwrites back the rate the IMU really delivers intosampleRateIntervalUs, and that becomesgyro.targetLooptime:The gyro task is rescheduled to that period (
rescheduleTask(TASK_GYRO, getGyroLooptime())). The first-stage anti-aliasing LPF (gyro_anti_aliasing_lpf_hz), which runs ingyroUpd…