| 1 | package org.usfirst.frc.team3501.robot.subsystems; |
| 2 | |
| 3 | import org.usfirst.frc.team3501.robot.Constants; |
| 4 | |
| 5 | import com.ctre.CANTalon; |
| 6 | |
| 7 | import edu.wpi.first.wpilibj.command.Subsystem; |
| 8 | |
| 9 | public class Shooter extends Subsystem { |
| 10 | public double wheelP = 0.005, wheelI = 0.001, wheelD = -0.003; |
| 11 | private static Shooter shooter; |
| 12 | private final CANTalon flyWheel, indexWheel; |
| 13 | |
| 14 | public static final double DEFAULT_INDEXING_SPEED = 0; |
| 15 | public static final double DEFAULT_SHOOTING_SPEED = 0; |
| 16 | public static double CURRENT_SHOOTING_SPEED; |
| 17 | |
| 18 | public static final double SHOOTING_SPEED_INCREMENT = 0; |
| 19 | |
| 20 | private Shooter() { |
| 21 | flyWheel = new CANTalon(Constants.Shooter.FLY_WHEEL); |
| 22 | indexWheel = new CANTalon(Constants.Shooter.INDEX_WHEEL); |
| 23 | |
| 24 | } |
| 25 | |
| 26 | /** |
| 27 | * Returns shooter object |
| 28 | * |
| 29 | * @return Shooter object |
| 30 | */ |
| 31 | public static Shooter getShooter() { |
| 32 | if (shooter == null) { |
| 33 | shooter = new Shooter(); |
| 34 | } |
| 35 | return shooter; |
| 36 | } |
| 37 | |
| 38 | /** |
| 39 | * Sets fly wheel motor value to input. |
| 40 | * |
| 41 | * @param val |
| 42 | * motor value from -1 to 1(fastest forward) |
| 43 | */ |
| 44 | public void setFlyWheelMotorVal(final double val) { |
| 45 | flyWheel.set(val); |
| 46 | } |
| 47 | |
| 48 | /** |
| 49 | * Stops fly wheel motor. |
| 50 | */ |
| 51 | public void stopFlyWheel() { |
| 52 | flyWheel.set(0); |
| 53 | } |
| 54 | |
| 55 | /** |
| 56 | * Sets index wheel motor value to input. |
| 57 | * |
| 58 | * @param val |
| 59 | * motor value from -1 to 1(fastest forward) |
| 60 | */ |
| 61 | public void setIndexWheelMotorVal(final double val) { |
| 62 | indexWheel.set(val); |
| 63 | } |
| 64 | |
| 65 | /** |
| 66 | * Stops index wheel motor. |
| 67 | */ |
| 68 | public void stopIndexWheel() { |
| 69 | indexWheel.set(0); |
| 70 | } |
| 71 | |
| 72 | @Override |
| 73 | protected void initDefaultCommand() { |
| 74 | |
| 75 | } |
| 76 | |
| 77 | public double getShooterSpeed() { |
| 78 | return 1.0; |
| 79 | } |
| 80 | } |