1 package org
.usfirst
.frc
.team3501
.robot
.subsystems
;
3 import org
.usfirst
.frc
.team3501
.robot
.Constants
;
4 import org
.usfirst
.frc
.team3501
.robot
.MathLib
;
6 import com
.ctre
.CANTalon
;
8 import edu
.wpi
.first
.wpilibj
.command
.Subsystem
;
13 public class Intake
extends Subsystem
{
14 private static Intake intake
= null;
15 private CANTalon intakeWheel
;
16 public static final double INTAKE_SPEED
= 1;
17 public static final double REVERSE_SPEED
= -1;
20 intakeWheel
= new CANTalon(Constants
.Intake
.INTAKE_ROLLER_PORT
);
24 * It gets the intake instance, and if intake has not been initialized, then
25 * it will be initialized.
29 public static Intake
getIntake() {
31 intake
= new Intake();
37 protected void initDefaultCommand() {
42 * Sets speed of intake wheel to input speed
47 public void setSpeed(double speed
) {
48 speed
= MathLib
.restrictToRange(speed
, -1.0, 1.0);
49 intakeWheel
.set(speed
);
53 * Runs the intake wheel at the set intake speed.
55 public void runIntake() {
56 setSpeed(INTAKE_SPEED
);
60 * Stops the intake wheel by setting intake wheel's speed to 0.
62 public void stopIntake() {
67 * Purpose is to release all balls from the ball container to the outside of
68 * the robot. Reverses intake wheel by setting wheel speed to reverse speed.
71 public void runReverseIntake() {
72 setSpeed(REVERSE_SPEED
);