X-Git-Url: http://challenge-bot.com/repos/?a=blobdiff_plain;f=src%2Forg%2Fusfirst%2Ffrc%2Fteam3501%2Frobot%2Fcommands%2Fclimber%2FRunWinchContinuous.java;h=0772ffb95ecbe7c12c153aca548c2c9a95a04b1f;hb=f74d236db406193b851bff99e4daec7b7abf35e7;hp=dc29866a2e4892cd6ba49491e1afcd81fdd3de9d;hpb=5be898b73b8d419396c09c02415658caf5b70cc6;p=3501%2F2017steamworks diff --git a/src/org/usfirst/frc/team3501/robot/commands/climber/RunWinchContinuous.java b/src/org/usfirst/frc/team3501/robot/commands/climber/RunWinchContinuous.java index dc29866..0772ffb 100644 --- a/src/org/usfirst/frc/team3501/robot/commands/climber/RunWinchContinuous.java +++ b/src/org/usfirst/frc/team3501/robot/commands/climber/RunWinchContinuous.java @@ -1,31 +1,47 @@ package org.usfirst.frc.team3501.robot.commands.climber; +import org.usfirst.frc.team3501.robot.OI; import org.usfirst.frc.team3501.robot.Robot; +import org.usfirst.frc.team3501.robot.subsystems.Climber; import edu.wpi.first.wpilibj.command.Command; /** - * Runs the winch continuously at a given motor value + * This command runs the drive train motors (which runs the winch) continuously + * at a specified speed until the button triggering it is released + * + * pre-condition: This command must be run by a button in OI with + * button.whileHeld(...). The robot must be attached to the rope. + * + * post-condition: Drive train motors set to a specified speed. * * @author shivanighanta * */ public class RunWinchContinuous extends Command { - private double motorVal; - - public RunWinchContinuous(double motorVal) { - this.motorVal = motorVal; + Climber climber = Robot.getClimber(); + private double climbingSpeed; + + /** + * See JavaDoc comment in class for details + * + * @param motorVal + * value range is from -1 to 1 + */ + public RunWinchContinuous() { + requires(climber); + climbingSpeed = climber.CLIMBER_SPEED; } @Override protected void initialize() { - Robot.getClimber().setMotorValue(motorVal); - + climber.setCANTalonsBrakeMode(climber.COAST_MODE); } @Override protected void execute() { - + double thrust = OI.xboxController.getY(); + climber.setMotorValues(-thrust); } @Override @@ -35,7 +51,7 @@ public class RunWinchContinuous extends Command { @Override protected void end() { - Robot.getClimber().stop(); + climber.stop(); } @Override