Shooter/FlyWheels
Learn how to program a shooter flywheel.
Intro
At the end of this tutorial you will have a Shooter that works in both real life and simulation with the same code!

Details
This Shooter uses the following hardware and controls:
A
SparkMaxdriving one NEO controls theShooterA
1.5:1gearbox on theShooter, so its top speed is about 5676 RPM (a NEO's free speed) / 1.5 = 3784 RPMTwo 4 inch flywheel wheels on one shaft, 1.5 lb in all
Holding the bottom face button (
Aon an Xbox controller) spins theShooterat 2000 RPMHolding the right face button (
Bon an Xbox controller) spins theShooterat 3000 RPMHolding the left face button (
Xon an Xbox controller) drives theShooterforwardHolding the top face button (
Yon an Xbox controller) drives theShooterbackwardWith no button held, the
Shootercoasts
The steps

Every step has a tab for Java with Commands v2, Java with Commands v3 and C++.
Create a WPILib project and install YAMS and REVLib. Skip this if you already have a project.
Configure the SparkMax and wrap it in a SmartMotorController.
Describe the flywheel with a FlyWheelConfig and create the FlyWheel.
Turn the FlyWheel into commands and bind them to controller buttons.
Run the code on your computer and drive the flywheel with a controller.
Find kV and kP while the simulation runs, and copy them into your code.
The arm's robot step, with the flywheel differences listed at the end of step 5.
Complete Example
The following files show a complete, working Shooter from the YAMS simple_robot-2027 Commands v2 example. It is not the same hardware as this tutorial: it drives two Kraken X60s through TalonFX motor controllers instead of a NEO through a SparkMax, with different gearing and gains. The YAMS parts work the same way.
The same robot in the other two flavors:
Java, Commands v3:
mechanisms/ShooterMechanism.javainexamples/commands3/simple_robot-2027C++:
ShooterSubsystem.handShooterSubsystem.cppinexamples/cpptest
Last updated
Was this helpful?
