Skip to content

Commit

Permalink
Copter: Autotune: Little tweek to squash
Browse files Browse the repository at this point in the history
  • Loading branch information
lthall committed Feb 18, 2024
1 parent 8fd228d commit 373f7b3
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions libraries/AC_AutoTune/AC_AutoTune_Multi.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -511,14 +511,14 @@ void AC_AutoTune_Multi::twitching_test_rate(float rate, float rate_target_max, f
}

// capture minimum measurement after the measurement has peaked (aka "bounce back")
if ((rate < meas_rate_min) && (meas_rate_max > rate_target_max * 0.5f)) {
if ((rate < meas_rate_min) && (meas_rate_max > rate_target_max * 0.25)) {
// the measurement is bouncing back
meas_rate_min = rate;
}

// calculate early stopping time based on the time it takes to get to 75%
if (meas_rate_max < rate_target_max * 0.75f) {
// the measurement not reached the 75% threshold yet
if (meas_rate_max < rate_target_max * 63.21) {
// the measurement not reached the 63.21% threshold yet
step_time_limit_ms = (now - step_start_time_ms) * 3;
step_time_limit_ms = MIN(step_time_limit_ms, AUTOTUNE_TESTING_STEP_TIMEOUT_MS);
}
Expand Down Expand Up @@ -574,7 +574,7 @@ void AC_AutoTune_Multi::twitching_test_angle(float angle, float rate, float angl
}

// capture minimum angle after we have reached a reasonable maximum angle
if ((angle < meas_angle_min) && (meas_angle_max > angle_target_max * 0.5f)) {
if ((angle < meas_angle_min) && (meas_angle_max > angle_target_max * 0.25)) {
// the measurement is bouncing back
meas_angle_min = angle;
}
Expand All @@ -593,8 +593,8 @@ void AC_AutoTune_Multi::twitching_test_angle(float angle, float rate, float angl
}

// calculate early stopping time based on the time it takes to get to 75%
if (meas_angle_max < angle_target_max * 0.75f) {
// the measurement not reached the 75% threshold yet
if (meas_angle_max < angle_target_max * 63.21) {
// the measurement not reached the 63.21% threshold yet
step_time_limit_ms = (now - step_start_time_ms) * 3;
step_time_limit_ms = MIN(step_time_limit_ms, AUTOTUNE_TESTING_STEP_TIMEOUT_MS);
}
Expand Down

0 comments on commit 373f7b3

Please sign in to comment.