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