| 1 | package org.usfirst.frc.team3501.robot.commands.climber; |
| 2 | |
| 3 | import org.usfirst.frc.team3501.robot.OI; |
| 4 | import org.usfirst.frc.team3501.robot.Robot; |
| 5 | import org.usfirst.frc.team3501.robot.subsystems.Climber; |
| 6 | |
| 7 | import edu.wpi.first.wpilibj.command.Command; |
| 8 | |
| 9 | /** |
| 10 | * This command runs the drive train motors (which runs the winch) continuously |
| 11 | * at a specified speed until the button triggering it is released |
| 12 | * |
| 13 | * pre-condition: This command must be run by a button in OI with |
| 14 | * button.whileHeld(...). The robot must be attached to the rope. |
| 15 | * |
| 16 | * post-condition: Drive train motors set to a specified speed. |
| 17 | * |
| 18 | * @author shivanighanta |
| 19 | * |
| 20 | */ |
| 21 | public class RunWinchContinuous extends Command { |
| 22 | Climber climber = Robot.getClimber(); |
| 23 | private double climbingSpeed; |
| 24 | |
| 25 | /** |
| 26 | * See JavaDoc comment in class for details |
| 27 | * |
| 28 | * @param motorVal |
| 29 | * value range is from -1 to 1 |
| 30 | */ |
| 31 | public RunWinchContinuous() { |
| 32 | requires(climber); |
| 33 | climbingSpeed = climber.CLIMBER_SPEED; |
| 34 | } |
| 35 | |
| 36 | @Override |
| 37 | protected void initialize() { |
| 38 | } |
| 39 | |
| 40 | @Override |
| 41 | protected void execute() { |
| 42 | double thrust = OI.xboxController.getY(); |
| 43 | climber.setMotorValues(-thrust); |
| 44 | } |
| 45 | |
| 46 | @Override |
| 47 | protected boolean isFinished() { |
| 48 | return false; |
| 49 | } |
| 50 | |
| 51 | @Override |
| 52 | protected void end() { |
| 53 | climber.stop(); |
| 54 | } |
| 55 | |
| 56 | @Override |
| 57 | protected void interrupted() { |
| 58 | end(); |
| 59 | } |
| 60 | } |