X-Git-Url: http://challenge-bot.com/repos/?a=blobdiff_plain;f=src%2Forg%2Fusfirst%2Ffrc%2Fteam3501%2Frobot%2Fsubsystems%2FIntake.java;h=b6c82d484f5f56b03dac38dd6332496972937910;hb=f74d236db406193b851bff99e4daec7b7abf35e7;hp=de5dc6f4a76cd76cba81515a74fe5f9794619499;hpb=d8c3d26b02ff52c620afc33dc81f53fa416e8562;p=3501%2F2017steamworks diff --git a/src/org/usfirst/frc/team3501/robot/subsystems/Intake.java b/src/org/usfirst/frc/team3501/robot/subsystems/Intake.java index de5dc6f..b6c82d4 100644 --- a/src/org/usfirst/frc/team3501/robot/subsystems/Intake.java +++ b/src/org/usfirst/frc/team3501/robot/subsystems/Intake.java @@ -1,6 +1,7 @@ package org.usfirst.frc.team3501.robot.subsystems; import org.usfirst.frc.team3501.robot.Constants; +import org.usfirst.frc.team3501.robot.MathLib; import com.ctre.CANTalon; @@ -10,9 +11,10 @@ import edu.wpi.first.wpilibj.command.Subsystem; * @author Meeta */ public class Intake extends Subsystem { - public static Intake intake = null; + private static Intake intake = null; private CANTalon intakeWheel; - public static final double INTAKE_SPEED = 0; + public static final double INTAKE_SPEED = 1; + public static final double REVERSE_SPEED = -1; public Intake() { intakeWheel = new CANTalon(Constants.Intake.INTAKE_ROLLER_PORT); @@ -43,7 +45,31 @@ public class Intake extends Subsystem { * from -1 to 1 */ public void setSpeed(double speed) { + speed = MathLib.restrictToRange(speed, -1.0, 1.0); intakeWheel.set(speed); } + /*** + * Runs the intake wheel at the set intake speed. + */ + public void runIntake() { + setSpeed(INTAKE_SPEED); + } + + /*** + * Stops the intake wheel by setting intake wheel's speed to 0. + */ + public void stopIntake() { + setSpeed(0); + } + + /*** + * Purpose is to release all balls from the ball container to the outside of + * the robot. Reverses intake wheel by setting wheel speed to reverse speed. + * + */ + public void runReverseIntake() { + setSpeed(REVERSE_SPEED); + } + }