AP_Winch: use floats for get/set output scaled

This commit is contained in:
Iampete1 2021-09-18 18:57:26 +01:00 committed by Andrew Tridgell
parent 76ccbeb0fa
commit 6e4ae3898d
2 changed files with 2 additions and 2 deletions

View File

@ -214,7 +214,7 @@ void AP_Winch_Daiwa::control_winch()
const float rate_limited = get_rate_limited_by_accel(config.rate_desired, dt);
// use linear interpolation to calculate output to move winch at desired rate
int16_t scaled_output = 0;
float scaled_output = 0;
if (!is_zero(rate_limited)) {
scaled_output = linear_interpolate(output_dz, 1000, fabsf(rate_limited), 0, config.rate_max) * (is_positive(rate_limited) ? 1.0f : -1.0f);
}

View File

@ -58,7 +58,7 @@ void AP_Winch_PWM::control_winch()
const float rate_limited = get_rate_limited_by_accel(config.rate_desired, dt);
// use linear interpolation to calculate output to move winch at desired rate
const int16_t scaled_output = linear_interpolate(-1000, 1000, rate_limited, -config.rate_max, config.rate_max);
const float scaled_output = linear_interpolate(-1000, 1000, rate_limited, -config.rate_max, config.rate_max);
SRV_Channels::set_output_scaled(SRV_Channel::k_winch, scaled_output);
// update distance estimate assuming winch will move exactly as requested