package org.usfirst.frc.team3501.robot.subsystems;\r
\r
import org.usfirst.frc.team3501.robot.Constants;\r
+import org.usfirst.frc.team3501.robot.Constants.Shooter.State;\r
\r
import edu.wpi.first.wpilibj.CANTalon;\r
import edu.wpi.first.wpilibj.command.Subsystem;\r
\r
public class Shooter extends Subsystem {\r
- CANTalon wheel;\r
+ private CANTalon shooter;\r
\r
public Shooter() {\r
- wheel = new CANTalon(Constants.Shooter.SHOOTER_WHEEL_PORT);\r
+ shooter = new CANTalon(Constants.Shooter.PORT);\r
+ }\r
+\r
+ public double getCurrentSetPoint() {\r
+ return shooter.get();\r
+ }\r
+\r
+ public void setSpeed(double speed) {\r
+ if (speed >= 1.0)\r
+ shooter.set(1.0);\r
+ else if (speed <= -1.0)\r
+ shooter.set(-1.0);\r
+ else\r
+ shooter.set(speed);\r
+ }\r
+\r
+ public void stop() {\r
+ this.setSpeed(0.0);\r
+ }\r
+\r
+ public State getState() {\r
+ return (this.getCurrentSetPoint() == 0) ? State.RUNNING : State.STOPPED;\r
+ }\r
+\r
+ // Use negative # for decrement. Positive for increment.\r
+ public void changeSpeed(double change) {\r
+ if (getCurrentSetPoint() + change >= 1.0)\r
+ shooter.set(1.0);\r
+ else if (getCurrentSetPoint() + change <= -1.0)\r
+ shooter.set(-1.0);\r
+ else {\r
+ double newSpeed = getCurrentSetPoint() + change;\r
+ setSpeed(newSpeed);\r
+ }\r
}\r
\r
@Override\r
protected void initDefaultCommand() {\r
-\r
}\r
}\r