AC_AutoTune: avoid climb rate conversion from float to int32_t to float

This commit is contained in:
Peter Barker 2019-02-28 21:34:54 +11:00 committed by Peter Barker
parent 4c12ba4c2c
commit 1859dd4234

View File

@ -344,8 +344,6 @@ void AC_AutoTune::do_gcs_announcements()
// should be called at 100hz or more // should be called at 100hz or more
void AC_AutoTune::run() void AC_AutoTune::run()
{ {
int32_t target_climb_rate_cms;
// initialize vertical speeds and acceleration // initialize vertical speeds and acceleration
init_z_limits(); init_z_limits();
@ -362,10 +360,10 @@ void AC_AutoTune::run()
get_pilot_desired_rp_yrate_cd(target_roll_cd, target_pitch_cd, target_yaw_rate_cds); get_pilot_desired_rp_yrate_cd(target_roll_cd, target_pitch_cd, target_yaw_rate_cds);
// get pilot desired climb rate // get pilot desired climb rate
target_climb_rate_cms = get_pilot_desired_climb_rate_cms(); const float target_climb_rate_cms = get_pilot_desired_climb_rate_cms();
bool zero_rp_input = target_roll_cd == 0 && target_pitch_cd == 0; bool zero_rp_input = target_roll_cd == 0 && target_pitch_cd == 0;
if (!zero_rp_input || target_yaw_rate_cds != 0 || target_climb_rate_cms != 0) { if (!zero_rp_input || target_yaw_rate_cds != 0 || !is_zero(target_climb_rate_cms)) {
if (!pilot_override) { if (!pilot_override) {
pilot_override = true; pilot_override = true;
// set gains to their original values // set gains to their original values