5
0
mirror of https://github.com/ArduPilot/ardupilot synced 2025-01-08 17:08:28 -04:00

Plane: added Q_ASSIST_DELAY parameter

this allows tuning of the time between assistance thresholds being met
and assistance kicking in. It also changes the default delay from 1s
down to 0.5s based on analysis of a flight where assistance was too
slow
This commit is contained in:
Andrew Tridgell 2020-02-17 12:05:13 +11:00 committed by Peter Barker
parent 147ff6863a
commit 3a0538449c
2 changed files with 13 additions and 3 deletions

View File

@ -484,6 +484,15 @@ const AP_Param::GroupInfo QuadPlane::var_info2[] = {
// @User: Standard
AP_GROUPINFO("TAILSIT_GSCMIN", 18, QuadPlane, tailsitter.gain_scaling_min, 0.4),
// @Param: ASSIST_DELAY
// @DisplayName: Quadplane assistance delay
// @Description: This is delay between the assistance thresholds being met and the assistance starting.
// @Units: s
// @Range: 0 2
// @Increment: 0.1
// @User: Standard
AP_GROUPINFO("ASSIST_DELAY", 19, QuadPlane, assist_delay, 0.5),
AP_GROUPEND
};
@ -1474,8 +1483,8 @@ bool QuadPlane::assistance_needed(float aspeed, bool have_airspeed)
if (alt_error_start_ms == 0) {
alt_error_start_ms = now;
}
if (now - alt_error_start_ms > 500) {
// we've been below assistant alt for 0.5s
if (now - alt_error_start_ms > assist_delay*1000) {
// we've been below assistant alt for Q_ASSIST_DELAY seconds
if (!in_alt_assist) {
in_alt_assist = true;
gcs().send_text(MAV_SEVERITY_INFO, "Alt assist %.1fm", height_above_ground);
@ -1520,7 +1529,7 @@ bool QuadPlane::assistance_needed(float aspeed, bool have_airspeed)
if (angle_error_start_ms == 0) {
angle_error_start_ms = now;
}
bool ret = (now - angle_error_start_ms) >= 1000U;
bool ret = (now - angle_error_start_ms) >= assist_delay*1000;
if (ret && !in_angle_assist) {
in_angle_assist = true;
gcs().send_text(MAV_SEVERITY_INFO, "Angle assist r=%d p=%d",

View File

@ -294,6 +294,7 @@ private:
// angular error at which quad assistance is given
AP_Int8 assist_angle;
uint32_t angle_error_start_ms;
AP_Float assist_delay;
// altitude to trigger assistance
AP_Int16 assist_alt;