mirror of
https://gitee.com/mirrors_PX4/PX4-Autopilot.git
synced 2026-10-29 07:43:35 +08:00
imu drivers: do not set on-chip filter based on driver filter setting
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.
This commit is contained in:
@@ -815,9 +815,6 @@ int MPU6000::reset()
|
||||
_set_sample_rate(_sample_rate);
|
||||
usleep(1000);
|
||||
|
||||
// FS & DLPF FS=2000 deg/s, DLPF = 20Hz (low pass filter)
|
||||
// was 90 Hz, but this ruins quality and does not improve the
|
||||
// system response
|
||||
_set_dlpf_filter(MPU6000_DEFAULT_ONCHIP_FILTER_FREQ);
|
||||
|
||||
if (is_icm_device()) {
|
||||
@@ -1409,19 +1406,12 @@ MPU6000::ioctl(struct file *filp, int cmd, unsigned long arg)
|
||||
// adjust filters
|
||||
float cutoff_freq_hz = _accel_filter_x.get_cutoff_freq();
|
||||
float sample_rate = 1.0e6f / ticks;
|
||||
_set_dlpf_filter(cutoff_freq_hz);
|
||||
|
||||
if (is_icm_device()) {
|
||||
_set_icm_acc_dlpf_filter(cutoff_freq_hz);
|
||||
}
|
||||
|
||||
_accel_filter_x.set_cutoff_frequency(sample_rate, cutoff_freq_hz);
|
||||
_accel_filter_y.set_cutoff_frequency(sample_rate, cutoff_freq_hz);
|
||||
_accel_filter_z.set_cutoff_frequency(sample_rate, cutoff_freq_hz);
|
||||
|
||||
|
||||
float cutoff_freq_hz_gyro = _gyro_filter_x.get_cutoff_freq();
|
||||
_set_dlpf_filter(cutoff_freq_hz_gyro);
|
||||
_gyro_filter_x.set_cutoff_frequency(sample_rate, cutoff_freq_hz_gyro);
|
||||
_gyro_filter_y.set_cutoff_frequency(sample_rate, cutoff_freq_hz_gyro);
|
||||
_gyro_filter_z.set_cutoff_frequency(sample_rate, cutoff_freq_hz_gyro);
|
||||
|
||||
Reference in New Issue
Block a user