1 package org
.usfirst
.frc
.team3501
.robot
.subsystems
;
3 import org
.usfirst
.frc
.team3501
.robot
.Constants
;
4 import org
.usfirst
.frc
.team3501
.robot
.sensors
.Photogate
;
6 import edu
.wpi
.first
.wpilibj
.DoubleSolenoid
;
7 import edu
.wpi
.first
.wpilibj
.command
.Subsystem
;
10 * The Shooter consists of a platform and wheel, each controlled by separate
11 * motors. The piston controlling the platform pushes the ball onto the wheel.
12 * The wheel is controlled by a motor, which is running before the ball is
13 * pushed onto the wheel. The spinning wheel propels the ball.
19 public class Shooter
extends Subsystem
{
20 private DoubleSolenoid catapult1
, catapult2
;
21 private Photogate photogate
;
22 private boolean usePhotoGate
;
25 catapult1
= new DoubleSolenoid(Constants
.Shooter
.CATAPULT1_MODULE
,
26 Constants
.Shooter
.CATAPULT1_FORWARD
,
27 Constants
.Shooter
.CATAPULT1_REVERSE
);
28 catapult2
= new DoubleSolenoid(Constants
.Shooter
.CATAPULT2_MODULE
,
29 Constants
.Shooter
.CATAPULT2_FORWARD
,
30 Constants
.Shooter
.CATAPULT2_REVERSE
);
35 * This method checks to see if the ball has successfully passed through the
36 * intake rollers and is inside.
38 * @return whether the presence of the ball is true or false and returns the
39 * state of the condition (true or false).
42 public boolean isBallInside() {
44 return photogate
.isBallPresent();
50 public void fireCatapult() {
51 catapult1
.set(Constants
.Shooter
.shoot
);
52 catapult2
.set(Constants
.Shooter
.shoot
);
55 public void resetCatapult() {
56 catapult1
.set(Constants
.Shooter
.reset
);
57 catapult2
.set(Constants
.Shooter
.reset
);
60 public boolean usePhotogate() {
61 return this.usePhotoGate
;
64 public void togglePhotoGate() {
65 this.usePhotoGate
= !this.usePhotoGate
;
69 protected void initDefaultCommand() {