AP_WheelEncoder: Fix integer division limiting wheel encoder accuracy

CID: 318646
This commit is contained in:
Michael du Breuil 2018-11-05 15:08:56 -07:00 committed by Randy Mackay
parent c712e926d7
commit b38200a960
1 changed files with 1 additions and 1 deletions

View File

@ -269,7 +269,7 @@ float AP_WheelEncoder::get_rate(uint8_t instance) const
}
// calculate delta_angle (in radians) per second
return M_2PI * (state[instance].dist_count_change / _counts_per_revolution[instance]) / (state[instance].dt_ms / 1000.0f);
return M_2PI * (state[instance].dist_count_change / ((float)_counts_per_revolution[instance])) / (state[instance].dt_ms * 1e-3f);
}
// get the total number of sensor reading from the encoder