path remembering car

Your interrupt service routines are LwheelSpeed() and RwheelSpeed(). These refer to the array coder[], which is not declared volatile.

In loop(), you refer to the same array. Those references do not necessarily get the latest values from the array elements, because the compiler does not know that the values can change outside of loop.

I using the the adafruit motorshield.

A link would be good.