I too am having an issue with my PID loop for turning. I followed Connor’s tutorial, but I am attempting to use the inertial sensor, instead of the built-in encoders as the tutorial did. I have been unable to get the loop to work. I noticed that the format of the code above is very different from my code. Would it be wise for me to do a P loop in the style of this one instead of what I tried?
This was my post if you want more information on what I tried.