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 double shooterSpeed
= shooter
.getShooterRPM();
38 double targetShooterSpeed
= shooter
.getTargetShootingSpeed();
39 double threshold
= shooter
.getRPMThreshold();
40 // if (Math.abs(shooterSpeed - targetShooterSpeed) <= threshold)
42 if (timeSinceInitialized() % 0.5 <= 0.02) {
44 if (Robot
.getDriveTrain()
45 .getLeftGearPistonValue() == Constants
.DriveTrain
.LOW_GEAR
) {
46 System
.out
.println("shifting to low gear " + timeSinceInitialized());
47 Robot
.getDriveTrain().setHighGear();
49 System
.out
.println("shifting to high gear " + timeSinceInitialized());
50 Robot
.getDriveTrain().setLowGear();
53 shooter
.runIndexWheel();
57 protected void end() {
58 shooter
.stopIndexWheel();
62 protected void interrupted() {
67 protected boolean isFinished() {