Just wanted to post a graph of my measured velocities ... or put another way, how well my PD loop is controlling my motors. The motors have been commanded to go 14. 14 = 14 ticks per 20 ms. I have 1000ppr encoders on 3" wheels so that's .1357"/20ms at that speed. Expanding that the bot is traveling 6.7 inches per second or 407.12 inches per minute or 33.9 feet per minute or just for grins .382 miles per hour :D
Anyway, notice the error is only +-1 tick. I may play with adding in an integral component. The graph shows the output of the bot being commanded to drive in a 10" square. The first step drives both motors forward, then stop (it even reverse the motors to effect a quicker stop) then left reverse, right forward to turn to the left 90 degrees, the forward ...
One other neat side affect is that the motors resist any change from the commanded speed. Put another way, if the robot is told to stop (left and right = 0) then if you try to push it, it will resist (actively turn on the motors in the reverse direction. Cool, but is a big battery drain as the current will shoot to 1.2 amps.
Finally, at this PD rate (50Hz) the fastest encoder speed is 18ticks/20 ms which equals 8.7 in/s or 43.6 ft/min or .49 mph :)
Jay