1
|
|
|
package org.usfirst.frc.team3695.robot; |
2
|
|
|
|
3
|
|
|
import edu.wpi.first.wpilibj.Joystick; |
4
|
|
|
|
5
|
|
|
/** the output/input setup */ |
6
|
|
|
public class OI { |
|
|
|
|
7
|
|
|
|
8
|
|
|
public static final Joystick DRIVER = new Joystick(0); |
9
|
|
|
public static final Joystick OPERATOR = new Joystick(1); |
10
|
|
|
|
11
|
|
|
|
12
|
|
|
/** |
13
|
|
|
* assigns what every SmartDash and controller button does |
14
|
|
|
* |
15
|
|
|
* ye() gets called at teleop enable, assigning button values to controller input |
16
|
|
|
* still in ye(), below controller value assigns, place each SmartDash button |
17
|
|
|
* */ |
18
|
|
|
public static void ye() { // see footer for name explanation |
19
|
|
|
|
20
|
|
|
} |
21
|
|
|
} |
22
|
|
|
/************************ |
23
|
|
|
* [Colton and AJ discussing why OI was instantiated but never used in 2017's Robot.java] |
24
|
|
|
* (it's because all of the setup was in the constructor, not a method) |
25
|
|
|
* |
26
|
|
|
* AJ : Yeah, so in that case just turn the constructor into a static method. |
27
|
|
|
* Colton: what if I just moved the OI constructor code to a new static method in OI, then call that method |
28
|
|
|
* AJ : And then call that |
29
|
|
|
* Colton: okay we are on the same page |
30
|
|
|
* AJ : ye |
31
|
|
|
* Colton: I'll call it ye |
32
|
|
|
* AJ : -_- |
33
|
|
|
* Colton: I'm doing it |
34
|
|
|
* |
35
|
|
|
* TL;DR: AJ doesn't type fast enough and accidentally said it shall be named ye... AND SO IT SHALL |
36
|
|
|
***********************/ |
37
|
|
|
|
38
|
|
|
|
39
|
|
|
|
40
|
|
|
|
41
|
|
|
|
42
|
|
|
/// WPILIB comments |
43
|
|
|
////CREATING BUTTONS |
44
|
|
|
// One type of button is a joystick button which is any button on a |
45
|
|
|
//// joystick. |
46
|
|
|
// You create one by telling it which joystick it's on and which button |
47
|
|
|
// number it is. |
48
|
|
|
// Joystick stick = new Joystick(port); |
49
|
|
|
// Button button = new JoystickButton(stick, buttonNumber); |
50
|
|
|
|
51
|
|
|
// There are a few additional built in buttons you can use. Additionally, |
52
|
|
|
// by subclassing Button you can create custom triggers and bind those to |
53
|
|
|
// commands the same as any other Button. |
54
|
|
|
|
55
|
|
|
//// TRIGGERING COMMANDS WITH BUTTONS |
56
|
|
|
// Once you have a button, it's trivial to bind it to a button in one of |
57
|
|
|
// three ways: |
58
|
|
|
|
59
|
|
|
// Start the command when the button is pressed and let it run the command |
60
|
|
|
// until it is finished as determined by it's isFinished method. |
61
|
|
|
// button.whenPressed(new ExampleCommand()); |
62
|
|
|
|
63
|
|
|
// Run the command while the button is being held down and interrupt it once |
64
|
|
|
// the button is released. |
65
|
|
|
// button.whileHeld(new ExampleCommand()); |
66
|
|
|
|
67
|
|
|
// Start the command when the button is released and let it run the command |
68
|
|
|
// until it is finished as determined by it's isFinished method. |
69
|
|
|
// button.whenReleased(new ExampleCommand()); |