Hey guys,
I’m trying to figure out what is the purpose of the method setPulse
in the MeEncoderOnBoard
class.
My first thought was it was for the number of pulse per rotation, but it is clearly not the intent.
The same question goes to the setRatio
. It thought it was about the wheel radius.
Whe the default values are 9 for the pulse and 39.267 for the ratio?
I looked at the following code :
void MeEncoderOnBoard::updateSpeed(void)
{
if((millis() - _Measurement_speed_time) > 20)
{
uint16_t dt = millis() - _Measurement_speed_time;
long cur_pos = getPulsePos();
setCurrentSpeed(((cur_pos - encode_structure.previousPos) *(1000.0/dt)*60.0) /(encode_structure.pulseEncoder * encode_structure.ratio));
encode_structure.previousPos = cur_pos;
_Measurement_speed_time = millis();
}
}
But I still having trouble to wrap my head around the logic.
Let say the documentation is quite inexistant.
Thank you