From 39a39f43b69ddb4273b2b79fc52f6a03522143a7 Mon Sep 17 00:00:00 2001 From: Kevin Zhang Date: Sun, 14 Feb 2016 16:34:06 -0800 Subject: [PATCH] add end() in interrupted in scaler methods and make sure constants go in the right place --- .../usfirst/frc/team3501/robot/Constants.java | 2 +- .../robot/commands/scaler/ClampBar.java | 12 ++--- .../robot/commands/scaler/ExtendLift.java | 1 + .../robot/commands/scaler/RetractLift.java | 49 ++++++++++--------- 4 files changed, 33 insertions(+), 31 deletions(-) diff --git a/src/org/usfirst/frc/team3501/robot/Constants.java b/src/org/usfirst/frc/team3501/robot/Constants.java index 23268168..3304a101 100644 --- a/src/org/usfirst/frc/team3501/robot/Constants.java +++ b/src/org/usfirst/frc/team3501/robot/Constants.java @@ -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 { diff --git a/src/org/usfirst/frc/team3501/robot/commands/scaler/ClampBar.java b/src/org/usfirst/frc/team3501/robot/commands/scaler/ClampBar.java index 9e9fbc1b..23b010f1 100755 --- a/src/org/usfirst/frc/team3501/robot/commands/scaler/ClampBar.java +++ b/src/org/usfirst/frc/team3501/robot/commands/scaler/ClampBar.java @@ -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 diff --git a/src/org/usfirst/frc/team3501/robot/commands/scaler/ExtendLift.java b/src/org/usfirst/frc/team3501/robot/commands/scaler/ExtendLift.java index f4001d9a..bead3866 100755 --- a/src/org/usfirst/frc/team3501/robot/commands/scaler/ExtendLift.java +++ b/src/org/usfirst/frc/team3501/robot/commands/scaler/ExtendLift.java @@ -29,5 +29,6 @@ public class ExtendLift extends Command { @Override protected void interrupted() { + end(); } } diff --git a/src/org/usfirst/frc/team3501/robot/commands/scaler/RetractLift.java b/src/org/usfirst/frc/team3501/robot/commands/scaler/RetractLift.java index e160b19c..880ff503 100755 --- a/src/org/usfirst/frc/team3501/robot/commands/scaler/RetractLift.java +++ b/src/org/usfirst/frc/team3501/robot/commands/scaler/RetractLift.java @@ -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(); + } } -- 2.30.2