Commit | Line | Data |
---|---|---|
7b11350e KZ |
1 | package org.usfirst.frc.team3501.robot.subsystems; |
2 | ||
3 | import org.usfirst.frc.team3501.robot.Constants; | |
4 | ||
5 | import edu.wpi.first.wpilibj.CANTalon; | |
5cff8910 | 6 | import edu.wpi.first.wpilibj.DoubleSolenoid; |
7b11350e KZ |
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 { |
4e0d6389 LM |
22 | |
23 | private CANTalon intakeRoller; | |
5cff8910 | 24 | private DoubleSolenoid leftIntake, rightIntake; |
54c588d9 | 25 | public static double moveIntakeArmSpeed = 0; |
4e0d6389 LM |
26 | |
27 | public IntakeArm() { | |
28 | intakeRoller = new CANTalon(Constants.IntakeArm.ROLLER_PORT); | |
5cff8910 ME |
29 | |
30 | leftIntake = new DoubleSolenoid(Constants.IntakeArm.LEFT_FORWARD, | |
31 | Constants.IntakeArm.LEFT_REVERSE); | |
32 | ||
33 | rightIntake = new DoubleSolenoid(Constants.IntakeArm.RIGHT_FORWARD, | |
34 | Constants.IntakeArm.RIGHT_REVERSE); | |
4e0d6389 LM |
35 | } |
36 | ||
37 | /*** | |
38 | * This method sets the voltage of the motor to intake the ball. The voltage | |
39 | * values are constants in Constants class | |
40 | */ | |
41 | public void intakeBall() { | |
42 | intakeRoller.set(Constants.IntakeArm.INTAKE_SPEED); | |
43 | } | |
44 | ||
45 | /*** | |
46 | * This method sets the voltage of the motor to output the ball. The voltage | |
47 | * values are constants in Constants class | |
48 | */ | |
49 | public void outputBall() { | |
50 | intakeRoller.set(Constants.IntakeArm.OUTPUT_SPEED); | |
51 | } | |
52 | ||
2b65c91d | 53 | public void stopRollers() { |
33141cdd | 54 | intakeRoller.set(0); |
2b65c91d LM |
55 | } |
56 | ||
4e0d6389 LM |
57 | /*** |
58 | * This method gets you the current voltage of the motor that controls the | |
59 | * intake arm roller. The range of voltage is from [-1,1]. A negative voltage | |
60 | * makes the motor run backwards. | |
61 | * | |
62 | * @return Returns the voltage of the motor that controls the roller. The | |
63 | * range of the voltage goes from [-1,1]. A negative voltage indicates | |
64 | * that the motor is running backwards. | |
65 | */ | |
66 | ||
67 | public double getRollerVoltage() { | |
68 | return intakeRoller.get(); | |
69 | } | |
70 | ||
4e0d6389 LM |
71 | /*** |
72 | * This method checks to see if the presence of the ball inside is true or | |
73 | * false. | |
74 | * | |
75 | * @return Returns whether the ball is inside as true or false | |
76 | */ | |
77 | ||
78 | public boolean isBallInside() { | |
79 | return true; | |
80 | } | |
81 | ||
82 | /*** | |
83 | * This method checks to see if the motors controlling the rollers are | |
84 | * currently running. | |
85 | * | |
86 | * @return Returns whether the motors are currently running, and returns the | |
87 | * state of the condition (true or false). | |
88 | * | |
89 | */ | |
90 | ||
91 | public boolean areRollersRolling() { | |
42c4c734 LM |
92 | if (Math.abs(getRollerVoltage()) < 0.02) |
93 | return false; | |
4e0d6389 LM |
94 | return true; |
95 | } | |
96 | ||
4e0d6389 LM |
97 | @Override |
98 | protected void initDefaultCommand() { | |
99 | ||
100 | } | |
7b11350e | 101 | } |