809609c9 |
1 | package org.usfirst.frc.team3501.robot.commands.shooter; |
2 | |
dbec800d |
3 | import org.usfirst.frc.team3501.robot.Robot; |
4 | |
809609c9 |
5 | import edu.wpi.first.wpilibj.command.Command; |
6 | |
7 | /** |
d4507ede |
8 | * This command runs the fly wheel continuously when OI button managing fly |
9 | * wheel is pressed. The command will run the fly wheel motor until the button |
89a76b33 |
10 | * triggering it is released. |
b6e97560 |
11 | * |
d4507ede |
12 | * Should only be run from the operator interface. |
13 | * |
973f0ac4 |
14 | * pre-condition: This command must be run by a button in OI, with |
15 | * button.whileHeld(...). |
357feb5c |
16 | * |
973f0ac4 |
17 | * @author Shaina |
809609c9 |
18 | */ |
19 | public class RunFlyWheelContinuous extends Command { |
b6e97560 |
20 | private double motorVal; |
55cbd9ba |
21 | |
b7ef589a |
22 | /** |
23 | * See JavaDoc comment in class for details |
24 | * |
25 | * @param motorVal |
26 | * value range from -1 to 1 |
27 | */ |
b6e97560 |
28 | public RunFlyWheelContinuous(double motorVal) { |
29 | this.motorVal = motorVal; |
55cbd9ba |
30 | } |
31 | |
32 | // Called just before this Command runs the first time |
33 | @Override |
34 | protected void initialize() { |
dbec800d |
35 | Robot.getShooter().setFlyWheelMotorVal(motorVal); |
55cbd9ba |
36 | } |
37 | |
38 | // Called repeatedly when this Command is scheduled to run |
39 | @Override |
40 | protected void execute() { |
41 | } |
42 | |
43 | // Called once after isFinished returns true |
44 | @Override |
45 | protected void end() { |
46 | } |
47 | |
48 | // Called when another command which requires one or more of the same |
49 | // subsystems is scheduled to run |
50 | @Override |
51 | protected void interrupted() { |
89a76b33 |
52 | end(); |
55cbd9ba |
53 | } |
54 | |
55 | @Override |
56 | protected boolean isFinished() { |
7099e02a |
57 | return !Robot.getOI().toggleFlyWheel.get(); |
55cbd9ba |
58 | } |
809609c9 |
59 | |
60 | } |