| 1 | package org.usfirst.frc.team3501.robot.commands; |
| 2 | |
| 3 | import org.usfirst.frc.team3501.robot.Robot; |
| 4 | |
| 5 | import edu.wpi.first.wpilibj.command.Command; |
| 6 | |
| 7 | /** |
| 8 | * |
| 9 | */ |
| 10 | public class ShooterTest extends Command { |
| 11 | |
| 12 | public ShooterTest() { |
| 13 | |
| 14 | requires(Robot.shooter); |
| 15 | } |
| 16 | |
| 17 | @Override |
| 18 | protected void initialize() { |
| 19 | |
| 20 | Robot.shooter.setSpeed(0.5); |
| 21 | |
| 22 | } |
| 23 | |
| 24 | @Override |
| 25 | protected void execute() { |
| 26 | boolean triggerPressed = Robot.oi.rightJoystick.getTrigger(); |
| 27 | boolean leftSidePressed = Robot.oi.leftSilverButton.get(); |
| 28 | boolean rightSidePressed = Robot.oi.rightSilverButton.get(); |
| 29 | |
| 30 | boolean thumbPressed = Robot.oi.thumbButton.get(); |
| 31 | |
| 32 | double currentWheelSpeed = Robot.shooter.getCurrentSpeed(); |
| 33 | |
| 34 | if (triggerPressed == true) { |
| 35 | Robot.shooter.setSpeed(currentWheelSpeed); |
| 36 | } else { |
| 37 | Robot.shooter.setSpeed(0.0); |
| 38 | } |
| 39 | |
| 40 | if (leftSidePressed == true) { |
| 41 | Robot.shooter.decrementSpeed(0.1); |
| 42 | } |
| 43 | |
| 44 | if (rightSidePressed == true) { |
| 45 | Robot.shooter.incrementSpeed(0.1); |
| 46 | } |
| 47 | |
| 48 | if (thumbPressed == true) { |
| 49 | System.out.println(Robot.shooter.getCurrentSpeed()); |
| 50 | } |
| 51 | } |
| 52 | |
| 53 | // Make this return true when this Command no longer needs to run execute() |
| 54 | @Override |
| 55 | protected boolean isFinished() { |
| 56 | return false; |
| 57 | } |
| 58 | |
| 59 | // Called once after isFinished returns true |
| 60 | @Override |
| 61 | protected void end() { |
| 62 | } |
| 63 | |
| 64 | // Called when another command which requires one or more of the same |
| 65 | // subsystems is scheduled to run |
| 66 | @Override |
| 67 | protected void interrupted() { |
| 68 | } |
| 69 | } |