Commit | Line | Data |
---|---|---|
f11ce98e KZ |
1 | package org.usfirst.frc3501.RiceCatRobot.subsystems; |
2 | ||
f11ce98e KZ |
3 | import org.usfirst.frc3501.RiceCatRobot.commands.CloseClaw; |
4 | import org.usfirst.frc3501.RiceCatRobot.commands.OpenClaw; | |
4b8a525f KZ |
5 | import org.usfirst.frc3501.RiceCatRobot.robot.OI; |
6 | import org.usfirst.frc3501.RiceCatRobot.robot.Robot; | |
7 | import org.usfirst.frc3501.RiceCatRobot.robot.RobotMap; | |
f11ce98e KZ |
8 | |
9 | import edu.wpi.first.wpilibj.DoubleSolenoid; | |
10 | import edu.wpi.first.wpilibj.command.Subsystem; | |
11 | ||
12 | public class Claw extends Subsystem { | |
13 | ||
e3bfff96 KZ |
14 | private DoubleSolenoid solenoid; |
15 | public boolean toggleOn = false; | |
16 | ||
17 | public Claw() { | |
18 | solenoid = new DoubleSolenoid(RobotMap.MODULE_NUMBER, | |
19 | RobotMap.SOLENOID_FORWARD, RobotMap.SOLENOID_REVERSE); | |
20 | } | |
21 | ||
22 | public void initDefaultCommand() { | |
23 | } | |
24 | ||
25 | public void closeClaw() { | |
26 | solenoid.set(RobotMap.close); | |
27 | } | |
28 | ||
29 | public void openClaw() { | |
30 | solenoid.set(RobotMap.open); | |
31 | } | |
32 | ||
33 | public boolean isOpen() { | |
34 | return solenoid.get() == RobotMap.open; | |
35 | } | |
36 | ||
37 | public void doTriggerAction() { | |
38 | if (!Robot.claw.toggleOn) { | |
39 | if (OI.rightJoystick.getRawButton(RobotMap.TRIGGER_PORT)) { | |
40 | if (Robot.claw.isOpen()) { | |
41 | new CloseClaw().start(); | |
42 | } | |
43 | } else { | |
44 | if (!Robot.claw.isOpen()) { | |
45 | new OpenClaw().start(); | |
f11ce98e | 46 | } |
e3bfff96 | 47 | } |
f11ce98e | 48 | } |
e3bfff96 | 49 | } |
f11ce98e | 50 | } |