1 package org
.usfirst
.frc
.team3501
.robot
.commands
.shooter
;
3 import org
.usfirst
.frc
.team3501
.robot
.Constants
;
4 import org
.usfirst
.frc
.team3501
.robot
.Robot
;
5 import org
.usfirst
.frc
.team3501
.robot
.subsystems
.Shooter
;
7 import edu
.wpi
.first
.wpilibj
.Timer
;
8 import edu
.wpi
.first
.wpilibj
.command
.Command
;
11 * This command runs index wheel continuously when OI button managing index
12 * wheel is pressed. The command will run the index wheel motor until the button
13 * triggering it is released.
15 * Should only be run from the operator interface.
17 * pre-condition: This command must be run by a button in OI with
18 * button.whileHeld(...).
22 public class RunIndexWheelContinuous
extends Command
{
23 private Shooter shooter
= Robot
.getShooter();
24 private Timer t
= new Timer();
27 * See JavaDoc comment in class for details
30 * value range from -1 to 1
32 public RunIndexWheelContinuous() {
36 // Called just before this Command runs the first time
38 protected void initialize() {
42 // Called repeatedly when this Command is scheduled to run
44 protected void execute() {
45 if (t
.get() % 1 == 0) {
46 if (Shooter
.getShooter().getPistonValue() == Constants
.Shooter
.LOW_GEAR
) {
47 Shooter
.getShooter().setHighGear();
49 Shooter
.getShooter().setLowGear();
53 double shooterSpeed
= shooter
.getShooterRPM();
54 if (shooterSpeed
> 0) {
55 shooter
.setIndexWheelMotorVal(shooter
.DEFAULT_INDEXING_SPEED
);
59 // Called once after isFinished returns true
61 protected void end() {
62 shooter
.stopIndexWheel();
65 // Called when another command which requires one or more of the same
66 // subsystems is scheduled to run
68 protected void interrupted() {
73 protected boolean isFinished() {