It’s my first time using a PId Controller
Look at the loop tuning section
Read this. Also, all credit goes to George Gillard for making this guide.
I recently tuned a bunch of PID controllers for my robot. I think it worked pretty well for my robot’s lift. If you have a wireless programming cable, it is very much worthwhile to print values to terminal (with PROS, this can be accomplished by having the robot
printf
the data values for error, motor power, Kp *error, Ki * integral, and Kd * derivative so you can see how each is affecting the power the motors are putting out at certain distances from the goal value. Open the terminal with the command
pros terminal
if you are using PROS).
With ROBOTC I suggest just making the goal location, kp,ki and kd values all global variables. That way you can live debug and edit them on the fly
download
start
set goal
change constants
set goal
change constants
set goal
decide on perfect constants and add them to program and redownload
Using a USB A-A cable makes the data loss much less.
The Ziegler Nichols method works great. Get kp gig enough to just at the first totally non-damping value and then get the time between peaks (this is where the logging a ton is key). Just be careful as it could make your robot thrash about.
Plop them int he formulas and voila! You got a pretty well tuned PID controller. (for semi-large distances, for small changes, it generally does not give enough force to start and stop real well)