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 | 12 | * |
dc394eb0 SG |
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 | |
15 | * the ball. | |
add57fee YA |
16 | * |
17 | * @author superuser | |
18 | * | |
19 | */ | |
20 | ||
7b11350e | 21 | public class IntakeArm extends Subsystem { |
dc394eb0 SG |
22 | private CANTalon intakeRoller; |
23 | private CANTalon intakeArm; | |
24 | private AnalogPotentiometer intakePot; | |
25 | ||
26 | public IntakeArm() { | |
27 | intakeRoller = new CANTalon(Constants.IntakeArm.ROLLER_PORT); | |
28 | intakeArm = new CANTalon(Constants.IntakeArm.ARM_PORT); | |
29 | intakePot = new AnalogPotentiometer(Constants.IntakeArm.POT_CHANNEL, Constants.IntakeArm.FULL_RANGE, | |
30 | Constants.IntakeArm.OFFSET); | |
31 | } | |
32 | ||
33 | /*** | |
34 | * This method sets the voltage of the motor to intake the ball. The voltage | |
35 | * values are constants in Constants class | |
36 | */ | |
37 | public void intakeBall() { | |
38 | intakeRoller.set(Constants.IntakeArm.INTAKE_SPEED); | |
39 | } | |
40 | ||
41 | /*** | |
42 | * This method sets the voltage of the motor to output the ball. The voltage | |
43 | * values are constants in Constants class | |
44 | */ | |
45 | public void outputBall() { | |
46 | intakeRoller.set(Constants.IntakeArm.OUTPUT_SPEED); | |
47 | } | |
48 | ||
49 | /*** | |
50 | * This method gets you the current voltage of the motor that controls the | |
51 | * intake arm roller. The range of voltage is from [-1,1]. A negative | |
52 | * voltage makes the motor run backwards. | |
53 | * | |
54 | * @return Returns the voltage of the motor that controls the roller. The | |
55 | * range of the voltage goes from [-1,1]. A negative voltage | |
56 | * indicates that the motor is running backwards. | |
57 | */ | |
58 | ||
59 | public double getRollerVoltage() { | |
60 | return intakeRoller.get(); | |
61 | } | |
62 | ||
63 | /*** | |
64 | * This method sets the voltage of the arm motor. The range is from [-1,1]. | |
65 | * A negative voltage makes the direction of the motor go backwards. | |
66 | * | |
67 | * @param voltage | |
68 | * The voltage that you set the motor at. The range of the | |
69 | * voltage of the arm motor is from [-1,1]. A negative voltage | |
70 | * makes the direction of the motor go backwards. | |
71 | */ | |
72 | ||
73 | public void setArmVoltage(double voltage) { | |
74 | if (voltage > 1) | |
75 | voltage = 1; | |
76 | else if (voltage < -1) | |
77 | voltage = -1; | |
78 | ||
79 | intakeArm.set(voltage); | |
80 | } | |
81 | ||
82 | /*** | |
83 | * This method gets you the current voltage of the motor that controls the | |
84 | * intake arm. The range of voltage is from [-1,1]. A negative voltage makes | |
85 | * the motor run backwards. | |
86 | * | |
87 | * @return Returns the voltage of the motor that controls the arm. The range | |
88 | * of the voltage goes from [-1,1]. A negative voltage indicates | |
89 | * that the motor is running backwards. | |
90 | */ | |
91 | ||
92 | public double getArmVoltage() { | |
93 | return intakeArm.get(); | |
94 | } | |
95 | ||
96 | /*** | |
97 | * This method checks to see if the presence of the ball inside is true or | |
98 | * false. | |
99 | * | |
100 | * @return Returns whether the ball is inside as true or false | |
101 | */ | |
102 | ||
103 | public boolean isBallInside() { | |
104 | return true; | |
105 | } | |
106 | ||
107 | /*** | |
108 | * This method checks to see if the motors controlling the rollers are | |
109 | * currently running. | |
110 | * | |
111 | * @return Returns whether the motors are currently running, and returns the | |
112 | * state of the condition (true or false). | |
113 | * | |
114 | */ | |
115 | ||
116 | public boolean areRollersRolling() { | |
117 | return true; | |
118 | } | |
119 | ||
120 | /*** | |
121 | * This method gets the angle of the potentiometer on the Intake Arm. | |
122 | * | |
123 | * @return angle of potentiometer | |
124 | */ | |
125 | public double getArmAngle() { | |
126 | return intakePot.get(); | |
127 | } | |
128 | ||
129 | @Override | |
130 | protected void initDefaultCommand() { | |
131 | ||
132 | } | |
7b11350e | 133 | } |