PID Controlled Flywheel

I am a new programmer assigned to code the shooter for our robot. For context, it is a one wheeled shooter with a set hood position powered by two motors. I was told to create a PID loop to control the velocity/rpm of the shooter so that the rotation seems consistent. I just can’t figure out how to implement a PID Controller into VS Code. If anyone can help that would be great.

1 Like

Depends on your speed controllers.

Spark MAX: https://github.com/REVrobotics/SPARK-MAX-Examples/blob/master/Java/Velocity%20Closed%20Loop%20Control/src/main/java/frc/robot/Robot.java

Talon SRX: https://github.com/CrossTheRoadElec/Phoenix-Examples-Languages/blob/master/Java/VelocityClosedLoop_ArbFeedForward/src/main/java/frc/robot/Robot.java

I highly recommend watching 2767s course videos (yes, all of them) on various PID related topics: https://www.strykeforce.org/resources/

You will likely only need a feed forward and a P value to get it decently tuned.

3 Likes

Take a look at the WPILib FrisbeeBot example project.

Also, note that vscode is a text editor, not a programming language.

I believe we are using Talon FX’s that are integrated with Falcon Motors. Are those similar to Talon SRX’s? I will take a look at Stryke Force’s tutorials.

Yes, they will have a similar (if not identical) interface. We haven’t used them so I don’t know the specific differences. I recommend browsing through the Tech Resources tab here to find any relevant info.

Additionally, it is entirely acceptable and normal to look at other people’s code to learn from. I recommend searching for GitHub repositories of teams such as 3847 and 319.

Ok, thanks for the help!

1 Like

This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.