I’m new to PID. I have read the sample code(thanks jpearman)link text. The arm motor will generally always be moving; correct(very little once it has reached the target)? Unless the unlikely event that the arm is in equilibrium?
yes, however it should just support it, rather than overshoot it. (if tuned correctly)
@pietrofesar indeed. Actually, the Wikepedia page for PIDs is uncharacteristically helpful (PID controller - Wikipedia). This graph shows what a plot of the correction relative to the event looks like. You can see that it dials in at some point. Error values approach 0 based on adding the three corrections per iteration (with the correct constants). With VEX EDR 393 motors specifically, you will pretty much reach a point where the motor power values will be set to a point too low to have any reasonable amount of torque. It is worth having a threshold check that puts it in a ‘hold’ state otherwise you may see some oscillating. (In theory, if you run the program long enough the I loop may take care of this, but idk how long that would take).
https://upload.wikimedia.org/wikipedia/commons/thumb/a/a3/PID_varyingP.jpg/320px-PID_varyingP.jpg
I have some resources if you want @pietrofesar
The concepts to master is overshoot and undershoot and managing power to get you just where you want.