1 package org
.usfirst
.frc
.team3501
.robot
.subsystems
;
3 import org
.usfirst
.frc
.team3501
.robot
.Constants
;
4 import org
.usfirst
.frc
.team3501
.robot
.Constants
.Shooter
.State
;
5 import org
.usfirst
.frc
.team3501
.robot
.Robot
;
7 import edu
.wpi
.first
.wpilibj
.CANTalon
;
8 import edu
.wpi
.first
.wpilibj
.command
.Subsystem
;
10 public class Shooter
extends Subsystem
{
11 private CANTalon shooter
;
15 shooter
= new CANTalon(Constants
.Shooter
.PORT
);
16 state
= State
.STOPPED
;
19 public double getCurrentSpeed() {
23 public void setSpeed(double speed
) {
24 state
= State
.RUNNING
;
28 public void shooterButtonsPressed() {
30 if (Robot
.oi
.incrementSpeed
.get()) {
34 if (Robot
.oi
.decrementSpeed
.get()) {
38 if (Robot
.oi
.trigger
.get()) {
39 if (this.getState() == State
.STOPPED
)
42 if (this.getState() == State
.RUNNING
) {
47 if (Robot
.oi
.outputCurrentShooterSpeed
.get()) {
48 System
.out
.println("Current Shooter Speed: " + getCurrentSpeed());
56 private State
getState() {
60 // Use negative # for decrement. Positive for increment.
61 public void changeSpeed(double change
) {
62 if (getCurrentSpeed() + change
>= 1.0)
64 else if (getCurrentSpeed() + change
<= -1.0)
67 double newSpeed
= getCurrentSpeed() + change
;
70 this.state
= State
.RUNNING
;
74 protected void initDefaultCommand() {