Commit | Line | Data |
---|---|---|
0ceab9a4 M |
1 | package org.usfirst.frc.team3501.robot.subsystems; |
2 | ||
c9eb0d1c | 3 | import org.usfirst.frc.team3501.robot.Constants; |
ac77a7b8 | 4 | import org.usfirst.frc.team3501.robot.MathLib; |
c9eb0d1c | 5 | |
dab6e7d6 AD |
6 | import com.ctre.CANTalon; |
7 | ||
0ceab9a4 M |
8 | import edu.wpi.first.wpilibj.command.Subsystem; |
9 | ||
dab6e7d6 | 10 | /** |
0ceab9a4 | 11 | * @author Meeta |
0ceab9a4 M |
12 | */ |
13 | public class Intake extends Subsystem { | |
5868b2cf | 14 | private static Intake intake = null; |
dab6e7d6 | 15 | private CANTalon intakeWheel; |
8e04baaf CZ |
16 | public static final double INTAKE_SPEED = 1; |
17 | public static final double REVERSE_SPEED = -1; | |
0ceab9a4 | 18 | |
d1930cd9 RR |
19 | private int intakeCameraFeed = 1; |
20 | ||
dab6e7d6 | 21 | public Intake() { |
c9eb0d1c | 22 | intakeWheel = new CANTalon(Constants.Intake.INTAKE_ROLLER_PORT); |
0ceab9a4 M |
23 | } |
24 | ||
66b47d2c AD |
25 | /*** |
26 | * It gets the intake instance, and if intake has not been initialized, then | |
27 | * it will be initialized. | |
28 | * | |
29 | * @returns intake | |
30 | */ | |
dab6e7d6 AD |
31 | public static Intake getIntake() { |
32 | if (intake == null) { | |
33 | intake = new Intake(); | |
34 | } | |
35 | return intake; | |
0ceab9a4 M |
36 | } |
37 | ||
38 | @Override | |
39 | protected void initDefaultCommand() { | |
0ceab9a4 M |
40 | |
41 | } | |
42 | ||
66b47d2c AD |
43 | /*** |
44 | * Sets speed of intake wheel to input speed | |
45 | * | |
46 | * @param speed | |
47 | * from -1 to 1 | |
48 | */ | |
5868b2cf | 49 | private void setSpeed(double speed) { |
ac77a7b8 | 50 | speed = MathLib.restrictToRange(speed, -1.0, 1.0); |
c9eb0d1c | 51 | intakeWheel.set(speed); |
dab6e7d6 AD |
52 | } |
53 | ||
5868b2cf AD |
54 | /*** |
55 | * Runs the intake wheel at the set intake speed. | |
56 | */ | |
57 | public void runIntake() { | |
58 | setSpeed(INTAKE_SPEED); | |
59 | } | |
60 | ||
61 | /*** | |
62 | * Stops the intake wheel by setting intake wheel's speed to 0. | |
63 | */ | |
64 | public void stopIntake() { | |
65 | setSpeed(0); | |
66 | } | |
67 | ||
d1930cd9 RR |
68 | public int getIntakeCameraFeed() { |
69 | return this.intakeCameraFeed; | |
70 | } | |
71 | ||
72 | public void setIntakeCameraFeed(int intakeCamFeed) { | |
73 | this.intakeCameraFeed = intakeCamFeed; | |
74 | } | |
75 | ||
5868b2cf AD |
76 | /*** |
77 | * Purpose is to release all balls from the ball container to the outside of | |
78 | * the robot. Reverses intake wheel by setting wheel speed to reverse speed. | |
79 | * | |
80 | */ | |
1436824b | 81 | public void runReverseIntake() { |
5868b2cf AD |
82 | setSpeed(REVERSE_SPEED); |
83 | } | |
84 | ||
0ceab9a4 | 85 | } |