| 1 | package org.usfirst.frc.team3501.robot.commands.climber; |
| 2 | |
| 3 | import org.usfirst.frc.team3501.robot.Robot; |
| 4 | import org.usfirst.frc.team3501.robot.subsystems.DriveTrain; |
| 5 | |
| 6 | import edu.wpi.first.wpilibj.command.Command; |
| 7 | |
| 8 | /** |
| 9 | * This command runs the winch at a specified speed when the robot has completed |
| 10 | * the climb and when the button triggering it is pressed. This command also |
| 11 | * makes the drive train motors run because the winch is controlled by the drive |
| 12 | * train. |
| 13 | * |
| 14 | * pre-condition: This command is run by a button in OI. The robot must have |
| 15 | * completed climbing. |
| 16 | * |
| 17 | * post-condition: Winch motor set to a specified speed. |
| 18 | * |
| 19 | * @param motorVal |
| 20 | * value range is from -1 to 1 |
| 21 | * |
| 22 | * @author shivanighanta |
| 23 | * |
| 24 | */ |
| 25 | public class MaintainClimbedPosition extends Command { |
| 26 | |
| 27 | /** |
| 28 | * See JavaDoc comment in class for details |
| 29 | * |
| 30 | * @param time |
| 31 | * time in seconds to run the winch |
| 32 | */ |
| 33 | public MaintainClimbedPosition() { |
| 34 | requires(Robot.getDriveTrain()); |
| 35 | } |
| 36 | |
| 37 | @Override |
| 38 | protected void initialize() { |
| 39 | } |
| 40 | |
| 41 | @Override |
| 42 | protected void execute() { |
| 43 | Robot.getDriveTrain().setMotorValues(DriveTrain.MAINTAIN_CLIMBED_POSITION, |
| 44 | DriveTrain.MAINTAIN_CLIMBED_POSITION); |
| 45 | |
| 46 | } |
| 47 | |
| 48 | @Override |
| 49 | protected boolean isFinished() { |
| 50 | return false; |
| 51 | } |
| 52 | |
| 53 | @Override |
| 54 | protected void end() { |
| 55 | Robot.getDriveTrain().stop(); |
| 56 | } |
| 57 | |
| 58 | @Override |
| 59 | protected void interrupted() { |
| 60 | end(); |
| 61 | } |
| 62 | } |