Commit | Line | Data |
---|---|---|
b449387d LH |
1 | package org.usfirst.frc.team3501.robot; |
2 | ||
e81578e3 LH |
3 | import java.util.Arrays; |
4 | ||
b449387d LH |
5 | import org.usfirst.frc.team3501.robot.commands.*; |
6 | ||
7 | public class OI { | |
f24c549d | 8 | private Joystick left, right; |
b449387d LH |
9 | |
10 | public OI() { | |
11 | left = new Joystick(RobotMap.LEFT_JOYSTICK_PORT); | |
12 | right = new Joystick(RobotMap.RIGHT_JOYSTICK_PORT); | |
13 | ||
14 | right.whenPressed(1, new CloseClaw()); | |
15 | right.whenReleased(1, new OpenClaw()); | |
510cff21 | 16 | |
d24e8611 LH |
17 | right.whenPressed(2, new ToggleClaw()); |
18 | ||
510cff21 LH |
19 | right.whenPressed(11, new TurnOffCompressor()); |
20 | right.whenPressed(12, new TurnOffCompressor()); | |
21 | ||
22 | right.whenPressed(7, new TurnOnCompressor()); | |
23 | right.whenPressed(8, new TurnOnCompressor()); | |
d24e8611 LH |
24 | |
25 | // potential bug point: this should "Just Work" because as soon as | |
26 | // command stops running, left stick pos at 0 should take over... | |
27 | // if that is not the case, arm will continue indefinitely. | |
28 | left.whileHeld(7, new TensionLeftWinch(RobotMap.ARM_ADJUST_SPEED)); | |
29 | left.whileHeld(6, new TensionLeftWinch(-RobotMap.ARM_ADJUST_SPEED)); | |
30 | left.whileHeld(11, new TensionRightWinch(RobotMap.ARM_ADJUST_SPEED)); | |
31 | left.whileHeld(10, new TensionRightWinch(-RobotMap.ARM_ADJUST_SPEED)); | |
b449387d LH |
32 | } |
33 | ||
f24c549d LH |
34 | public double getForwardL() { |
35 | return left.getY(); | |
36 | } | |
37 | ||
38 | public double getForwardR() { | |
b449387d LH |
39 | return right.getY(); |
40 | } | |
41 | ||
f24c549d | 42 | public double getTwistR() { |
b449387d LH |
43 | return right.getTwist(); |
44 | } | |
e81578e3 LH |
45 | |
46 | public boolean getRightPressed(int... buttons) { | |
47 | return Arrays.stream(buttons).anyMatch(b -> right.get(b)); | |
48 | } | |
b449387d | 49 | } |