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
.command
.Command
;
10 * This command runs index wheel continuously when OI button managing index
11 * wheel is pressed. The command will run the index wheel motor until the button
12 * triggering it is released.
14 * Should only be run from the operator interface.
16 * pre-condition: This command must be run by a button in OI with
17 * button.whileHeld(...).
21 public class RunIndexWheelContinuous
extends Command
{
22 private Shooter shooter
= Robot
.getShooter();
25 * See JavaDoc comment in class for details
27 public RunIndexWheelContinuous() {
32 protected void initialize() {
36 protected void execute() {
37 if (timeSinceInitialized() % 0.5 <= 0.02) {
38 if (Shooter
.getShooter().getPistonValue() == Constants
.Shooter
.LOW_GEAR
) {
39 Shooter
.getShooter().setHighGear();
41 Shooter
.getShooter().setLowGear();
45 double shooterSpeed
= shooter
.getShooterRPM();
46 double targetShooterSpeed
= shooter
.getTargetShootingSpeed();
47 double threshold
= shooter
.getRPMThreshold();
48 if (Math
.abs(shooterSpeed
- targetShooterSpeed
) <= threshold
)
49 shooter
.runIndexWheel();
53 protected void end() {
54 shooter
.stopIndexWheel();
58 protected void interrupted() {
63 protected boolean isFinished() {