add end() in interrupted in scaler methods and make sure constants go in the right...
authorKevin Zhang <icestormf1@gmail.com>
Mon, 15 Feb 2016 00:34:06 +0000 (16:34 -0800)
committerKevin Zhang <icestormf1@gmail.com>
Mon, 15 Feb 2016 00:34:06 +0000 (16:34 -0800)
src/org/usfirst/frc/team3501/robot/Constants.java
src/org/usfirst/frc/team3501/robot/commands/scaler/ClampBar.java
src/org/usfirst/frc/team3501/robot/commands/scaler/ExtendLift.java
src/org/usfirst/frc/team3501/robot/commands/scaler/RetractLift.java

index 232681683e28fb1fa029574f40514dd0aedaa85b..3304a101a858db6d9495c7b58d45b372f8c4e84f 100644 (file)
@@ -66,7 +66,7 @@ public class Constants {
 
     // Winch speeds
     public final static double WINCH_STOP_SPEED = 0.0;
-
+    public final static double SECONDS_TO_CLAMP = 2.0;
   }
 
   public static class Shooter {
index 9e9fbc1ba621913747c3d3225a62623aad8ca9ea..23b010f1d786eaa2be8583237b75a1d1b76de23e 100755 (executable)
@@ -1,21 +1,21 @@
 package org.usfirst.frc.team3501.robot.commands.scaler;
 
+import org.usfirst.frc.team3501.robot.Constants;
 import org.usfirst.frc.team3501.robot.Robot;
 
 import edu.wpi.first.wpilibj.command.Command;
 
 public class ClampBar extends Command {
-  private double secondsToClamp = 2.0; // seconds for the winch to run in order
-                                       // for it to clamp(requires testing)
-  private double winchSpeed = 0.5; // requires testing
+  private double speed = 0;
 
-  public ClampBar() {
+  public ClampBar(double speed) {
+    this.speed = speed;
   }
 
   @Override
   protected void initialize() {
-    setTimeout(secondsToClamp);
-    Robot.scaler.runWinch(winchSpeed);
+    setTimeout(Constants.Scaler.SECONDS_TO_CLAMP);
+    Robot.scaler.runWinch(this.speed);
   }
 
   @Override
index f4001d9ad9cbd5712e13ca5bdd3a767c6a2b0cfa..bead3866a8f4ac2d71c26465ba2ef9875ffe1bf2 100755 (executable)
@@ -29,5 +29,6 @@ public class ExtendLift extends Command {
 
   @Override
   protected void interrupted() {
+    end();
   }
 }
index e160b19c39b3572f60bbc88b762b6a408eeac015..880ff503f743cbce0758f89f8338942a5f55ca2e 100755 (executable)
@@ -6,28 +6,29 @@ import edu.wpi.first.wpilibj.command.Command;
 
 public class RetractLift extends Command {
 
-       public RetractLift() {
-       }
-
-       @Override
-       protected void initialize() {
-               Robot.scaler.lowerScissorLift();
-       }
-
-       @Override
-       protected void execute() {
-       }
-
-       @Override
-       protected boolean isFinished() {
-               return true;
-       }
-
-       @Override
-       protected void end() {
-       }
-
-       @Override
-       protected void interrupted() {
-       }
+  public RetractLift() {
+  }
+
+  @Override
+  protected void initialize() {
+    Robot.scaler.lowerScissorLift();
+  }
+
+  @Override
+  protected void execute() {
+  }
+
+  @Override
+  protected boolean isFinished() {
+    return true;
+  }
+
+  @Override
+  protected void end() {
+  }
+
+  @Override
+  protected void interrupted() {
+    end();
+  }
 }