1 package org
.usfirst
.frc
.team3501
.robot
.subsystems
;
3 import org
.usfirst
.frc
.team3501
.robot
.Constants
;
5 import edu
.wpi
.first
.wpilibj
.AnalogPotentiometer
;
6 import edu
.wpi
.first
.wpilibj
.CANTalon
;
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.
14 * The Intake rollers are on the back of the robot. As the rollers run, they
21 public class IntakeArm
extends Subsystem
{
22 private CANTalon intakeRoller
;
23 private CANTalon intakeArm
;
24 private AnalogPotentiometer intakePot
;
27 intakeRoller
= new CANTalon(Constants
.IntakeArm
.ROLLER_PORT
);
28 intakeArm
= new CANTalon(Constants
.IntakeArm
.INTAKE_PORT
);
32 * Intake only moves once at the beginning of the match. It lowers at the
33 * beginning of the match and is held there by mechanical stops until the end
36 * Must be used in a command that has a timer variable to stop it.
40 * These two methods (intakeBall and outputBall)sets the voltage of the motor.
41 * The voltage values are constants in Constants class
43 public void intakeBall() {
44 intakeRoller
.set(Constants
.IntakeArm
.INTAKE_SPEED
);
47 public void outputBall() {
48 intakeRoller
.set(Constants
.IntakeArm
.OUTPUT_SPEED
);
52 * This method gets you the current voltage of the motor that controls the
53 * intake arm roller. The range of voltage is from [-1,1].
54 * A negative voltage makes the motor run backwards.
56 * @return Returns the voltage of the motor that controls the roller. The
57 * range of the voltage goes from [-1,1].
58 * A negative voltage indicates that the motor is running backwards.
61 public double getRollerVoltage() {
62 return intakeRoller
.get();
66 * This method sets the voltage of the arm motor. The range is from [-1,1]. A
67 * negative voltage makes the direction of the motor go backwards.
70 * The voltage that you set the motor at. The range of the voltage of
71 * the arm motor is from [-1,1]. A
72 * negative voltage makes the direction of the motor go backwards.
75 public void setArmVoltage(double voltage
) {
78 else if (voltage
< -1)
81 intakeArm
.set(voltage
);
85 * This method gets you the current voltage of the motor that controls the
86 * intake arm. The range of voltage is from [-1,1].
87 * A negative voltage makes the motor run backwards.
89 * @return Returns the voltage of the motor that controls the arm. The
90 * range of the voltage goes from [-1,1].
91 * A negative voltage indicates that the motor is running backwards.
94 public double getArmVoltage() {
95 return intakeArm
.get();
99 * This method checks to see if the presence of the ball inside is true or
102 * @return Returns whether the ball is inside as true or false
105 public boolean isBallInside() {
110 * This method checks to see if the motors controlling the rollers are
113 * @return Returns whether the motors are currently running, and returns the
114 * state of the condition (true or false).
118 public boolean areRollersRolling() {
123 * This method gets the angle of the potentiometer on the Intake Arm.
125 * @return angle of potentiometer
127 public double getIntakePot() {
128 return intakePot
.get();
132 protected void initDefaultCommand() {