Plane: tailsitter: transistion to and from inverted flight

This commit is contained in:
Peter Hall 2021-04-07 16:22:19 +01:00 committed by Andrew Tridgell
parent eca8cf3414
commit 105f94f1fd
2 changed files with 7 additions and 17 deletions

View File

@ -1932,7 +1932,7 @@ void QuadPlane::update_transition(void)
assisted_flight = true;
uint32_t dt = now - transition_start_ms;
// multiply by 0.1 to convert (degrees/second * milliseconds) to centi degrees
plane.nav_pitch_cd = constrain_float(transition_initial_pitch - (tailsitter.transition_rate_fw * dt) * 0.1f, -8500, 8500);
plane.nav_pitch_cd = constrain_float(transition_initial_pitch - (tailsitter.transition_rate_fw * dt) * 0.1f * (plane.fly_inverted()?-1.0f:1.0f), -8500, 8500);
plane.nav_roll_cd = 0;
check_attitude_relax();
attitude_control->input_euler_angle_roll_pitch_euler_rate_yaw(plane.nav_roll_cd,

View File

@ -246,20 +246,11 @@ bool QuadPlane::tailsitter_transition_fw_complete(void)
// instant trainsition when disarmed, no message
return true;
}
if (plane.fly_inverted()) {
// transition immediately
gcs().send_text(MAV_SEVERITY_INFO, "Transition FW done, inverted flight");
return true;
}
int32_t roll_cd = labs(ahrs_view->roll_sensor);
if (roll_cd > 9000) {
roll_cd = 18000 - roll_cd;
}
if (labs(ahrs_view->pitch_sensor) > tailsitter.transition_angle_fw*100) {
gcs().send_text(MAV_SEVERITY_INFO, "Transition FW done");
return true;
}
if (roll_cd > MAX(4500, plane.roll_limit_cd + 500)) {
if (labs(ahrs_view->roll_sensor) > MAX(4500, plane.roll_limit_cd + 500)) {
gcs().send_text(MAV_SEVERITY_INFO, "Transition FW done, roll error");
return true;
}
@ -281,11 +272,6 @@ bool QuadPlane::tailsitter_transition_vtol_complete(void) const
// instant trainsition when disarmed, no message
return true;
}
if (plane.fly_inverted()) {
// transition immediately
gcs().send_text(MAV_SEVERITY_INFO, "Transition VTOL done, inverted flight");
return true;
}
// for vectored tailsitters at zero pilot throttle
if ((plane.quadplane.get_pilot_throttle() < .05f) && plane.quadplane._is_vectored) {
// if we are not moving (hence on the ground?) or don't know
@ -300,7 +286,11 @@ bool QuadPlane::tailsitter_transition_vtol_complete(void) const
gcs().send_text(MAV_SEVERITY_INFO, "Transition VTOL done");
return true;
}
if (labs(plane.ahrs.roll_sensor) > MAX(4500, plane.roll_limit_cd + 500)) {
int32_t roll_cd = labs(plane.ahrs.roll_sensor);
if (plane.fly_inverted()) {
roll_cd = 18000 - roll_cd;
}
if (roll_cd > MAX(4500, plane.roll_limit_cd + 500)) {
gcs().send_text(MAV_SEVERITY_INFO, "Transition VTOL done, roll error");
return true;
}