Commit | Line | Data |
---|---|---|
a0c3ca74 KZ |
1 | package org.usfirst.frc.team3501.robot.subsystems; |
2 | ||
3 | import org.usfirst.frc.team3501.robot.Constants; | |
4d4bcc68 | 4 | import org.usfirst.frc.team3501.robot.sensors.Photogate; |
a0c3ca74 | 5 | |
9b10474d | 6 | import edu.wpi.first.wpilibj.DoubleSolenoid; |
a0c3ca74 KZ |
7 | import edu.wpi.first.wpilibj.command.Subsystem; |
8 | ||
27fac8ed | 9 | /*** |
3b2038bb ME |
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. | |
e4fbab02 | 14 | * |
27fac8ed | 15 | * @author superuser |
e4fbab02 | 16 | * |
27fac8ed YA |
17 | */ |
18 | ||
a0c3ca74 | 19 | public class Shooter extends Subsystem { |
e4fbab02 | 20 | private DoubleSolenoid catapult1, catapult2; |
4d4bcc68 | 21 | private Photogate photogate; |
95f05eb0 | 22 | private boolean usePhotoGate; |
a0c3ca74 KZ |
23 | |
24 | public Shooter() { | |
e4fbab02 HD |
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); | |
31 | usePhotoGate = false; | |
a0c3ca74 KZ |
32 | } |
33 | ||
64055177 | 34 | /*** |
f08a2eef YA |
35 | * This method checks to see if the ball has successfully passed through the |
36 | * intake rollers and is inside. | |
e4fbab02 | 37 | * |
f08a2eef YA |
38 | * @return whether the presence of the ball is true or false and returns the |
39 | * state of the condition (true or false). | |
40 | */ | |
41 | ||
42 | public boolean isBallInside() { | |
24850996 | 43 | if (usePhotogate()) |
44 | return photogate.isBallPresent(); | |
45 | else | |
95f05eb0 | 46 | return true; |
4b29730e E |
47 | } |
48 | ||
e4fbab02 HD |
49 | // Catapult Commands |
50 | public void fireCatapult() { | |
51 | catapult1.set(Constants.Shooter.shoot); | |
52 | catapult2.set(Constants.Shooter.shoot); | |
a0c3ca74 KZ |
53 | } |
54 | ||
e4fbab02 HD |
55 | public void resetCatapult() { |
56 | catapult1.set(Constants.Shooter.reset); | |
57 | catapult2.set(Constants.Shooter.reset); | |
cc72c5b2 CZ |
58 | } |
59 | ||
24850996 | 60 | public boolean usePhotogate() { |
95f05eb0 KZ |
61 | return this.usePhotoGate; |
62 | } | |
63 | ||
64 | public void togglePhotoGate() { | |
65 | this.usePhotoGate = !this.usePhotoGate; | |
24850996 | 66 | } |
67 | ||
3b2038bb ME |
68 | @Override |
69 | protected void initDefaultCommand() { | |
071ab315 | 70 | } |
a0c3ca74 | 71 | } |