rename SetWinchSpeed to RunWinchContinuous and add new condition to end() to stop...
authorLauren Meier <meier.lauren@gmail.com>
Sat, 13 Feb 2016 23:42:13 +0000 (15:42 -0800)
committerKevin Zhang <icestormf1@gmail.com>
Mon, 15 Feb 2016 00:22:19 +0000 (16:22 -0800)
src/org/usfirst/frc/team3501/robot/commands/RunWinchContinuous.java [new file with mode: 0644]
src/org/usfirst/frc/team3501/robot/commands/SetWinchSpeed.java [deleted file]

diff --git a/src/org/usfirst/frc/team3501/robot/commands/RunWinchContinuous.java b/src/org/usfirst/frc/team3501/robot/commands/RunWinchContinuous.java
new file mode 100644 (file)
index 0000000..63ff149
--- /dev/null
@@ -0,0 +1,52 @@
+package org.usfirst.frc.team3501.robot.commands;
+
+import org.usfirst.frc.team3501.robot.Robot;
+
+import edu.wpi.first.wpilibj.command.Command;
+
+/***
+ * This command will run the winch motor continuously until the button
+ * tirggering it is released.
+ *
+ * pre-condition: This command must be run by a button in OI with method
+ * whileHeld(). The robot must be attached to the tower rung.
+ *
+ * post-condition: winch motor set to a specified speed.
+ *
+ * @author Lauren
+ *
+ */
+
+public class RunWinchContinuous extends Command {
+  private final double STOP_SPEED = 0.0;
+  private double winchUpSpeed;
+
+  public RunWinchContinuous(double speed) {
+    requires(Robot.scaler);
+    winchUpSpeed = speed;
+  }
+
+  @Override
+  protected void initialize() {
+    Robot.scaler.runWinch(winchUpSpeed);
+  }
+
+  @Override
+  protected void execute() {
+  }
+
+  @Override
+  protected boolean isFinished() {
+    return true;
+  }
+
+  @Override
+  protected void end() {
+    Robot.scaler.runWinch(STOP_SPEED);
+  }
+
+  @Override
+  protected void interrupted() {
+    end();
+  }
+}
diff --git a/src/org/usfirst/frc/team3501/robot/commands/SetWinchSpeed.java b/src/org/usfirst/frc/team3501/robot/commands/SetWinchSpeed.java
deleted file mode 100644 (file)
index 4f5a69a..0000000
+++ /dev/null
@@ -1,48 +0,0 @@
-package org.usfirst.frc.team3501.robot.commands;
-
-import org.usfirst.frc.team3501.robot.Robot;
-
-import edu.wpi.first.wpilibj.command.Command;
-
-/***
- * This command will set the winch motor to a specified speed.
- *
- * pre-condition: This command must be run by a button in OI with method
- * whileHeld()
- *
- * post-condition: winch motor set to a specified speed.
- *
- * @author Lauren
- *
- */
-
-public class SetWinchSpeed extends Command {
-  double winchUpSpeed;
-
-  public SetWinchSpeed(double speed) {
-    requires(Robot.scaler);
-    winchUpSpeed = speed;
-  }
-
-  @Override
-  protected void initialize() {
-    Robot.scaler.runWinch(winchUpSpeed);
-  }
-
-  @Override
-  protected void execute() {
-  }
-
-  @Override
-  protected boolean isFinished() {
-    return true;
-  }
-
-  @Override
-  protected void end() {
-  }
-
-  @Override
-  protected void interrupted() {
-  }
-}