Plane: improved fwd throttle during VTOL landing

this sets up the vwd integrator more reasonably when we are in
POSITION1 stage of VTOL landing. We need to have enough throttle to
cope with a headwind, but want it lower when we are at or above our
target closing speed so can minimise the amount of pitch up

This also makes the landing_desired_closing_velocity() consistent with
the landing speed used in approach, using average of airspeed min and
cruise speed if TECS_LAND_ARSPD is not set

The target airspeed for TECS during airbraking is now set to
ARSPD_FBW_MIN, on the basis we are trying to slow down to min speed,
and we have VTOL support which should prevent a stall.

To cope with a high headwind where ARSPD_FBW_MIN is below the headwind
we now check for too low achieved closing speed and switch to
POSITION1 which can use vfwd to get to the landing location
This commit is contained in:
Andrew Tridgell 2023-06-17 09:59:19 +10:00 committed by Randy Mackay
parent 86e9679ebb
commit 1ca9af90a6
1 changed files with 28 additions and 7 deletions

View File

@ -2473,10 +2473,11 @@ void QuadPlane::vtol_position_controller(void)
const uint32_t min_airbrake_ms = 1000;
if (poscontrol.get_state() == QPOS_AIRBRAKE &&
poscontrol.time_since_state_start_ms() > min_airbrake_ms &&
(aspeed < aspeed_threshold ||
fabsf(degrees(closing_vel.angle(desired_closing_vel))) > 60 ||
closing_speed > MAX(desired_closing_speed*1.2, desired_closing_speed+2) ||
labs(plane.ahrs.roll_sensor - plane.nav_roll_cd) > attitude_error_threshold_cd ||
(aspeed < aspeed_threshold || // too low airspeed
fabsf(degrees(closing_vel.angle(desired_closing_vel))) > 60 || // wrong direction
closing_speed > MAX(desired_closing_speed*1.2, desired_closing_speed+2) || // too fast
closing_speed < desired_closing_speed*0.5 || // too slow ground speed
labs(plane.ahrs.roll_sensor - plane.nav_roll_cd) > attitude_error_threshold_cd || // bad attitude
labs(plane.ahrs.pitch_sensor - plane.nav_pitch_cd) > attitude_error_threshold_cd)) {
gcs().send_text(MAV_SEVERITY_INFO,"VTOL position1 v=%.1f d=%.1f h=%.1f dc=%.1f",
(double)groundspeed,
@ -2488,6 +2489,18 @@ void QuadPlane::vtol_position_controller(void)
// switch to vfwd for throttle control
vel_forward.integrator = SRV_Channels::get_output_scaled(SRV_Channel::k_throttle);
// adjust the initial forward throttle based on our desired and actual closing speed
// this allows for significant initial forward throttle
// when we have a strong headwind, but low throttle in the usual case where
// we want to slow down ready for POSITION2
vel_forward.integrator = linear_interpolate(0, vel_forward.integrator,
closing_speed,
1.2*desired_closing_speed, 0.5*desired_closing_speed);
// limit our initial forward throttle in POSITION1 to be 0.5 of cruise throttle
vel_forward.integrator = constrain_float(vel_forward.integrator, 0, plane.aparm.throttle_cruise*0.5);
vel_forward.last_ms = now_ms;
}
@ -4098,6 +4111,10 @@ Vector2f QuadPlane::landing_desired_closing_velocity()
float tecs_land_airspeed = plane.TECS_controller.get_land_airspeed();
if (is_positive(tecs_land_airspeed)) {
land_speed = tecs_land_airspeed;
} else {
// use half way between min airspeed and cruise if
// TECS_LAND_AIRSPEED not set
land_speed = 0.5*(land_speed+plane.aparm.airspeed_min);
}
target_speed = MIN(target_speed, eas2tas * land_speed);
@ -4139,12 +4156,16 @@ float QuadPlane::get_land_airspeed(void)
return approach_speed;
}
if (qstate == QPOS_AIRBRAKE) {
// during airbraking ask TECS to slow us to stall speed
return plane.aparm.airspeed_min;
}
// calculate speed based on landing desired velocity
Vector2f vel = landing_desired_closing_velocity();
const Vector3f wind = plane.ahrs.wind_estimate();
const Vector2f wind = plane.ahrs.wind_estimate().xy();
const float eas2tas = plane.ahrs.get_EAS2TAS();
vel.x -= wind.x;
vel.y -= wind.y;
vel -= wind;
vel /= eas2tas;
return vel.length();
}