diff --git a/src/modules/control_allocator/ActuatorEffectiveness/ActuatorEffectivenessTailsitterVTOL.cpp b/src/modules/control_allocator/ActuatorEffectiveness/ActuatorEffectivenessTailsitterVTOL.cpp index 7c2150ee9c..aad6d4391b 100644 --- a/src/modules/control_allocator/ActuatorEffectiveness/ActuatorEffectivenessTailsitterVTOL.cpp +++ b/src/modules/control_allocator/ActuatorEffectiveness/ActuatorEffectivenessTailsitterVTOL.cpp @@ -86,7 +86,15 @@ void ActuatorEffectivenessTailsitterVTOL::allocateAuxilaryControls(const float d _control_surfaces.applySpoilers(spoilers_setpoint.normalized_setpoint, _first_control_surface_idx, dt, actuator_sp); } } +} +void ActuatorEffectivenessTailsitterVTOL::updateSetpoint(const matrix::Vector &control_sp, + int matrix_index, ActuatorVector &actuator_sp, const matrix::Vector &actuator_min, + const matrix::Vector &actuator_max) +{ + if (matrix_index == 0) { + stopMaskedMotorsWithZeroThrust(_forwards_motors_mask, actuator_sp); + } } void ActuatorEffectivenessTailsitterVTOL::setFlightPhase(const FlightPhase &flight_phase) @@ -97,15 +105,16 @@ void ActuatorEffectivenessTailsitterVTOL::setFlightPhase(const FlightPhase &flig ActuatorEffectiveness::setFlightPhase(flight_phase); - // update stopped motors //TODO: add option to switch off certain motors in FW + // update stopped motors switch (flight_phase) { case FlightPhase::FORWARD_FLIGHT: - _stopped_motors_mask = 0; + _forwards_motors_mask = _mc_rotors.getUpwardsMotors(); // allocation frame they stay upwards break; case FlightPhase::HOVER_FLIGHT: case FlightPhase::TRANSITION_FF_TO_HF: case FlightPhase::TRANSITION_HF_TO_FF: + _forwards_motors_mask = 0; _stopped_motors_mask = 0; break; } diff --git a/src/modules/control_allocator/ActuatorEffectiveness/ActuatorEffectivenessTailsitterVTOL.hpp b/src/modules/control_allocator/ActuatorEffectiveness/ActuatorEffectivenessTailsitterVTOL.hpp index f5a8ddb460..604f05f9e0 100644 --- a/src/modules/control_allocator/ActuatorEffectiveness/ActuatorEffectivenessTailsitterVTOL.hpp +++ b/src/modules/control_allocator/ActuatorEffectiveness/ActuatorEffectivenessTailsitterVTOL.hpp @@ -72,16 +72,20 @@ public: void allocateAuxilaryControls(const float dt, int matrix_index, ActuatorVector &actuator_sp) override; + void updateSetpoint(const matrix::Vector &control_sp, int matrix_index, + ActuatorVector &actuator_sp, const matrix::Vector &actuator_min, + const matrix::Vector &actuator_max) override; + + void setFlightPhase(const FlightPhase &flight_phase) override; const char *name() const override { return "VTOL Tailsitter"; } - uint32_t getStoppedMotors() const override { return _stopped_motors; } protected: ActuatorEffectivenessRotors _mc_rotors; ActuatorEffectivenessControlSurfaces _control_surfaces; - uint32_t _stopped_motors{}; ///< currently stopped motors + uint32_t _forwards_motors_mask{}; int _first_control_surface_idx{0}; ///< applies to matrix 1