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
.rightJoystick
31 .getRawButton(Constants
.OI
.INCREMENT_SHOOTER_PORT
)) {
35 if (Robot
.oi
.rightJoystick
36 .getRawButton(Constants
.OI
.DECREMENT_SHOOTER_PORT
)) {
40 if (Robot
.oi
.rightJoystick
.getRawButton(Constants
.OI
.TRIGGER_PORT
)) {
41 if (this.getState() == State
.STOPPED
)
44 if (this.getState() == State
.RUNNING
) {
49 if (Robot
.oi
.rightJoystick
.getRawButton(Constants
.OI
.PRINT_PORT
)) {
50 System
.out
.println("Current Shooter Speed: " + getCurrentSpeed());
58 private State
getState() {
62 // Use negative # for decrement. Positive for increment.
63 public void changeSpeed(double change
) {
64 if (getCurrentSpeed() + change
>= 1.0)
66 else if (getCurrentSpeed() + change
<= -1.0)
69 double newSpeed
= getCurrentSpeed() + change
;
72 this.state
= State
.RUNNING
;
76 protected void initDefaultCommand() {