X-Git-Url: http://challenge-bot.com/repos/?p=3501%2F2017steamworks;a=blobdiff_plain;f=src%2Forg%2Fusfirst%2Ffrc%2Fteam3501%2Frobot%2Fcommands%2Fclimber%2FToggleWinch.java;fp=src%2Forg%2Fusfirst%2Ffrc%2Fteam3501%2Frobot%2Fcommands%2Fclimber%2FToggleWinch.java;h=3e60406cc66e332167c465d59dae56d08311b13f;hp=0000000000000000000000000000000000000000;hb=9dc69158f74215de20fd5fdcee299020e8f2b88b;hpb=25ef99e622af7d7dbd7ddb6c9c1a7ec7e71b0b77 diff --git a/src/org/usfirst/frc/team3501/robot/commands/climber/ToggleWinch.java b/src/org/usfirst/frc/team3501/robot/commands/climber/ToggleWinch.java new file mode 100644 index 0000000..3e60406 --- /dev/null +++ b/src/org/usfirst/frc/team3501/robot/commands/climber/ToggleWinch.java @@ -0,0 +1,49 @@ +package org.usfirst.frc.team3501.robot.commands.climber; + +import org.usfirst.frc.team3501.robot.Robot; +import org.usfirst.frc.team3501.robot.subsystems.DriveTrain; + +import edu.wpi.first.wpilibj.command.Command; + +/** + * + */ +public class ToggleWinch extends Command { + DriveTrain driveTrain = Robot.getDriveTrain(); + private double climbingSpeed; + private double maintainPositionSpeed; + + public ToggleWinch() { + requires(driveTrain); + climbingSpeed = driveTrain.CLIMBER_SPEED; + maintainPositionSpeed = driveTrain.MAINTAIN_CLIMBED_POSITION; + } + + @Override + protected void initialize() { + } + + @Override + protected void execute() { + if (driveTrain.shouldBeClimbing) { + driveTrain.setMotorValues(climbingSpeed, climbingSpeed); + } else { + driveTrain.setMotorValues(maintainPositionSpeed, maintainPositionSpeed); + } + } + + @Override + protected boolean isFinished() { + return false; + } + + @Override + protected void end() { + driveTrain.shouldBeClimbing = !driveTrain.shouldBeClimbing; + } + + @Override + protected void interrupted() { + end(); + } +}