Missed a <= addadded it
[3501/stronghold-2016] / src / org / usfirst / frc / team3501 / robot / subsystems / Shooter.java
index 7376255d6e6eea2feb382c7186f48da30ec136ba..68c1d51ab1bb3550ac4b49b9547839ecf0e99c82 100755 (executable)
@@ -1,47 +1,53 @@
-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
-  private CANTalon shooter;\r
-\r
-  public Shooter() {\r
-    shooter = new CANTalon(Constants.Shooter.PORT);\r
-  }\r
-\r
-  public double getCurrentSpeed() {\r
-    return shooter.get();\r
-  }\r
-\r
-  public void setSpeed(double speed) {\r
-    shooter.set(speed);\r
-  }\r
-\r
-  public void stop() {\r
-    this.setSpeed(0.0);\r
-  }\r
-\r
-  public State getState() {\r
-    return (this.getCurrentSpeed() == 0) ? State.RUNNING : State.STOPPED;\r
-  }\r
-\r
-  // Use negative # for decrement. Positive for increment.\r
-  public void changeSpeed(double change) {\r
-    if (getCurrentSpeed() + change >= 1.0)\r
-      shooter.set(1.0);\r
-    else if (getCurrentSpeed() + change <= -1.0)\r
-      shooter.set(-1.0);\r
-    else {\r
-      double newSpeed = getCurrentSpeed() + change;\r
-      setSpeed(newSpeed);\r
-    }\r
-  }\r
-\r
-  @Override\r
-  protected void initDefaultCommand() {\r
-  }\r
-}\r
+package org.usfirst.frc.team3501.robot.subsystems;
+
+import org.usfirst.frc.team3501.robot.Constants;
+import org.usfirst.frc.team3501.robot.Constants.Shooter.State;
+
+import edu.wpi.first.wpilibj.CANTalon;
+import edu.wpi.first.wpilibj.command.Subsystem;
+
+public class Shooter extends Subsystem {
+  // TODO: check all files for control m characters
+  private CANTalon shooter;
+
+  public Shooter() {
+    shooter = new CANTalon(Constants.Shooter.PORT);
+  }
+
+  public double getCurrentSetPoint() {
+    return shooter.get();
+  }
+
+  public void setSpeed(double speed) {
+    if (speed > 1.0)
+      shooter.set(1.0);
+    else if (speed < -1.0)
+      shooter.set(-1.0);
+    else
+      shooter.set(speed);
+  }
+
+  public void stop() {
+    this.setSpeed(0.0);
+  }
+
+  public State getState() {
+    return (this.getCurrentSetPoint() == 0) ? State.RUNNING : State.STOPPED;
+  }
+
+  // Use negative # for decrement. Positive for increment.
+  public void changeSpeed(double change) {
+    double newSpeed = getCurrentSetPoint() + change;
+    if (newSpeed > 1.0)
+      shooter.set(1.0);
+    else if (newSpeed < -1.0)
+      shooter.set(-1.0);
+    else {
+      setSpeed(newSpeed);
+    }
+  }
+
+  @Override
+  protected void initDefaultCommand() {
+  }
+}