Plane: tailsitter: tidy tilt left and right handling

This commit is contained in:
Iampete1 2024-11-16 19:33:50 +00:00 committed by Peter Barker
parent d126c11329
commit e0a8b64e08
1 changed files with 13 additions and 7 deletions

View File

@ -289,9 +289,6 @@ void Tailsitter::output(void)
return;
}
float tilt_left = 0.0f;
float tilt_right = 0.0f;
// throttle 0 to 1
float throttle = SRV_Channels::get_output_scaled(SRV_Channel::k_throttle) * 0.01;
@ -341,6 +338,10 @@ void Tailsitter::output(void)
// set AP_MotorsMatrix throttles for forward flight
motors->output_motor_mask(throttle, motor_mask, plane.rudder_dt);
// No tilt output unless forward gain is set
float tilt_left = 0.0;
float tilt_right = 0.0;
// in forward flight: set motor tilt servos and throttles using FW controller
if (vectored_forward_gain > 0) {
// remove scaling from surface speed scaling and apply throttle scaling
@ -398,8 +399,11 @@ void Tailsitter::output(void)
}
// output tilt motors
tilt_left = 0.0f;
tilt_right = 0.0f;
// No output unless hover gain is set
float tilt_left = 0.0;
float tilt_right = 0.0;
if (vectored_hover_gain > 0) {
const float hover_throttle = motors->get_throttle_hover();
const float output_throttle = motors->get_throttle();
@ -438,8 +442,10 @@ void Tailsitter::output(void)
tailsitter_motors->set_min_throttle(0.0);
}
tilt_left = 0.0f;
tilt_right = 0.0f;
// No tilt output unless hover gain is set
float tilt_left = 0.0;
float tilt_right = 0.0;
if (vectored_hover_gain > 0) {
// thrust vectoring VTOL modes
tilt_left = SRV_Channels::get_output_scaled(SRV_Channel::k_tiltMotorLeft);