[FTC]: PID Control in Robot C

So say I want to push a button and this button using PID was to move a encoder to a certain position and since you are using PID it would keep it there. How do you implement PID in robotC code.

So say I want to push a button and this button using PID was to move a encoder to a certain position and since you are using PID it would keep it there. How do you implement PID in robotC code.

Here’s basic encoder information. I think we gave it earlier when you were asking, though. http://say-watt.org/wp2/archives/391

PID wouldn’t help much, from what I can tell. What you do is - when your arm or whatever thing is in the down position, set the encoder to 0, then when you press the button, have it move forward till the encoder click you want and tell it to stop.
I think that’s how it works. I’m a hardware guy, so don’t take my word for it. Email one of our coders at [email protected].

That’s not how PID functions. PID keeps you where you want to be. I’ve already been using PID on my FRC robot but that was LabVIEW. PID is what I want I just dont know how to write it in RobotC. I’ve already done it the way you are suggesting and it doesn’t function the way I want.

Okay - one of our programmers thinks he understands the problem.
When you stop the motor at the encoder click you want, you have to keep setting the power to 0 in an infinite loop. If you just set it once and stop, it won’t continue to send power, thus making it fall.
…Next time i’ll just ask him in the first place. :stuck_out_tongue: