write reverse intake method
[3501/2017steamworks] / src / org / usfirst / frc / team3501 / robot / subsystems / Intake.java
1 package org.usfirst.frc.team3501.robot.subsystems;
2
3 import org.usfirst.frc.team3501.robot.Constants;
4
5 import com.ctre.CANTalon;
6
7 import edu.wpi.first.wpilibj.command.Subsystem;
8
9 /**
10 * @author Meeta
11 */
12 public class Intake extends Subsystem {
13 private static Intake intake = null;
14 private CANTalon intakeWheel;
15 public static final double INTAKE_SPEED = 0;
16 public static final double REVERSE_SPEED = 0;
17
18 public Intake() {
19 intakeWheel = new CANTalon(Constants.Intake.INTAKE_ROLLER_PORT);
20 }
21
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 */
28 public static Intake getIntake() {
29 if (intake == null) {
30 intake = new Intake();
31 }
32 return intake;
33 }
34
35 @Override
36 protected void initDefaultCommand() {
37
38 }
39
40 /***
41 * Sets speed of intake wheel to input speed
42 *
43 * @param speed
44 * from -1 to 1
45 */
46 private void setSpeed(double speed) {
47 intakeWheel.set(speed);
48 }
49
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 */
69 public void runReverseIntake() {
70 setSpeed(REVERSE_SPEED);
71 }
72
73 }