Copter: use abs() on integers; Location alts are in integer cm

This commit is contained in:
Peter Barker 2016-10-20 13:30:55 +11:00 committed by Lucas De Marchi
parent 96d73affae
commit cc86011d20

View File

@ -335,7 +335,7 @@ void Copter::rtl_descent_run()
attitude_control->input_euler_angle_roll_pitch_euler_rate_yaw(wp_nav->get_roll(), wp_nav->get_pitch(), target_yaw_rate, get_smoothing_gain()); attitude_control->input_euler_angle_roll_pitch_euler_rate_yaw(wp_nav->get_roll(), wp_nav->get_pitch(), target_yaw_rate, get_smoothing_gain());
// check if we've reached within 20cm of final altitude // check if we've reached within 20cm of final altitude
rtl_state_complete = fabsf(rtl_path.descent_target.alt - current_loc.alt) < 20.0f; rtl_state_complete = abs(rtl_path.descent_target.alt - current_loc.alt) < 20;
} }
// rtl_loiterathome_start - initialise controllers to loiter over home // rtl_loiterathome_start - initialise controllers to loiter over home