Encoder resolution: 1000 state changes per 3 wheel rotations
Actually from above information , I inferred these values below and I don't know how far I am accurate in that , so please need help
Wheel Diameter = 6 in CM
153 + 30 = 183 , so
Track Width = 18.3 in CM
333.3 / 2 = 166.65 / 2 = 83.325 , so
CountsPerRevolution = 83.325
Are these values accurately right ?
--
----
------
---------
--------------
------------------
-----------------------
-----------------------------
----------------------------------
---------------------------------------
thanks a lot OddBot for your post , actually I re-arrange the code in your post , and it seems working good and when I tested it on my encoders I got about 333 change per revolution but the problem is that it just adds incrementally and doesn't descemet when the wheel rotate backward . so please what change in the code should I do to make it decrement .
Actually I meant by track width is the wheelbase of the vehicle, ideally measured as the distance between the two contact points between the wheels and the floor.
Tracked robots tend to have Tracked robots tend to have the tracks slide a lot during turning. This can mess with odometry. I would trade the tracks for wheels if you want a bit more accuracy.
As for what 66 was talking about: you are only using one transition of the four transitions open to you. You can interrupt on A going from low to high as well as A going from high to low. Likewise you can interrupt on both B transitions. This would give you 4 interrupts a opposed to the one you have now, which would give you four times the precision.
I also think that it would take you less time to read and understand (through experimentation) one of the many tutorials available on quadrature encoding than continuing to ask here. I’m saying this for your sake, because if we continue to write your code for you, it will take you longer to understand the subject.