Plane: added Q_APPROACH_DIST

this sets a minimum distance to use the fixed wing approach logic. It
is an alternative to just disabling the approach with Q_OPTIONS which
some users do to avoid some short distance problems. This allows the
approach to still be used for longer distances in QRTL but have it
disabled for shorter distances
This commit is contained in:
Andrew Tridgell 2024-09-11 10:19:23 +10:00
parent 78f0e78977
commit f3b4f8fdc4
2 changed files with 14 additions and 1 deletions

View File

@ -538,6 +538,15 @@ const AP_Param::GroupInfo QuadPlane::var_info2[] = {
// @User: Standard
AP_GROUPINFO("BCK_PIT_LIM", 38, QuadPlane, q_bck_pitch_lim, 10.0f),
// @Param: APPROACH_DIST
// @DisplayName: Q mode approach distance
// @Description: The minimum distance from the destination to use the fixed wing airbrake and approach code for landing approach. This is useful if you don't want the fixed wing approach logic to be used when you are close to the destination. Set to zero to always use fixed wing approach.
// @Units: m
// @Range: 0.0 1000
// @Increment: 1
// @User: Standard
AP_GROUPINFO("APPROACH_DIST", 39, QuadPlane, approach_distance, 0),
AP_GROUPEND
};
@ -2160,7 +2169,8 @@ void QuadPlane::run_xy_controller(float accel_limit)
void QuadPlane::poscontrol_init_approach(void)
{
const float dist = plane.current_loc.get_distance(plane.next_WP_loc);
if (option_is_set(QuadPlane::OPTION::DISABLE_APPROACH)) {
if (option_is_set(QuadPlane::OPTION::DISABLE_APPROACH) ||
(is_positive(approach_distance) && dist < approach_distance)) {
// go straight to QPOS_POSITION1
poscontrol.set_state(QPOS_POSITION1);
gcs().send_text(MAV_SEVERITY_INFO,"VTOL Position1 d=%.1f", dist);

View File

@ -609,6 +609,9 @@ private:
return (options.get() & int32_t(option)) != 0;
}
// minimum distance to be from destination to use approach logic
AP_Float approach_distance;
AP_Float takeoff_failure_scalar;
AP_Float maximum_takeoff_airspeed;
uint32_t takeoff_start_time_ms;