Hello,
I am trying to code a basic PID loop for my teams robot next year. We want to use a PID loop for controlling the drivetrain with the optical shaft encoders. I have coded something on replit but I don’t think it will work in reality (obviously changing the syntax a little). Unfortunately, I do not have a robot to test this on. Will this work? Is there anything I should change?
Thanks.
Click here for the replit link
it seems like you have 3 cases for if you overshoot your target, are below your target, or on your target. There should only be one case. The PID loop is something that just plugs and chugs, no special cases necessary. for a simple move forward or move backwards case.
Here are two topics in which I helped @JD6 and @Micah_7157X work through @Connor PID code tutorial. I don’t have much time now for interactive guidance, but I’m sure you’ll have the same questions as they did.