Commit | Line | Data |
---|---|---|
7b11350e KZ |
1 | package org.usfirst.frc.team3501.robot.subsystems; |
2 | ||
3 | import org.usfirst.frc.team3501.robot.Constants; | |
4 | ||
6fd4f44e | 5 | import edu.wpi.first.wpilibj.AnalogPotentiometer; |
7b11350e KZ |
6 | import edu.wpi.first.wpilibj.CANTalon; |
7 | import 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 | 21 | public 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 | ||
a8329166 SC |
35 | /*** |
36 | * These two methods (intakeBall and outputBall)sets the voltage of the motor. | |
37 | * The voltage values are constants in Constants class | |
38 | */ | |
4c82a9f5 | 39 | public void intakeBall() { |
28a012b6 | 40 | intakeRoller.set(Constants.IntakeArm.INTAKE_SPEED); |
7b11350e KZ |
41 | } |
42 | ||
4c82a9f5 | 43 | public void outputBall() { |
28a012b6 | 44 | intakeRoller.set(Constants.IntakeArm.OUTPUT_SPEED); |
7b11350e KZ |
45 | } |
46 | ||
fdde5248 | 47 | /*** |
5e330e78 | 48 | * This method gets you the current voltage of the motor that controls the |
2f2aa761 | 49 | * intake arm roller. The range of voltage is from [-1,1]. |
5e330e78 | 50 | * A negative voltage makes the motor run backwards. |
add57fee YA |
51 | * |
52 | * @return Returns the voltage of the motor that controls the roller. The | |
5e330e78 SC |
53 | * range of the voltage goes from [-1,1]. |
54 | * A negative voltage indicates that the motor is running backwards. | |
fdde5248 YA |
55 | */ |
56 | ||
add57fee | 57 | public double getRollerVoltage() { |
a8329166 | 58 | return intakeRoller.get(); |
fdde5248 YA |
59 | } |
60 | ||
2f2aa761 SC |
61 | /*** |
62 | * This method sets the voltage of the arm motor. The range is from [-1,1]. A | |
63 | * negative voltage makes the direction of the motor go backwards. | |
64 | * | |
65 | * @param voltage | |
66 | * The voltage that you set the motor at. The range of the voltage of | |
67 | * the arm motor is from [-1,1]. A | |
68 | * negative voltage makes the direction of the motor go backwards. | |
69 | */ | |
70 | ||
71 | public void setArmVoltage(double voltage) { | |
72 | if (voltage > 1) | |
73 | voltage = 1; | |
74 | else if (voltage < -1) | |
75 | voltage = -1; | |
76 | ||
77 | intakeArm.set(voltage); | |
78 | } | |
79 | ||
80 | /*** | |
81 | * This method gets you the current voltage of the motor that controls the | |
82 | * intake arm. The range of voltage is from [-1,1]. | |
83 | * A negative voltage makes the motor run backwards. | |
84 | * | |
85 | * @return Returns the voltage of the motor that controls the arm. The | |
86 | * range of the voltage goes from [-1,1]. | |
87 | * A negative voltage indicates that the motor is running backwards. | |
88 | */ | |
89 | ||
90 | public double getArmVoltage() { | |
91 | return intakeArm.get(); | |
92 | } | |
93 | ||
fdde5248 | 94 | /*** |
92adc9db SC |
95 | * This method checks to see if the presence of the ball inside is true or |
96 | * false. | |
fdde5248 | 97 | * |
92adc9db | 98 | * @return Returns whether the ball is inside as true or false |
8e57685f KZ |
99 | */ |
100 | ||
101 | public boolean isBallInside() { | |
102 | return true; | |
103 | } | |
104 | ||
105 | /*** | |
f8856d62 SC |
106 | * This method checks to see if the motors controlling the rollers are |
107 | * currently running. | |
0e37d53e YA |
108 | * |
109 | * @return Returns whether the motors are currently running, and returns the | |
110 | * state of the condition (true or false). | |
1eb84222 | 111 | * |
fdde5248 YA |
112 | */ |
113 | ||
114 | public boolean areRollersRolling() { | |
115 | return true; | |
116 | } | |
117 | ||
6fd4f44e SC |
118 | /*** |
119 | * This method gets the angle of the potentiometer on the Intake Arm. | |
4c82a9f5 | 120 | * |
6fd4f44e SC |
121 | * @return angle of potentiometer |
122 | */ | |
2634970a | 123 | public double getArmAngle() { |
6fd4f44e SC |
124 | return intakePot.get(); |
125 | } | |
126 | ||
7b11350e KZ |
127 | @Override |
128 | protected void initDefaultCommand() { | |
129 | ||
130 | } | |
131 | } |