Make flap slew rate configurable (#26240)

* Make flap slew rate configurable

* Dynamically update params
This commit is contained in:
Jaeyoung Lim
2026-01-09 06:37:34 -08:00
committed by GitHub
parent f4247aee58
commit 9fe69d4f33
3 changed files with 16 additions and 2 deletions
@@ -59,7 +59,7 @@ ActuatorEffectivenessControlSurfaces::ActuatorEffectivenessControlSurfaces(Modul
_param_handles[i].scale_spoiler = param_find(buffer);
}
_flaps_setpoint_with_slewrate.setSlewRate(kFlapSlewRate);
_flaps_setpoint_with_slewrate.setSlewRate(_param_ca_flap_slew.get());
_spoilers_setpoint_with_slewrate.setSlewRate(kSpoilersSlewRate);
_count_handle = param_find("CA_SV_CS_COUNT");
@@ -75,6 +75,9 @@ void ActuatorEffectivenessControlSurfaces::updateParams()
return;
}
// Update flap slewrates
_flaps_setpoint_with_slewrate.setSlewRate(_param_ca_flap_slew.get());
// Helper to check if a PWM center parameter is enabled, and clamp it to valid range
auto check_pwm_center = [](const char *prefix, int channel) -> bool {
char param_name[20];
@@ -38,7 +38,6 @@
#include <px4_platform_common/module_params.h>
#include <lib/slew_rate/SlewRate.hpp>
static constexpr float kFlapSlewRate = 0.5f; // slew rate for normalized flaps setpoint [1/s]
static constexpr float kSpoilersSlewRate = 0.5f; // slew rate for normalized spoilers setpoint [1/s]
class ActuatorEffectivenessControlSurfaces : public ModuleParams, public ActuatorEffectiveness
@@ -111,4 +110,7 @@ private:
SlewRate<float> _flaps_setpoint_with_slewrate;
SlewRate<float> _spoilers_setpoint_with_slewrate;
DEFINE_PARAMETERS(
(ParamFloat<px4::params::CA_SV_FLAP_SLEW>) _param_ca_flap_slew
)
};
@@ -336,6 +336,15 @@ parameters:
instance_start: 0
default: 0
CA_SV_FLAP_SLEW:
description:
short: Control Surface slew rate for normalized flaps setpoint
type: float
decimal: 1
min: 0.0
max: 5.0
default: 0.5
CA_SV_CS${i}_SPOIL:
description:
short: Control Surface ${i} configuration as spoiler