How to find your Kp

I was wondering how you find your Kp. I have looked for videos and dont know how to find it
EDIT: I mean how to find the right value for Kp

Do you mean, “How to find the right value for Kp”?

yes thats what i mean

You keep increasing Kp value by 5 (if using wheel revolutions) or .2 (if using degrees) until your bot starts to tip, then start to increase Kd until it doesn’t tip and comes to a stop quickly but smoothly.

There are many strategies to tuning PID controllers.
I personally used this technique that I found on stack exchange (control - What are good strategies for tuning PID loops? - Robotics Stack Exchange) for tuning a robotic platform for a project in my RBE class. Worked pretty well

  1. Set all gains to 0.
  2. Increase Kd until the system oscillates.
  3. Reduce Kd by a factor of 2-4.
  4. Set Kp to about 1% of Kd.
  5. Increase Kp until oscillations start.
  6. Decrease Kp by a factor of 2-4.
  7. Set Ki to about 1% of Kp.
  8. Increase Ki until oscillations start.
  9. Decrease Ki by a factor of 2-4.

Most people start with tuning the p value, and sometimes using integral control will build up error overtime unless you cap it, but this is the general gist of what I do. Here’s a vid on pid tuning if you’re interested in how the values actually effect the system:

6 Likes


in this code( made by caution tape) what is this Ki and Kd.

The Caution Tape code is not full PID code, it only has P (thus the kP parameter), but is lacking the I & D portions. This is probably largely intentional because at most elementary and middle school levels, the I (integral) and D (derivative) are less obvious, and also probably because they’ve got the rest in their code, and why give it all away? :slight_smile:

What the I & D terms do is build up error so that the system can correct over longer distances (at slower speeds) or shorter distances (at faster speed). There are some other posts in here (this is one example for Vex V5 in C, not Blocks/Scratch) that outline a PID loop for both distance closing and driving straight. With some work, it could be brought into IQ Blocks, but at the speeds the IQ robots top out at, kP is probably pretty good for most situations, unless you get a light robot geared 3:1 or something and you need it to fly around the field.

5 Likes

This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.