Strange Encoder Problem

We have a big problem here at 358, we were testing our encoders, and it seems that in one direction the encoders say that we have gone 20 feet, and when we go in the opposite direction, it says that we have gone 21 feet, while we go the same distance in both directions. Although I am not sure if this is mechanical, software or electronical yet, I was just wondering if anyone else has had this problem, and how they solved it. If no one has had this problem then we would have to account for it in the program, but that would make a big mess in our code, adding an additional two longs for both forward and back and having the total be the difference of them times their proper coefficients of cource, but I would rather not have to do that to the code. So if you have a solution, your help would be greatly appriciated.

which encoders are you using?

We fixed our highly inconsistent encoder readings in software, by interrupting on both rising and falling edges of the Phase A signal. The apparent root cause of the problem was mechanical jitter, tricking the software into counting multiple times as the encoder stayed roughly in the same place. An electronic solution (search for “7474”) didn’t fix our problem, but it might for you.

What is the actual distance traveled and how many counts per second are you generating?

-Kevin