/* This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program. If not, see . */ /* * AP_MotorsMatrixTS.cpp - tailsitters with multicopter motor configuration */ #include #include #include "AP_MotorsMatrixTS.h" extern const AP_HAL::HAL& hal; #define SERVO_OUTPUT_RANGE 4500 // output a thrust to all motors that match a given motor mask. This // is used to control motors enabled for forward flight. Thrust is in // the range 0 to 1 void AP_MotorsMatrixTS::output_motor_mask(float thrust, uint8_t mask, float rudder_dt) { const int16_t pwm_min = get_pwm_output_min(); const int16_t pwm_range = get_pwm_output_max() - pwm_min; for (uint8_t i=0; i= _throttle_thrust_max) { throttle_thrust = _throttle_thrust_max; limit.throttle_upper = true; } thrust_max = 0.0f; for (int i=0; i 1.0f) { thr_adj = 1.0f - thrust_max; limit.throttle_upper = true; limit.roll = true; limit.pitch = true; for (int i=0; i