-
Notifications
You must be signed in to change notification settings - Fork 0
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[Pod] Improve wheel encoder measurements #58
Comments
Can you elaborate a bit more on " calculate the incremental difference"? from both pins we will be getting 0/1 and only on a mismatch do you get a valid pulse as implemented in the code which checks both pin values. It first checks a shift in the phase for each of the pins and then a change between A and B. For backwards I was thinking we could decrement it like last year or test to see which pin leads in each scenario as given in the documentation. |
The wheel encoder has two pins out of phase which produce a 2-bit Gray code
and a full rotation of the wheel has four of these cycles (4 CPR), so we want the counter to change by 16 for each rotation. The current implementation considers only when A and B become different: we should also consider when A and B align. We can enumerate the four states and compute the difference between any two states as an integer from -1 to 2.
and this difference value can be directly added to the counter value unless when undersampling. See last year's |
This makes a lot more sense. Thank you! So this is what I am thinking - -> Since we are factoring in the counter moving backwards as well, we can use velocity = distance/ time. Distance decreases, naturally the velocity will also decrease. -> How would you like to handle state 2 in counts so far? I am thinking we skip it (means that we do not update counts so far) and log an error. This approach should handle tracking both pins, account for backward movement, and improve accuracy as suggested. Does this approach seem better and work for you? |
The distance scalar was already considered in #43 and is being further improved in #63, so that's not a big concern. The main area of focus is calculating the state difference and using that to update the counter value. The velocity calculation can then be based on the difference in counter and time since the last counter update. When encountering undersampling, I might see two viable approaches:
|
Following from #11/#43, we added a preliminary wheel encoder implementation which does not utilize the full resolution of the encoder or track undersampling. Rather than updating the counter when only one of the phases changes, we can track both pin values and calculate the incremental difference. The current implement is also unable to distinguish between forwards and backwards. Having an accurate velocity is particularly important since LIM control depends on it.
The text was updated successfully, but these errors were encountered: