|
|
|
@ -228,7 +228,7 @@ void AP_InertialSensor_Backend::_notify_new_gyro_raw_sample(uint8_t instance,
@@ -228,7 +228,7 @@ void AP_InertialSensor_Backend::_notify_new_gyro_raw_sample(uint8_t instance,
|
|
|
|
|
_imu._gyro_filtered[instance] = _imu._gyro_filter[instance].apply(gyro); |
|
|
|
|
|
|
|
|
|
// apply the harmonic notch filter
|
|
|
|
|
if (_gyro_harmonic_notch_enabled()) { |
|
|
|
|
if (gyro_harmonic_notch_enabled()) { |
|
|
|
|
_imu._gyro_filtered[instance] = _imu._gyro_harmonic_notch_filter[instance].apply(_imu._gyro_filtered[instance]); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
@ -506,16 +506,15 @@ void AP_InertialSensor_Backend::update_gyro(uint8_t instance)
@@ -506,16 +506,15 @@ void AP_InertialSensor_Backend::update_gyro(uint8_t instance)
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
// possily update the harmonic notch filter parameters
|
|
|
|
|
if (!is_equal(_last_harmonic_notch_bandwidth_hz, _gyro_harmonic_notch_bandwidth_hz()) || |
|
|
|
|
!is_equal(_last_harmonic_notch_attenuation_dB, _gyro_harmonic_notch_attenuation_dB())) { |
|
|
|
|
_imu._gyro_harmonic_notch_filter[instance].init(_gyro_raw_sample_rate(instance), _gyro_harmonic_notch_center_freq_hz(), _gyro_harmonic_notch_bandwidth_hz(), _gyro_harmonic_notch_attenuation_dB()); |
|
|
|
|
_last_harmonic_notch_center_freq_hz = _gyro_harmonic_notch_center_freq_hz(); |
|
|
|
|
_last_harmonic_notch_bandwidth_hz = _gyro_harmonic_notch_bandwidth_hz(); |
|
|
|
|
_last_harmonic_notch_attenuation_dB = _gyro_harmonic_notch_attenuation_dB(); |
|
|
|
|
} |
|
|
|
|
else if (!is_equal(_last_harmonic_notch_center_freq_hz, _gyro_harmonic_notch_center_freq_hz())) { |
|
|
|
|
_imu._gyro_harmonic_notch_filter[instance].update(_gyro_harmonic_notch_center_freq_hz()); |
|
|
|
|
_last_harmonic_notch_center_freq_hz = _gyro_harmonic_notch_center_freq_hz(); |
|
|
|
|
if (!is_equal(_last_harmonic_notch_bandwidth_hz, gyro_harmonic_notch_bandwidth_hz()) || |
|
|
|
|
!is_equal(_last_harmonic_notch_attenuation_dB, gyro_harmonic_notch_attenuation_dB())) { |
|
|
|
|
_imu._gyro_harmonic_notch_filter[instance].init(_gyro_raw_sample_rate(instance), gyro_harmonic_notch_center_freq_hz(), gyro_harmonic_notch_bandwidth_hz(), gyro_harmonic_notch_attenuation_dB()); |
|
|
|
|
_last_harmonic_notch_center_freq_hz = gyro_harmonic_notch_center_freq_hz(); |
|
|
|
|
_last_harmonic_notch_bandwidth_hz = gyro_harmonic_notch_bandwidth_hz(); |
|
|
|
|
_last_harmonic_notch_attenuation_dB = gyro_harmonic_notch_attenuation_dB(); |
|
|
|
|
} else if (!is_equal(_last_harmonic_notch_center_freq_hz, gyro_harmonic_notch_center_freq_hz())) { |
|
|
|
|
_imu._gyro_harmonic_notch_filter[instance].update(gyro_harmonic_notch_center_freq_hz()); |
|
|
|
|
_last_harmonic_notch_center_freq_hz = gyro_harmonic_notch_center_freq_hz(); |
|
|
|
|
} |
|
|
|
|
// possily update the notch filter parameters
|
|
|
|
|
if (!is_equal(_last_notch_center_freq_hz, _gyro_notch_center_freq_hz()) || |
|
|
|
|