Resurrect deleted commit
authorKevin Zhang <icestormf1@gmail.com>
Mon, 15 Feb 2016 19:56:45 +0000 (11:56 -0800)
committerKevin Zhang <icestormf1@gmail.com>
Mon, 15 Feb 2016 19:56:45 +0000 (11:56 -0800)
src/org/usfirst/frc/team3501/robot/subsystems/Shooter.java

index 64efa1588b0e31b3d70075848628b3c2763581da..ee2742d2b0209e88c0cd18cd0b54fbebcd9c070b 100755 (executable)
@@ -1,6 +1,7 @@
 package org.usfirst.frc.team3501.robot.subsystems;
 
 import org.usfirst.frc.team3501.robot.Constants;
+import org.usfirst.frc.team3501.robot.MathLib;
 
 import edu.wpi.first.wpilibj.CANTalon;
 import edu.wpi.first.wpilibj.CounterBase.EncodingType;
@@ -48,12 +49,8 @@ public class Shooter extends Subsystem {
   }
 
   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);
+    speed = MathLib.constrain(speed, -1, 1);
+    shooter.set(speed);
   }
 
   public void stop() {
@@ -72,7 +69,7 @@ public class Shooter extends Subsystem {
   }
 
   // Punch Commands
-  public void extendPunch() {
+  public void punch() {
     punch.set(Constants.Shooter.punch);
   }