v5 Flywheel PID Code

Hello vex teams of the world,
Recently we have completed our flywheel and have trouble with the velocity PID control for it. Here is the code that we currently use: Can anyone assist us in this problem?

You seem to be confusing your P, I, and D with your kP, kI, and kD. Presumably you defined kP, kI, and kD globally elsewhere. But then topFinal only depends on those and not upon error at all. Also, the same type of issue, if you set kI to 0, do you have any way of recovering kI?

Finally, I would note that the integral part can go crazy at times, so you may end up preferring PD over PID.

could you send some sudo code to go off please, that would help alot thanks in advance.

What he means is that you are setting your “topFinal” output to the sums of the constants kP kI and kD, not the actual values for P, I, and D. You also may want to set the I value to 0 when you reach the target instead of changing the kI constant.

I was under the impression that the v5 system has velocity PID built in, is this coming soon or do i just not have reliable sources?

@Joey The Great it has built in pid but it is pretty bad for consistent velocity control

oh, good to know, i think i’ll stick with cortex for now…

@Joey The Great i would not recommend that since the advantages of v5 far out weigh the disadvantages, even if the pid is not the best i would still say it is worth it to stick with v5

Let’s not turn this into another discussion about Cortex and V5, but I support @Joey The Great in sticking with Cortex for now. Sure, V5 may have more advantages, but we all know Cortex better than V5. And I’m taking the emphasized words “for now…” to draw my conclusion. Eventually, yeah, we should all change over later in the season. But now, you can be competitive with Cortex.

I mean I used it for my ri3d flywheel and it still seems to out preform most flywheels I have seen.

We have been using a v5 flywheel for over a month, and the built in PID seems to be very consistent.

@tabor473 i mean it might just be an error on my part (not finding correct value) so i’ll try to do some more testing.

well, its also the fact that my team is not extremely well-off enough to invest that much money in a system like that