Browse Source

AP_InertialSensor: count filters to match notch options

this allows for much more complex filter setups as long as not
filtering on all IMUs
apm_2208
Andrew Tridgell 3 years ago
parent
commit
d653499efc
  1. 3
      libraries/AP_InertialSensor/AP_InertialSensor.cpp

3
libraries/AP_InertialSensor/AP_InertialSensor.cpp

@ -930,9 +930,10 @@ AP_InertialSensor::init(uint16_t loop_rate) @@ -930,9 +930,10 @@ AP_InertialSensor::init(uint16_t loop_rate)
// calculate number of notches we might want to use for harmonic notch
if (notch.params.enabled() || fft_enabled) {
const bool double_notch = notch.params.hasOption(HarmonicNotchFilterParams::Options::DoubleNotch);
const bool all_sensors = notch.params.hasOption(HarmonicNotchFilterParams::Options::EnableOnAllIMUs);
num_filters += __builtin_popcount(notch.params.harmonics())
* notch.num_dynamic_notches * (double_notch ? 2 : 1)
* sensors_used;
* (all_sensors?sensors_used:1);
}
}

Loading…
Cancel
Save