I am proud to present the third and fourth episode of FRC 0 to Autonomous.
These two videos go through how PID works, how to implement it and tune it, and how to use it to complete the auto-line task.
Did you use an encoder on only one side of the drivetrain? If so, can you explain why? Also, would you be able to turn in auto? And if you use 2 encoders, do you have to tune them separately?
(I don’t know the author, but I think I can help you)
Yes-- If you’re driving straight, ideally both sides of the drivetrain have the same output. Adding functionality for both sides in this example would be redundant and more complex than necessary for someone just learning PID.
If you’re asking about this example, turning would be unpleasant with auto as you’d have to make assumptions about the side without an encoder(e.g. make right side do opposite of left while turning in place) and is undesirable.
(I’m guessing by 2 encoders you mean 1 for each side of the drivetrain) 2 encoders would mean 2 PID loops, so while you can tune them separately, you shouldn’t really have to. In the case that one side acts different mechanically than the other, you can adjust a feedforward to compensate.
If you’re interested in seeing how to code PID in FRC, there is plenty of new documentation for 2020 WPILib.