Caution Tape P Loop

Lets hypotheically say that I wanted to use this P Loop.
To find the Kp would I just the value of it going up in 0.2 starting from 0, until the robot carries out the command the way I want it to?
As the tuning process

1 Like

Try a very small number(0.05), and then try a big number(0.5), and then narrow it down. I generally use a number from 0.01-0.2

how much do you go up by each time?

The best method is to tune digit-by-digit, in a situation that is repeatable (i.e. make the robot go 90 degrees for all of these trials)

You first start out in the ones place:

kP = 0;

Then increase by 1:

kP = 1;

If 1 is still too low then increase by 1 again:

kP = 2;

Woahh 2 is too high, so we lower back down to 1. Basically you go up until the system becomes out-of-ordinary.

Then, we utilize the second digit and do the same thing.

kP = 2.1;

Seems good so Iâ€™ll increase it again

kP = 2.2;

Okok still fine

kP = 2.3;

The robot seems to be going slightly agressive at 2.3 so I will lower it down to 2.2 again

kP = 2.2;

Looking pretty nicely tuned so far. Then I will do the same thing for the hundredths place.

kP = 2.21;
etc etcâ€¦

This is how you tune to very very fine digits

5 Likes

This is my first time tuning and using PID. So how will I know if the kP is too low or too high?

You test your code every time you change your Kp, regardless of the method that you are using.

When testing, you look for how much it autocorrects vs what the ideal movement would be.

So if you made test code where the robot is intended to drive straight (remember to choose something easily repeatable) and instead it drives in large zig zags then, using your observations, you determine whether you should reduce it. If the robot barely autocorrects and slides to 1 side, use your observations to determine if you need to increase your Kp.

You repeat this every time you determine a new Kp to see if the â€śperfectâ€ť Kp is higher or lower than your one.

3 Likes

So I currently have mine to go in a square, like in Caution Tapes. And it has never even turned right for close to 90 degrees. Sometimes it even goes reverse and turns at very wrong angles

It will probably help if you output the values while you test. Make a separate `When Started` block group and chart how the values change. This will also allow you to test if the gyro is working properly.

1 Like