Fast PID turning

We currently uses a PID loop for turning, which is pretty accurate. The only downsides of it is that it often takes a long time for it to turn to the desired position: it often turns really fast until it is fairly close to the target, and then takes about 1 second to turn slowly to the desired target. My condition for the loop to end is when my angle is >= the desired angle.

One thing I see many teams do is to have their turns slightly overshoots, but then the robot turn the other way so it reaches the target. My question is, what would the ending condition for this type of turning be, since I wouldn’t be able to use my previously ending condition for this type of turning.

You have to have the condition built so that the loop does not exit until your original condition has been satisfied continuously for a certain period of time (about 0.3-0.8 seconds).

6 Likes

the way I do it (which might not be the best way because I’m not a very good programmer) is that if the margin of error is small, it starts a counter for around half a second, and then exits the loop. That seems to give the turns ample time to settle properly, without taking too long.

6 Likes

Yeah, I do it the same way.

1 Like