mirror of
https://github.com/ArduPilot/ardupilot
synced 2025-02-01 21:48:28 -04:00
Filter: add mutators for notch filter parameters
This commit is contained in:
parent
02e5a7f463
commit
39d928aa49
@ -80,7 +80,7 @@ const AP_Param::GroupInfo HarmonicNotchFilterParams::var_info[] = {
|
|||||||
// @Range: 0 4
|
// @Range: 0 4
|
||||||
// @Values: 0:Disabled,1:Throttle,2:RPM Sensor,3:ESC Telemetry,4:Dynamic FFT,5:Second RPM Sensor
|
// @Values: 0:Disabled,1:Throttle,2:RPM Sensor,3:ESC Telemetry,4:Dynamic FFT,5:Second RPM Sensor
|
||||||
// @User: Advanced
|
// @User: Advanced
|
||||||
AP_GROUPINFO("MODE", 7, HarmonicNotchFilterParams, _tracking_mode, 1),
|
AP_GROUPINFO("MODE", 7, HarmonicNotchFilterParams, _tracking_mode, int8_t(HarmonicNotchDynamicMode::UpdateThrottle)),
|
||||||
|
|
||||||
// @Param: OPTS
|
// @Param: OPTS
|
||||||
// @DisplayName: Harmonic Notch Filter options
|
// @DisplayName: Harmonic Notch Filter options
|
||||||
@ -287,6 +287,19 @@ HarmonicNotchFilterParams::HarmonicNotchFilterParams(void)
|
|||||||
AP_Param::setup_object_defaults(this, var_info);
|
AP_Param::setup_object_defaults(this, var_info);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
save changed parameters
|
||||||
|
*/
|
||||||
|
void HarmonicNotchFilterParams::save_params()
|
||||||
|
{
|
||||||
|
_enable.save();
|
||||||
|
_center_freq_hz.save();
|
||||||
|
_bandwidth_hz.save();
|
||||||
|
_attenuation_dB.save();
|
||||||
|
_harmonics.save();
|
||||||
|
_reference.save();
|
||||||
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
instantiate template classes
|
instantiate template classes
|
||||||
*/
|
*/
|
||||||
|
@ -90,18 +90,24 @@ public:
|
|||||||
HarmonicNotchFilterParams(void);
|
HarmonicNotchFilterParams(void);
|
||||||
// set the fundamental center frequency of the harmonic notch
|
// set the fundamental center frequency of the harmonic notch
|
||||||
void set_center_freq_hz(float center_freq) { _center_freq_hz.set(center_freq); }
|
void set_center_freq_hz(float center_freq) { _center_freq_hz.set(center_freq); }
|
||||||
|
// set the bandwidth of the harmonic notch
|
||||||
|
void set_bandwidth_hz(float bandwidth_hz) { _bandwidth_hz.set(bandwidth_hz); }
|
||||||
// harmonics enabled on the harmonic notch
|
// harmonics enabled on the harmonic notch
|
||||||
uint8_t harmonics(void) const { return _harmonics; }
|
uint8_t harmonics(void) const { return _harmonics; }
|
||||||
// has the user set the harmonics value
|
// has the user set the harmonics value
|
||||||
void set_default_harmonics(uint8_t hmncs) { _harmonics.set_default(hmncs); }
|
void set_default_harmonics(uint8_t hmncs) { _harmonics.set_default(hmncs); }
|
||||||
// reference value of the harmonic notch
|
// reference value of the harmonic notch
|
||||||
float reference(void) const { return _reference; }
|
float reference(void) const { return _reference; }
|
||||||
|
void set_reference(float ref) { _reference = ref; }
|
||||||
// notch options
|
// notch options
|
||||||
bool hasOption(Options option) const { return _options & uint16_t(option); }
|
bool hasOption(Options option) const { return _options & uint16_t(option); }
|
||||||
// notch dynamic tracking mode
|
// notch dynamic tracking mode
|
||||||
HarmonicNotchDynamicMode tracking_mode(void) const { return HarmonicNotchDynamicMode(_tracking_mode.get()); }
|
HarmonicNotchDynamicMode tracking_mode(void) const { return HarmonicNotchDynamicMode(_tracking_mode.get()); }
|
||||||
static const struct AP_Param::GroupInfo var_info[];
|
static const struct AP_Param::GroupInfo var_info[];
|
||||||
|
|
||||||
|
// save parameters
|
||||||
|
void save_params();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
// configured notch harmonics
|
// configured notch harmonics
|
||||||
AP_Int8 _harmonics;
|
AP_Int8 _harmonics;
|
||||||
|
@ -54,6 +54,7 @@ public:
|
|||||||
float bandwidth_hz(void) const { return _bandwidth_hz; }
|
float bandwidth_hz(void) const { return _bandwidth_hz; }
|
||||||
float attenuation_dB(void) const { return _attenuation_dB; }
|
float attenuation_dB(void) const { return _attenuation_dB; }
|
||||||
uint8_t enabled(void) const { return _enable; }
|
uint8_t enabled(void) const { return _enable; }
|
||||||
|
void enable() { _enable.set(true); }
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
AP_Int8 _enable;
|
AP_Int8 _enable;
|
||||||
|
Loading…
Reference in New Issue
Block a user