Browse Source

AC_AutoTune: add internal error check for cases and methods multi should never use

gps-1.3.1
Bill Geyer 3 years ago committed by Bill Geyer
parent
commit
5cfd0502f7
  1. 14
      libraries/AC_AutoTune/AC_AutoTune_Multi.cpp
  2. 20
      libraries/AC_AutoTune/AC_AutoTune_Multi.h

14
libraries/AC_AutoTune/AC_AutoTune_Multi.cpp

@ -130,13 +130,15 @@ void AC_AutoTune_Multi::do_gcs_announcements() @@ -130,13 +130,15 @@ void AC_AutoTune_Multi::do_gcs_announcements()
case RP_UP:
gcs().send_text(MAV_SEVERITY_INFO, "AutoTune: p=%f d=%f", (double)tune_rp, (double)tune_rd);
break;
case RFF_UP:
break;
case SP_DOWN:
case SP_UP:
gcs().send_text(MAV_SEVERITY_INFO, "AutoTune: p=%f accel=%f", (double)tune_sp, (double)tune_accel);
break;
case RFF_UP:
case MAX_GAINS:
// this should never happen
INTERNAL_ERROR(AP_InternalError::error_t::flow_of_control);
break;
case TUNE_COMPLETE:
break;
}
@ -728,6 +730,9 @@ void AC_AutoTune_Multi::set_gains_post_tune(AxisType test_axis) @@ -728,6 +730,9 @@ void AC_AutoTune_Multi::set_gains_post_tune(AxisType test_axis)
break;
case RFF_UP:
case MAX_GAINS:
// this should never happen
INTERNAL_ERROR(AP_InternalError::error_t::flow_of_control);
break;
case TUNE_COMPLETE:
break;
}
@ -1172,6 +1177,11 @@ void AC_AutoTune_Multi::twitch_test_run(AxisType test_axis, const float dir_sign @@ -1172,6 +1177,11 @@ void AC_AutoTune_Multi::twitch_test_run(AxisType test_axis, const float dir_sign
twitching_test_angle(lean_angle, rotation_rate, target_angle*(1+0.5f*aggressiveness), test_angle_min, test_angle_max, test_rate_min, test_rate_max);
twitching_measure_acceleration(test_accel_max, rotation_rate - dir_sign * start_rate, rate_max);
break;
case RFF_UP:
case MAX_GAINS:
// this should never happen
INTERNAL_ERROR(AP_InternalError::error_t::flow_of_control);
break;
default:
break;
}

20
libraries/AC_AutoTune/AC_AutoTune_Multi.h

@ -54,7 +54,10 @@ protected: @@ -54,7 +54,10 @@ protected:
void load_test_gains() override;
// reset the test vaariables for heli
void reset_vehicle_test_variables() override {};
void reset_vehicle_test_variables() override {
// this should never happen
INTERNAL_ERROR(AP_InternalError::error_t::flow_of_control);
}
void test_init() override;
void test_run(AxisType test_axis, const float dir_sign) override;
@ -70,7 +73,10 @@ protected: @@ -70,7 +73,10 @@ protected:
void updating_rate_d_down_all(AxisType test_axis) override;
// update gains for the rate ff up tune type
void updating_rate_ff_up_all(AxisType test_axis) override {};
void updating_rate_ff_up_all(AxisType test_axis) override {
// this should never happen
INTERNAL_ERROR(AP_InternalError::error_t::flow_of_control);
}
// update gains for the angle P up tune type
void updating_angle_p_up_all(AxisType test_axis) override;
@ -79,7 +85,10 @@ protected: @@ -79,7 +85,10 @@ protected:
void updating_angle_p_down_all(AxisType test_axis) override;
// update gains for the max gain tune type
void updating_max_gains_all(AxisType test_axis) override {};
void updating_max_gains_all(AxisType test_axis) override {
// this should never happen
INTERNAL_ERROR(AP_InternalError::error_t::flow_of_control);
}
// set gains post tune for the tune type
void set_gains_post_tune(AxisType test_axis) override;
@ -89,7 +98,10 @@ protected: @@ -89,7 +98,10 @@ protected:
void Log_AutoTune() override;
void Log_AutoTuneDetails() override;
void Log_AutoTuneSweep() override {};
void Log_AutoTuneSweep() override {
// this should never happen
INTERNAL_ERROR(AP_InternalError::error_t::flow_of_control);
}
void Log_Write_AutoTune(uint8_t axis, uint8_t tune_step, float meas_target, float meas_min, float meas_max, float new_gain_rp, float new_gain_rd, float new_gain_sp, float new_ddt);
void Log_Write_AutoTuneDetails(float angle_cd, float rate_cds);

Loading…
Cancel
Save