Issue with finding Kp

I dont know what is wrong. I cant seem to find the kP. I have used every value going up in 0.1 starting from 0, going up to 2.

As you can see, the code is meant to make the robot go around in a square and velocity 25. It has never done this even though i have changed the kP from 0-2 going up in 0.1, even sometimes 0.05. Any help will be appreciated

Can you also show us screen shots of the PStraight and GyroTurn functions?

Can you describe the actual problem? What does it do when you run the code?

Simply stating that it doesn’t work the way it should is not very useful information when it comes to debugging.

2 Likes

This is the code from Caution Tape’s youtube

What is it doing? I would tune Kp independently and in a straight line only. One increment at a time. It is a balance between speed and correction (Kp).

Once that is tuned, then it is a matter of integrating it in to your routine. When you know your speed and Kp are matched, you can add in small ‘wait’ increments and increase your momentum stop on turns to increase precision of your routine.

I was curious if you code had any mistakes that would cause issues. It’s hard to diagnose if we don’t have all of the information.

3 Likes

Fair point.