4c8cd54d102573329a4ee36dc4ca10288249ff20
1 package org
.usfirst
.frc
.team3501
.robot
.commands
.shooter
;
3 import org
.usfirst
.frc
.team3501
.robot
.Robot
;
5 import edu
.wpi
.first
.wpilibj
.Timer
;
6 import edu
.wpi
.first
.wpilibj
.command
.Command
;
9 * This command runs index wheel at a given speed for given time in seconds.
11 * pre-condition: fly wheel is running at full speed to prepare for shooting
16 public class RunIndexWheel
extends Command
{
19 private double motorVal
;
22 * See JavaDoc comment in class for details
25 * value range from -1 to 1
27 * in seconds, amount of time to run index wheel motor
29 public RunIndexWheel(double motorVal
, double time
) {
30 requires(Robot
.getShooter());
33 this.motorVal
= motorVal
;
37 // Called just before this Command runs the first time
39 protected void initialize() {
41 Robot
.getShooter().setIndexWheelMotorVal(motorVal
);
44 // Called repeatedly when this Command is scheduled to run
46 protected void execute() {
49 // Called once after isFinished returns true
51 protected void end() {
52 Robot
.getShooter().stopIndexWheel();
55 // Called when another command which requires one or more of the same
56 // subsystems is scheduled to run
58 protected void interrupted() {
63 protected boolean isFinished() {
64 return timer
.get() >= time
;