PID Questions

Hello, So i’m trying to understand PID in the off-season before 2017. For the most part things have been normal and fully working but i do have some questions on certain things. Any assistance would be greatly appreciated

  1. How would you handle an output to multiple motors? i know for 2 motors most teams would use a “y” cable, but what would you do if you had to control 3 motors (such as a 6 cim drive-train)? is there any example code on how to do so?

  2. I’ve studied up on the methods of tuning (Ziegler-Nichols) and i’m aware of how to properly tune the loop, but what are your starting value for the constants? like people say “increase P Gain until it oscillates”, but what is a good starting point for the P Gain, I Gain, and D Gain?

Thank you for your time

For CAN Talons you can put one or more into “follow mode”. That said, we never bothered with a y-cable in two motor configuration either. We would just set both motors in code to the same value, it was never a problem.

Set I and D to zero. For your initial P you can just guess or do a little math. Based on the 2/3 motor question I am assuming this is a drive train, and I am going to assume you going for a distance PID. Using your max error (which is going to be the longest distance you will be going), a reasonable swag would be 0.7 / that distance, but if 0.7 of your max accel is too strong, set it lower. Feel free to go up and down in pretty large increments. I always test first on blocks and generally with a max power limit set to ~.3 just as a sanity check (are the wheels going the right direction, the same direction, etc).

  1. Just as you can define a single motor, you can define several motors. You do this for left and right already, right? So define many motors for a side, and when you send the value to one motor, repeat that same line of code to send it to motor 2, motor 3, and so on. That sends the same drive value to multiple motors.

Note that there may be more efficient ways, depending on the programming language, but brute force will get it done.

  1. Asphurley67 stated, do a little math for P by following your code on paper, and see what multiplier will give you something reasonably in range.

When trying something new, it never hurts to step through each line of code by hand, on paper, to see what will happen. Lots of bugs are found this way…