forked from Archive/PX4-Autopilot
rc_update: remove obsolete RC filtering
This commit is contained in:
parent
17d4fd064f
commit
27586db93e
|
@ -2228,26 +2228,3 @@ PARAM_DEFINE_FLOAT(RC_STAB_TH, 0.5f);
|
|||
* @group Radio Switches
|
||||
*/
|
||||
PARAM_DEFINE_FLOAT(RC_MAN_TH, 0.75f);
|
||||
|
||||
/**
|
||||
* Sample rate of the remote control values for the low pass filter on roll, pitch, yaw and throttle
|
||||
*
|
||||
* Has an influence on the cutoff frequency precision.
|
||||
*
|
||||
* @min 1.0
|
||||
* @unit Hz
|
||||
* @group Radio Calibration
|
||||
*/
|
||||
PARAM_DEFINE_FLOAT(RC_FLT_SMP_RATE, 50.0f);
|
||||
|
||||
/**
|
||||
* Cutoff frequency for the low pass filter on roll, pitch, yaw and throttle
|
||||
*
|
||||
* Does not get set unless below RC_FLT_SMP_RATE/2 because of filter instability characteristics.
|
||||
* Set to 0 to disable the filter.
|
||||
*
|
||||
* @min 0
|
||||
* @unit Hz
|
||||
* @group Radio Calibration
|
||||
*/
|
||||
PARAM_DEFINE_FLOAT(RC_FLT_CUTOFF, 10.0f);
|
||||
|
|
|
@ -106,19 +106,6 @@ RCUpdate::init()
|
|||
void
|
||||
RCUpdate::parameters_updated()
|
||||
{
|
||||
if (_param_rc_flt_smp_rate.get() < 1.0f) {
|
||||
_param_rc_flt_smp_rate.set(1.0f);
|
||||
_param_rc_flt_smp_rate.commit_no_notification();
|
||||
}
|
||||
|
||||
// make sure the filter is in its stable region -> fc < fs/2
|
||||
const float flt_cutoff_max = _param_rc_flt_smp_rate.get() / 2.0f - 1.0f;
|
||||
|
||||
if (_param_rc_flt_cutoff.get() > flt_cutoff_max) {
|
||||
_param_rc_flt_cutoff.set(flt_cutoff_max);
|
||||
_param_rc_flt_cutoff.commit_no_notification();
|
||||
}
|
||||
|
||||
// rc values
|
||||
for (unsigned int i = 0; i < RC_MAX_CHAN_COUNT; i++) {
|
||||
|
||||
|
@ -185,16 +172,6 @@ RCUpdate::update_rc_functions()
|
|||
for (int i = 0; i < rc_parameter_map_s::RC_PARAM_MAP_NCHAN; i++) {
|
||||
_rc.function[rc_channels_s::RC_CHANNELS_FUNCTION_PARAM_1 + i] = _parameters.rc_map_param[i] - 1;
|
||||
}
|
||||
|
||||
/* update the RC low pass filter frequencies */
|
||||
_filter_roll.set_cutoff_frequency(_param_rc_flt_smp_rate.get(), _param_rc_flt_cutoff.get());
|
||||
_filter_pitch.set_cutoff_frequency(_param_rc_flt_smp_rate.get(), _param_rc_flt_cutoff.get());
|
||||
_filter_yaw.set_cutoff_frequency(_param_rc_flt_smp_rate.get(), _param_rc_flt_cutoff.get());
|
||||
_filter_throttle.set_cutoff_frequency(_param_rc_flt_smp_rate.get(), _param_rc_flt_cutoff.get());
|
||||
_filter_roll.reset(0.f);
|
||||
_filter_pitch.reset(0.f);
|
||||
_filter_yaw.reset(0.f);
|
||||
_filter_throttle.reset(0.f);
|
||||
}
|
||||
|
||||
void
|
||||
|
@ -481,12 +458,6 @@ RCUpdate::Run()
|
|||
manual.aux5 = get_rc_value(rc_channels_s::RC_CHANNELS_FUNCTION_AUX_5, -1.0, 1.0);
|
||||
manual.aux6 = get_rc_value(rc_channels_s::RC_CHANNELS_FUNCTION_AUX_6, -1.0, 1.0);
|
||||
|
||||
/* filter controls */
|
||||
manual.y = math::constrain(_filter_roll.apply(manual.y), -1.f, 1.f);
|
||||
manual.x = math::constrain(_filter_pitch.apply(manual.x), -1.f, 1.f);
|
||||
manual.r = math::constrain(_filter_yaw.apply(manual.r), -1.f, 1.f);
|
||||
manual.z = math::constrain(_filter_throttle.apply(manual.z), 0.f, 1.f);
|
||||
|
||||
if (_param_rc_map_fltmode.get() > 0) {
|
||||
/* number of valid slots */
|
||||
const int num_slots = manual_control_setpoint_s::MODE_SLOT_NUM;
|
||||
|
|
|
@ -166,11 +166,6 @@ private:
|
|||
|
||||
hrt_abstime _last_rc_to_param_map_time = 0;
|
||||
|
||||
math::LowPassFilter2p _filter_roll{50.0f, 10.f}; /**< filters for the main 4 stick inputs */
|
||||
math::LowPassFilter2p _filter_pitch{50.0f, 10.f}; /** we want smooth setpoints as inputs to the controllers */
|
||||
math::LowPassFilter2p _filter_yaw{50.0f, 10.f};
|
||||
math::LowPassFilter2p _filter_throttle{50.0f, 10.f};
|
||||
|
||||
perf_counter_t _loop_perf; /**< loop performance counter */
|
||||
|
||||
DEFINE_PARAMETERS(
|
||||
|
@ -223,9 +218,6 @@ private:
|
|||
(ParamFloat<px4::params::RC_MAN_TH>) _param_rc_man_th,
|
||||
(ParamFloat<px4::params::RC_RETURN_TH>) _param_rc_return_th,
|
||||
|
||||
(ParamFloat<px4::params::RC_FLT_SMP_RATE>) _param_rc_flt_smp_rate,
|
||||
(ParamFloat<px4::params::RC_FLT_CUTOFF>) _param_rc_flt_cutoff,
|
||||
|
||||
(ParamInt<px4::params::RC_CHAN_CNT>) _param_rc_chan_cnt
|
||||
)
|
||||
|
||||
|
|
Loading…
Reference in New Issue