From a7160a690c719b35f97109a1f66d8985a2885f47 Mon Sep 17 00:00:00 2001 From: Lauren Meier Date: Sat, 13 Feb 2016 15:42:13 -0800 Subject: [PATCH] rename SetWinchSpeed to RunWinchContinuous and add new condition to end() to stop the winch motors when command is canceled --- ...{SetWinchSpeed.java => RunWinchContinuous.java} | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) rename src/org/usfirst/frc/team3501/robot/commands/{SetWinchSpeed.java => RunWinchContinuous.java} (63%) diff --git a/src/org/usfirst/frc/team3501/robot/commands/SetWinchSpeed.java b/src/org/usfirst/frc/team3501/robot/commands/RunWinchContinuous.java similarity index 63% rename from src/org/usfirst/frc/team3501/robot/commands/SetWinchSpeed.java rename to src/org/usfirst/frc/team3501/robot/commands/RunWinchContinuous.java index 4f5a69ae..63ff149f 100644 --- a/src/org/usfirst/frc/team3501/robot/commands/SetWinchSpeed.java +++ b/src/org/usfirst/frc/team3501/robot/commands/RunWinchContinuous.java @@ -5,10 +5,11 @@ 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. + * 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() + * whileHeld(). The robot must be attached to the tower rung. * * post-condition: winch motor set to a specified speed. * @@ -16,10 +17,11 @@ import edu.wpi.first.wpilibj.command.Command; * */ -public class SetWinchSpeed extends Command { - double winchUpSpeed; +public class RunWinchContinuous extends Command { + private final double STOP_SPEED = 0.0; + private double winchUpSpeed; - public SetWinchSpeed(double speed) { + public RunWinchContinuous(double speed) { requires(Robot.scaler); winchUpSpeed = speed; } @@ -40,9 +42,11 @@ public class SetWinchSpeed extends Command { @Override protected void end() { + Robot.scaler.runWinch(STOP_SPEED); } @Override protected void interrupted() { + end(); } } -- 2.30.2