mirror of https://github.com/ArduPilot/ardupilot
AP_Motors: smoother ramp down in output_motor_mask
stop changing motors outside the given mask in output_motor_mask, which gives smoother ramp down in tilt quadplanes when we are transitioning to forward flight thanks to Pete for the suggestion
This commit is contained in:
parent
2b784e01f9
commit
171da3dd08
|
@ -733,8 +733,8 @@ void AP_MotorsMulticopter::output_motor_mask(float thrust, uint16_t mask, float
|
||||||
_motor_mask_override = mask;
|
_motor_mask_override = mask;
|
||||||
|
|
||||||
for (uint8_t i = 0; i < AP_MOTORS_MAX_NUM_MOTORS; i++) {
|
for (uint8_t i = 0; i < AP_MOTORS_MAX_NUM_MOTORS; i++) {
|
||||||
if (motor_enabled[i]) {
|
if (motor_enabled[i] && (mask & (1U << i)) != 0) {
|
||||||
if ((mask & (1U << i)) && armed() && get_interlock()) {
|
if (armed() && get_interlock()) {
|
||||||
/*
|
/*
|
||||||
apply rudder mixing differential thrust
|
apply rudder mixing differential thrust
|
||||||
copter frame roll is plane frame yaw as this only
|
copter frame roll is plane frame yaw as this only
|
||||||
|
@ -742,11 +742,12 @@ void AP_MotorsMulticopter::output_motor_mask(float thrust, uint16_t mask, float
|
||||||
*/
|
*/
|
||||||
float diff_thrust = get_roll_factor(i) * rudder_dt * 0.5f;
|
float diff_thrust = get_roll_factor(i) * rudder_dt * 0.5f;
|
||||||
set_actuator_with_slew(_actuator[i], thrust + diff_thrust);
|
set_actuator_with_slew(_actuator[i], thrust + diff_thrust);
|
||||||
|
} else {
|
||||||
|
// zero throttle
|
||||||
|
_actuator[i] = 0.0;
|
||||||
|
}
|
||||||
int16_t pwm_output = pwm_min + pwm_range * _actuator[i];
|
int16_t pwm_output = pwm_min + pwm_range * _actuator[i];
|
||||||
rc_write(i, pwm_output);
|
rc_write(i, pwm_output);
|
||||||
} else {
|
|
||||||
rc_write(i, pwm_min);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -92,7 +92,7 @@ void AP_MotorsTri::output_to_motors()
|
||||||
// sends minimum values out to the motors
|
// sends minimum values out to the motors
|
||||||
for (uint8_t i = 0; i < AP_MOTORS_MAX_NUM_MOTORS; i++) {
|
for (uint8_t i = 0; i < AP_MOTORS_MAX_NUM_MOTORS; i++) {
|
||||||
if (motor_enabled_mask(i)) {
|
if (motor_enabled_mask(i)) {
|
||||||
rc_write(AP_MOTORS_MOT_1+i, output_to_pwm(0));
|
_actuator[AP_MOTORS_MOT_1+i] = 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
rc_write_angle(AP_MOTORS_CH_TRI_YAW, 0);
|
rc_write_angle(AP_MOTORS_CH_TRI_YAW, 0);
|
||||||
|
|
Loading…
Reference in New Issue