However, one or more motors will occasionally rotate, spinning out of control without any input from a driver. I'm not sure what would cause this issue if, for the majority of the time, the code does what it's supposed to just fine.
you may want to check your PID gain values, a method you may want to use is the Ziegler-Nichols Method
https://controls.engin.umich.edu/wik...uningClassical