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
.ROLLER_PORT
);
30 leftIntake
= new DoubleSolenoid(Constants
.IntakeArm
.LEFT_FORWARD
,
31 Constants
.IntakeArm
.LEFT_REVERSE
);
33 rightIntake
= new DoubleSolenoid(Constants
.IntakeArm
.RIGHT_FORWARD
,
34 Constants
.IntakeArm
.RIGHT_REVERSE
);
37 public void retractPistons() {
38 leftIntake
.set(Constants
.IntakeArm
.RETRACT
);
39 rightIntake
.set(Constants
.IntakeArm
.RETRACT
);
42 public void extendPistons() {
43 leftIntake
.set(Constants
.IntakeArm
.EXTEND
);
44 rightIntake
.set(Constants
.IntakeArm
.EXTEND
);
48 * This method sets the voltage of the motor to intake the ball. The voltage
49 * values are constants in Constants class
51 public void intakeBall() {
52 intakeRoller
.set(Constants
.IntakeArm
.INTAKE_SPEED
);
56 * This method sets the voltage of the motor to output the ball. The voltage
57 * values are constants in Constants class
59 public void outputBall() {
60 intakeRoller
.set(Constants
.IntakeArm
.OUTPUT_SPEED
);
63 public void stopRollers() {
68 * This method gets you the current voltage of the motor that controls the
69 * intake arm roller. The range of voltage is from [-1,1]. A negative voltage
70 * makes the motor run backwards.
72 * @return Returns the voltage of the motor that controls the roller. The
73 * range of the voltage goes from [-1,1]. A negative voltage indicates
74 * that the motor is running backwards.
77 public double getRollerVoltage() {
78 return intakeRoller
.get();
82 * This method checks to see if the presence of the ball inside is true or
85 * @return Returns whether the ball is inside as true or false
88 public boolean isBallInside() {
93 * This method checks to see if the motors controlling the rollers are
96 * @return Returns whether the motors are currently running, and returns the
97 * state of the condition (true or false).
101 public boolean areRollersRolling() {
102 if (Math
.abs(getRollerVoltage()) < 0.02)
108 protected void initDefaultCommand() {