When I call my function turn Pid it does what I say for turning but turns back to its organically position and continues with the rest of the code I can’t figure out what is wrong
A few things I see wrong here with the PID it may fix the issue.
- Error should be: error = target - (currentpos - start deg)
-Even though you reset rotation it could be a little off so its safer to do that - What you set as your condition for the while loop is okay, but personally I just use abs(error) > (value)
- turnpdpower should equal (errorkp)-(derivkd)
2 Likes
How would I code the startind deg
@jetstream120 it did not fix the problem
Interesting…can you send a video of what its doing?
i fixed it was how I had programmed the while loop
I am trying to learn turning PID could you tell me what was wrong with your while statement
1 Like