PID speed limit

I’ve been working on modifying this code for an autonomous robot that uses a PID controller for orientation. However, I’ve noticed that the maximum speed it reaches is quite low, even after increasing the Drive_Speed value. I’ve read that the controller can significantly reduce the speed. Is there any way to increase the speed without compromising the system’s stability?

Quick suggestion: in moveRobot try clipping instead of scaling. This might require a gain adjustment, but might also give a faster effective top speed.

Further debugging might be helped with datalogging.