diff --git a/src/modules/control_allocator/ActuatorEffectiveness/ActuatorEffectivenessHelicopter.cpp b/src/modules/control_allocator/ActuatorEffectiveness/ActuatorEffectivenessHelicopter.cpp index 9faae22ca4..8d3401a6f8 100644 --- a/src/modules/control_allocator/ActuatorEffectiveness/ActuatorEffectivenessHelicopter.cpp +++ b/src/modules/control_allocator/ActuatorEffectiveness/ActuatorEffectivenessHelicopter.cpp @@ -37,8 +37,8 @@ using namespace matrix; using namespace time_literals; -ActuatorEffectivenessHelicopter::ActuatorEffectivenessHelicopter(ModuleParams *parent) - : ModuleParams(parent) +ActuatorEffectivenessHelicopter::ActuatorEffectivenessHelicopter(ModuleParams *parent, ActuatorType tail_actuator_type) + : ModuleParams(parent), _tail_actuator_type(tail_actuator_type) { for (int i = 0; i < NUM_SWASH_PLATE_SERVOS_MAX; ++i) { char buffer[17]; @@ -115,8 +115,8 @@ ActuatorEffectivenessHelicopter::getEffectivenessMatrix(Configuration &configura // As the allocation is non-linear, we use updateSetpoint() instead of the matrix configuration.addActuator(ActuatorType::MOTORS, Vector3f{}, Vector3f{}); - // Tail (yaw) motor - configuration.addActuator(ActuatorType::MOTORS, Vector3f{}, Vector3f{}); + // Tail (yaw) (either ESC or Servo) + configuration.addActuator(_tail_actuator_type, Vector3f{}, Vector3f{}); // N swash plate servos _first_swash_plate_servo_index = configuration.num_actuators_matrix[0]; diff --git a/src/modules/control_allocator/ActuatorEffectiveness/ActuatorEffectivenessHelicopter.hpp b/src/modules/control_allocator/ActuatorEffectiveness/ActuatorEffectivenessHelicopter.hpp index fc66e0044a..439e0f4ab9 100644 --- a/src/modules/control_allocator/ActuatorEffectiveness/ActuatorEffectivenessHelicopter.hpp +++ b/src/modules/control_allocator/ActuatorEffectiveness/ActuatorEffectivenessHelicopter.hpp @@ -66,7 +66,7 @@ public: float spoolup_time; }; - ActuatorEffectivenessHelicopter(ModuleParams *parent); + ActuatorEffectivenessHelicopter(ModuleParams *parent, ActuatorType tail_actuator_type); virtual ~ActuatorEffectivenessHelicopter() = default; bool getEffectivenessMatrix(Configuration &configuration, EffectivenessUpdateReason external_update) override; @@ -129,4 +129,6 @@ private: uORB::Subscription _manual_control_switches_sub{ORB_ID(manual_control_switches)}; bool _main_motor_engaged{true}; + + const ActuatorType _tail_actuator_type; }; diff --git a/src/modules/control_allocator/ControlAllocator.cpp b/src/modules/control_allocator/ControlAllocator.cpp index 2b419ab782..3124df9840 100644 --- a/src/modules/control_allocator/ControlAllocator.cpp +++ b/src/modules/control_allocator/ControlAllocator.cpp @@ -258,8 +258,12 @@ ControlAllocator::update_effectiveness_source() tmp = new ActuatorEffectivenessCustom(this); break; - case EffectivenessSource::HELICOPTER: - tmp = new ActuatorEffectivenessHelicopter(this); + case EffectivenessSource::HELICOPTER_TAIL_ESC: + tmp = new ActuatorEffectivenessHelicopter(this, ActuatorType::MOTORS); + break; + + case EffectivenessSource::HELICOPTER_TAIL_SERVO: + tmp = new ActuatorEffectivenessHelicopter(this, ActuatorType::SERVOS); break; default: diff --git a/src/modules/control_allocator/ControlAllocator.hpp b/src/modules/control_allocator/ControlAllocator.hpp index 0281aa925e..843be9dbc4 100644 --- a/src/modules/control_allocator/ControlAllocator.hpp +++ b/src/modules/control_allocator/ControlAllocator.hpp @@ -153,7 +153,8 @@ private: MOTORS_6DOF = 7, MULTIROTOR_WITH_TILT = 8, CUSTOM = 9, - HELICOPTER = 10, + HELICOPTER_TAIL_ESC = 10, + HELICOPTER_TAIL_SERVO = 11, }; enum class FailureMode { diff --git a/src/modules/control_allocator/module.yaml b/src/modules/control_allocator/module.yaml index e48570dc2b..e5467515cb 100644 --- a/src/modules/control_allocator/module.yaml +++ b/src/modules/control_allocator/module.yaml @@ -27,7 +27,8 @@ parameters: 7: Motors (6DOF) 8: Multirotor with Tilt 9: Custom - 10: Helicopter + 10: Helicopter (tail ESC) + 11: Helicopter (tail Servo) default: 0 CA_METHOD: @@ -1058,7 +1059,7 @@ mixer: advanced: true identifier: 'servo-scale-spoiler' - 10: # Helicopter + 10: # Helicopter (tail ESC) actuators: - actuator_type: 'motor' count: 1 @@ -1087,3 +1088,31 @@ mixer: - label: 'Throttle spoolup time' name: COM_SPOOLUP_TIME + 11: # Helicopter (tail Servo) + actuators: + - actuator_type: 'motor' + count: 1 + item_label_prefix: ['Rotor'] + - actuator_type: 'servo' + item_label_prefix: ['Yaw tail Servo'] + count: 1 + - actuator_type: 'servo' + group_label: 'Swash plate servos' + count: 'CA_SP0_COUNT' + per_item_parameters: + extra: + - name: 'CA_SP0_ANG${i}' + label: 'Angle' + - name: 'CA_SP0_ARM_L${i}' + label: 'Arm Length (relative)' + - name: 'CA_SV_CS${i}_TRIM' + label: 'Trim' + parameters: + - label: 'Yaw compensation scale based on collective pitch' + name: CA_HELI_YAW_CP_S + - label: 'Yaw compensation scale based on throttle' + name: CA_HELI_YAW_TH_S + - label: 'Main rotor turns counter-clockwise' + name: CA_HELI_YAW_CCW + - label: 'Throttle spoolup time' + name: COM_SPOOLUP_TIME