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