From ffb8fb438392bcb2c47a452fe4dc65b0831198e2 Mon Sep 17 00:00:00 2001 From: Silvan Fuhrer Date: Mon, 8 Aug 2022 13:28:17 +0200 Subject: [PATCH] Allocation: add SteeringWheel type control surface Directly use yaw controls for it, and don't add it to the allocation matrix, as that would have an effect on rudder scaling if the wheel also would have a yaw effectiveness. Signed-off-by: Silvan Fuhrer --- .../ActuatorEffectivenessControlSurfaces.cpp | 13 +++++++++++-- .../ActuatorEffectivenessControlSurfaces.hpp | 5 +++-- .../ActuatorEffectivenessFixedWing.cpp | 8 +++++--- .../ActuatorEffectivenessStandardVTOL.cpp | 8 +++++--- .../ActuatorEffectivenessTiltrotorVTOL.cpp | 4 +++- src/modules/control_allocator/module.yaml | 5 +++++ 6 files changed, 32 insertions(+), 11 deletions(-) diff --git a/src/modules/control_allocator/ActuatorEffectiveness/ActuatorEffectivenessControlSurfaces.cpp b/src/modules/control_allocator/ActuatorEffectiveness/ActuatorEffectivenessControlSurfaces.cpp index 27288299b6..58b4579e48 100644 --- a/src/modules/control_allocator/ActuatorEffectiveness/ActuatorEffectivenessControlSurfaces.cpp +++ b/src/modules/control_allocator/ActuatorEffectiveness/ActuatorEffectivenessControlSurfaces.cpp @@ -129,6 +129,11 @@ void ActuatorEffectivenessControlSurfaces::updateParams() case Type::SingleChannelAileron: break; + + case Type::SteeringWheel: + torque.setZero(); + break; + } } } @@ -146,8 +151,8 @@ bool ActuatorEffectivenessControlSurfaces::addActuators(Configuration &configura return true; } -void ActuatorEffectivenessControlSurfaces::applyFlapsAndAirbrakes(float flaps_control, float airbrakes_control, - int first_actuator_idx, +void ActuatorEffectivenessControlSurfaces::applyFlapsAirbrakesWheel(float flaps_control, float airbrakes_control, + float wheel_control, int first_actuator_idx, ActuatorVector &actuator_sp) const { for (int i = 0; i < _count; ++i) { @@ -165,6 +170,10 @@ void ActuatorEffectivenessControlSurfaces::applyFlapsAndAirbrakes(float flaps_co actuator_sp(i + first_actuator_idx) += airbrakes_control; break; + case ActuatorEffectivenessControlSurfaces::Type::SteeringWheel: + actuator_sp(i + first_actuator_idx) += wheel_control; + break; + default: break; } diff --git a/src/modules/control_allocator/ActuatorEffectiveness/ActuatorEffectivenessControlSurfaces.hpp b/src/modules/control_allocator/ActuatorEffectiveness/ActuatorEffectivenessControlSurfaces.hpp index efb51e0d6e..bb45604ce7 100644 --- a/src/modules/control_allocator/ActuatorEffectiveness/ActuatorEffectivenessControlSurfaces.hpp +++ b/src/modules/control_allocator/ActuatorEffectiveness/ActuatorEffectivenessControlSurfaces.hpp @@ -60,6 +60,7 @@ public: LeftATail = 13, RightATail = 14, SingleChannelAileron = 15, + SteeringWheel = 16, }; struct Params { @@ -80,8 +81,8 @@ public: const Params &config(int idx) const { return _params[idx]; } - void applyFlapsAndAirbrakes(float flaps_control, float airbrakes_control, int first_actuator_idx, - ActuatorVector &actuator_sp) const; + void applyFlapsAirbrakesWheel(float flaps_control, float airbrakes_control, float wheel_control, int first_actuator_idx, + ActuatorVector &actuator_sp) const; private: void updateParams() override; diff --git a/src/modules/control_allocator/ActuatorEffectiveness/ActuatorEffectivenessFixedWing.cpp b/src/modules/control_allocator/ActuatorEffectiveness/ActuatorEffectivenessFixedWing.cpp index bddc95e913..97b7f89c0b 100644 --- a/src/modules/control_allocator/ActuatorEffectiveness/ActuatorEffectivenessFixedWing.cpp +++ b/src/modules/control_allocator/ActuatorEffectiveness/ActuatorEffectivenessFixedWing.cpp @@ -68,8 +68,10 @@ void ActuatorEffectivenessFixedWing::updateSetpoint(const matrix::Vector