mirror of
https://gitee.com/mirrors_PX4/PX4-Autopilot.git
synced 2026-07-14 02:50:35 +08:00
feat(actuators): Control Flaps from AUX channel (#26913)
* feat(rc): flaps via AUX channel * docs(actuators): add flaps and spoilers from RC Co-authored-by: Silvan Fuhrer <silvan@auterion.com> * docs(actuators): Update docs/en/payloads/generic_actuator_control.md Co-authored-by: Hamish Willee <hamishwillee@gmail.com> * docs(actuators): move flaps setup docs --------- Co-authored-by: Silvan Fuhrer <silvan@auterion.com> Co-authored-by: Hamish Willee <hamishwillee@gmail.com>
This commit is contained in:
@@ -469,9 +469,35 @@ void FixedwingRateControl::Run()
|
||||
// Flaps control
|
||||
float flaps_control = 0.f; // default to no flaps
|
||||
|
||||
/* map flaps by default to manual if valid */
|
||||
if (PX4_ISFINITE(_manual_control_setpoint.flaps)) {
|
||||
flaps_control = math::max(_manual_control_setpoint.flaps, 0.f); // do not consider negative switch settings
|
||||
switch (_param_fw_flaps_man.get()) { // do not consider negative switch settings
|
||||
case 0:
|
||||
break;
|
||||
|
||||
case 1:
|
||||
flaps_control = PX4_ISFINITE(_manual_control_setpoint.aux1) ? math::max(_manual_control_setpoint.aux1, 0.f) : 0.f;
|
||||
break;
|
||||
|
||||
case 2:
|
||||
flaps_control = PX4_ISFINITE(_manual_control_setpoint.aux2) ? math::max(_manual_control_setpoint.aux2, 0.f) : 0.f;
|
||||
break;
|
||||
|
||||
case 3:
|
||||
flaps_control = PX4_ISFINITE(_manual_control_setpoint.aux3) ? math::max(_manual_control_setpoint.aux3, 0.f) : 0.f;
|
||||
break;
|
||||
|
||||
case 4:
|
||||
flaps_control = PX4_ISFINITE(_manual_control_setpoint.aux4) ? math::max(_manual_control_setpoint.aux4, 0.f) : 0.f;
|
||||
break;
|
||||
|
||||
case 5:
|
||||
flaps_control = PX4_ISFINITE(_manual_control_setpoint.aux5) ? math::max(_manual_control_setpoint.aux5, 0.f) : 0.f;
|
||||
break;
|
||||
|
||||
case 6:
|
||||
flaps_control = PX4_ISFINITE(_manual_control_setpoint.flaps) ? math::max(_manual_control_setpoint.flaps, 0.f) : 0.f;
|
||||
break;
|
||||
|
||||
|
||||
}
|
||||
|
||||
normalized_unsigned_setpoint_s flaps_setpoint;
|
||||
@@ -482,19 +508,29 @@ void FixedwingRateControl::Run()
|
||||
// Spoilers control
|
||||
float spoilers_control = 0.f; // default to no spoilers
|
||||
|
||||
switch (_param_fw_spoilers_man.get()) {
|
||||
switch (_param_fw_spoilers_man.get()) { // do not consider negative switch settings
|
||||
case 0:
|
||||
break;
|
||||
|
||||
case 1:
|
||||
// do not consider negative switch settings
|
||||
spoilers_control = PX4_ISFINITE(_manual_control_setpoint.flaps) ? math::max(_manual_control_setpoint.flaps, 0.f) : 0.f;
|
||||
break;
|
||||
|
||||
case 2:
|
||||
// do not consider negative switch settings
|
||||
spoilers_control = PX4_ISFINITE(_manual_control_setpoint.aux1) ? math::max(_manual_control_setpoint.aux1, 0.f) : 0.f;
|
||||
break;
|
||||
|
||||
case 3:
|
||||
spoilers_control = PX4_ISFINITE(_manual_control_setpoint.aux2) ? math::max(_manual_control_setpoint.aux2, 0.f) : 0.f;
|
||||
break;
|
||||
|
||||
case 4:
|
||||
spoilers_control = PX4_ISFINITE(_manual_control_setpoint.aux3) ? math::max(_manual_control_setpoint.aux3, 0.f) : 0.f;
|
||||
break;
|
||||
|
||||
case 5:
|
||||
spoilers_control = PX4_ISFINITE(_manual_control_setpoint.aux4) ? math::max(_manual_control_setpoint.aux4, 0.f) : 0.f;
|
||||
break;
|
||||
}
|
||||
|
||||
normalized_unsigned_setpoint_s spoilers_setpoint;
|
||||
|
||||
@@ -213,7 +213,8 @@ private:
|
||||
(ParamFloat<px4::params::TRIM_ROLL>) _param_trim_roll,
|
||||
(ParamFloat<px4::params::TRIM_YAW>) _param_trim_yaw,
|
||||
|
||||
(ParamInt<px4::params::FW_SPOILERS_MAN>) _param_fw_spoilers_man
|
||||
(ParamInt<px4::params::FW_SPOILERS_MAN>) _param_fw_spoilers_man,
|
||||
(ParamInt<px4::params::FW_FLAPS_MAN>) _param_fw_flaps_man
|
||||
)
|
||||
|
||||
RateControl _rate_control; ///< class for rate control calculations
|
||||
|
||||
@@ -326,6 +326,24 @@ parameters:
|
||||
0: Disabled
|
||||
1: Flaps channel
|
||||
2: Aux1
|
||||
3: Aux2
|
||||
4: Aux3
|
||||
5: Aux4
|
||||
6: Aux5
|
||||
default: 0
|
||||
FW_FLAPS_MAN:
|
||||
description:
|
||||
short: Flap input in manual flight
|
||||
long: Chose source for manual setting of flaps in manual flight modes.
|
||||
type: enum
|
||||
values:
|
||||
0: Disabled
|
||||
1: Aux1
|
||||
2: Aux2
|
||||
3: Aux3
|
||||
4: Aux4
|
||||
5: Aux5
|
||||
6: Flaps channel
|
||||
default: 0
|
||||
FW_ACRO_YAW_EN:
|
||||
description:
|
||||
|
||||
Reference in New Issue
Block a user