Fix import issue to import the right drivetrain
[3501/stronghold-2016] / src / org / usfirst / frc / team3501 / robot / subsystems / Shooter.java
CommitLineData
a0c3ca74
KZ
1package org.usfirst.frc.team3501.robot.subsystems;
2
3import org.usfirst.frc.team3501.robot.Constants;
4import org.usfirst.frc.team3501.robot.Constants.Shooter.State;
5
6import edu.wpi.first.wpilibj.CANTalon;
7import edu.wpi.first.wpilibj.command.Subsystem;
8
9public class Shooter extends Subsystem {
a0c3ca74
KZ
10 private CANTalon shooter;
11
12 public Shooter() {
13 shooter = new CANTalon(Constants.Shooter.PORT);
14 }
15
16 public double getCurrentSetPoint() {
17 return shooter.get();
18 }
19
20 public void setSpeed(double speed) {
913142de 21 if (speed > 1.0)
a0c3ca74 22 shooter.set(1.0);
913142de 23 else if (speed < -1.0)
a0c3ca74
KZ
24 shooter.set(-1.0);
25 else
26 shooter.set(speed);
27 }
28
29 public void stop() {
30 this.setSpeed(0.0);
31 }
32
33 public State getState() {
34 return (this.getCurrentSetPoint() == 0) ? State.RUNNING : State.STOPPED;
35 }
36
37 // Use negative # for decrement. Positive for increment.
38 public void changeSpeed(double change) {
913142de
KZ
39 double newSpeed = getCurrentSetPoint() + change;
40 if (newSpeed > 1.0)
a0c3ca74 41 shooter.set(1.0);
07ceaad8 42 else if (newSpeed < -1.0)
a0c3ca74
KZ
43 shooter.set(-1.0);
44 else {
a0c3ca74
KZ
45 setSpeed(newSpeed);
46 }
47 }
48
49 @Override
50 protected void initDefaultCommand() {
51 }
52}