import org.usfirst.frc.team3501.robot.Robot;
import org.usfirst.frc.team3501.robot.subsystems.Shooter;
-import edu.wpi.first.wpilibj.Timer;
import edu.wpi.first.wpilibj.command.Command;
/**
*/
public class RunFlyWheel extends Command {
private Shooter shooter = Robot.getShooter();
- Timer timer;
private double time;
/**
*/
public RunFlyWheel(double time) {
requires(shooter);
-
- timer = new Timer();
this.time = time;
}
// Called just before this Command runs the first time
@Override
protected void initialize() {
- timer.start();
- shooter.setFlyWheelMotorVal(shooter.CURRENT_SHOOTING_SPEED);
}
// Called repeatedly when this Command is scheduled to run
@Override
protected void execute() {
+ shooter.setFlyWheelMotorVal(shooter.CURRENT_SHOOTING_SPEED);
}
// Called once after isFinished returns true
@Override
protected boolean isFinished() {
- return timer.get() >= time;
+ return timeSinceInitialized() >= time;
}
}