construct intakePot and add intake potentiometer constants to Constants
[3501/stronghold-2016] / src / org / usfirst / frc / team3501 / robot / subsystems / IntakeArm.java
CommitLineData
7b11350e
KZ
1package org.usfirst.frc.team3501.robot.subsystems;
2
3import org.usfirst.frc.team3501.robot.Constants;
4
6fd4f44e 5import edu.wpi.first.wpilibj.AnalogPotentiometer;
7b11350e
KZ
6import edu.wpi.first.wpilibj.CANTalon;
7import edu.wpi.first.wpilibj.command.Subsystem;
8
add57fee 9/***
1eb84222
SC
10 * The IntakeArm consists of two rollers that are controlled by one motor, with
11 * a potentiometer on it.
add57fee
YA
12 *
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
15 * intake the ball.
16 *
17 * @author superuser
18 *
19 */
20
7b11350e 21public class IntakeArm extends Subsystem {
28a012b6
SC
22 private CANTalon intakeRoller;
23 private CANTalon intakeArm;
6fd4f44e 24 private AnalogPotentiometer intakePot;
7b11350e
KZ
25
26 public IntakeArm() {
a7e06736
SC
27 intakeRoller = new CANTalon(Constants.IntakeArm.ROLLER_PORT);
28 intakeArm = new CANTalon(Constants.IntakeArm.INTAKE_PORT);
e780e49e
SC
29 intakePot = new AnalogPotentiometer(
30 Constants.IntakeArm.INTAKE_CHANNEL,
31 Constants.IntakeArm.FULL_RANGE,
32 Constants.IntakeArm.OFFSET);
7b11350e
KZ
33 }
34
35 /*
36 * Intake only moves once at the beginning of the match. It lowers at the
37 * beginning of the match and is held there by mechanical stops until the end
38 * of the match.
fdde5248 39 *
7b11350e
KZ
40 * Must be used in a command that has a timer variable to stop it.
41 */
7b11350e 42
a8329166
SC
43 /***
44 * These two methods (intakeBall and outputBall)sets the voltage of the motor.
45 * The voltage values are constants in Constants class
46 */
4c82a9f5 47 public void intakeBall() {
28a012b6 48 intakeRoller.set(Constants.IntakeArm.INTAKE_SPEED);
7b11350e
KZ
49 }
50
4c82a9f5 51 public void outputBall() {
28a012b6 52 intakeRoller.set(Constants.IntakeArm.OUTPUT_SPEED);
7b11350e
KZ
53 }
54
fdde5248 55 /***
5e330e78 56 * This method gets you the current voltage of the motor that controls the
2f2aa761 57 * intake arm roller. The range of voltage is from [-1,1].
5e330e78 58 * A negative voltage makes the motor run backwards.
add57fee
YA
59 *
60 * @return Returns the voltage of the motor that controls the roller. The
5e330e78
SC
61 * range of the voltage goes from [-1,1].
62 * A negative voltage indicates that the motor is running backwards.
fdde5248
YA
63 */
64
add57fee 65 public double getRollerVoltage() {
a8329166 66 return intakeRoller.get();
fdde5248
YA
67 }
68
2f2aa761
SC
69 /***
70 * This method sets the voltage of the arm motor. The range is from [-1,1]. A
71 * negative voltage makes the direction of the motor go backwards.
72 *
73 * @param voltage
74 * The voltage that you set the motor at. The range of the voltage of
75 * the arm motor is from [-1,1]. A
76 * negative voltage makes the direction of the motor go backwards.
77 */
78
79 public void setArmVoltage(double voltage) {
80 if (voltage > 1)
81 voltage = 1;
82 else if (voltage < -1)
83 voltage = -1;
84
85 intakeArm.set(voltage);
86 }
87
88 /***
89 * This method gets you the current voltage of the motor that controls the
90 * intake arm. The range of voltage is from [-1,1].
91 * A negative voltage makes the motor run backwards.
92 *
93 * @return Returns the voltage of the motor that controls the arm. The
94 * range of the voltage goes from [-1,1].
95 * A negative voltage indicates that the motor is running backwards.
96 */
97
98 public double getArmVoltage() {
99 return intakeArm.get();
100 }
101
fdde5248 102 /***
92adc9db
SC
103 * This method checks to see if the presence of the ball inside is true or
104 * false.
fdde5248 105 *
92adc9db 106 * @return Returns whether the ball is inside as true or false
8e57685f
KZ
107 */
108
109 public boolean isBallInside() {
110 return true;
111 }
112
113 /***
f8856d62
SC
114 * This method checks to see if the motors controlling the rollers are
115 * currently running.
0e37d53e
YA
116 *
117 * @return Returns whether the motors are currently running, and returns the
118 * state of the condition (true or false).
1eb84222 119 *
fdde5248
YA
120 */
121
122 public boolean areRollersRolling() {
123 return true;
124 }
125
6fd4f44e
SC
126 /***
127 * This method gets the angle of the potentiometer on the Intake Arm.
4c82a9f5 128 *
6fd4f44e
SC
129 * @return angle of potentiometer
130 */
131 public double getIntakePot() {
132 return intakePot.get();
133 }
134
7b11350e
KZ
135 @Override
136 protected void initDefaultCommand() {
137
138 }
139}