Why my motor will back and forth forward and reverse

when i using the torque mode to control the motor, i have write a pid algorithm in the code, is pretty good, which can make the motor in the constant speed. But when i continued for a period of time. the motor will back and forth forward and reverse.in the end, when i send torque command to the odrive, the motor will run a little.