1 package org
.usfirst
.frc
.team3501
.robot
.subsystems
;
3 import org
.usfirst
.frc
.team3501
.robot
.Constants
;
5 import edu
.wpi
.first
.wpilibj
.CANTalon
;
6 import edu
.wpi
.first
.wpilibj
.DoubleSolenoid
;
7 import edu
.wpi
.first
.wpilibj
.command
.Subsystem
;
10 * The IntakeArm consists of two rollers that are controlled by one motor, with
11 * a potentiometer on it.
13 * The motor controls the rollers, making them roll forwards and backwards. The
14 * Intake rollers are on the back of the robot. As the rollers run, they intake
21 public class IntakeArm
extends Subsystem
{
23 private CANTalon intakeRoller
;
24 private DoubleSolenoid leftIntake
, rightIntake
;
25 public static double moveIntakeArmSpeed
= 0;
28 intakeRoller
= new CANTalon(Constants
.IntakeArm
.INTAKE_ROLLER_PORT
);
30 leftIntake
= new DoubleSolenoid(Constants
.IntakeArm
.LEFT_INTAKE_MODULE
,
31 Constants
.IntakeArm
.LEFT_INTAKE_FORWARD
,
32 Constants
.IntakeArm
.LEFT_INTAKE_REVERSE
);
34 rightIntake
= new DoubleSolenoid(Constants
.IntakeArm
.RIGHT_INTAKE_MODULE
,
35 Constants
.IntakeArm
.RIGHT_INTAKE_FORWARD
,
36 Constants
.IntakeArm
.RIGHT_INTAKE_REVERSE
);
39 public void retractPistons() {
40 leftIntake
.set(Constants
.IntakeArm
.RETRACT
);
41 rightIntake
.set(Constants
.IntakeArm
.RETRACT
);
44 public void extendPistons() {
45 leftIntake
.set(Constants
.IntakeArm
.EXTEND
);
46 rightIntake
.set(Constants
.IntakeArm
.EXTEND
);
49 public boolean isExtended() {
50 return (leftIntake
.get() == Constants
.IntakeArm
.EXTEND
51 && rightIntake
.get() == Constants
.IntakeArm
.EXTEND
);
55 * This method sets the voltage of the motor to intake the ball. The voltage
56 * values are constants in Constants class
58 public void intakeBall() {
59 intakeRoller
.set(Constants
.IntakeArm
.INTAKE_SPEED
);
63 * This method sets the voltage of the motor to output the ball. The voltage
64 * values are constants in Constants class
66 public void outputBall() {
67 intakeRoller
.set(Constants
.IntakeArm
.OUTPUT_SPEED
);
70 public void stopRollers() {
75 * This method gets you the current voltage of the motor that controls the
76 * intake arm roller. The range of voltage is from [-1,1]. A negative voltage
77 * makes the motor run backwards.
79 * @return Returns the voltage of the motor that controls the roller. The
80 * range of the voltage goes from [-1,1]. A negative voltage indicates
81 * that the motor is running backwards.
84 public double getRollerVoltage() {
85 return intakeRoller
.get();
89 * This method checks to see if the presence of the ball inside is true or
92 * @return Returns whether the ball is inside as true or false
95 public boolean isBallInside() {
100 * This method checks to see if the motors controlling the rollers are
103 * @return Returns whether the motors are currently running, and returns the
104 * state of the condition (true or false).
108 public boolean areRollersRolling() {
109 if (Math
.abs(getRollerVoltage()) < 0.02)
115 protected void initDefaultCommand() {