8
8
package frc .robot ;
9
9
10
10
import edu .wpi .first .wpilibj .Joystick ;
11
-
11
+ import edu .wpi .first .wpilibj .buttons .Button ;
12
+ import edu .wpi .first .wpilibj .buttons .JoystickButton ;
12
13
/**
13
14
* This class is the glue that binds the controls on the physical operator interface to the commands
14
15
* and command groups that allow control of the robot.
@@ -21,16 +22,10 @@ public class OI {
21
22
// number it is.
22
23
// Joystick stick = new Joystick(port);
23
24
// Button button = new JoystickButton(stick, buttonNumber);
25
+ public Joystick controller = new Joystick (RobotMap .CONTROLLER_PORT_ID );
26
+ public Button abutton = new JoystickButton (controller , RobotMap .A_BUTTON_ID );
27
+ public Button bbutton = new JoystickButton (controller , RobotMap .B_BUTTON_ID );
24
28
25
- Joystick xbox = new Joystick (RobotMap .JOYSTICK_PORT );
26
-
27
- public double getXboxX () {
28
- return xbox .getRawAxis (RobotMap .XBOX_X_AXIS );
29
- }
30
-
31
- public double getXboxY () {
32
- return xbox .getRawAxis (RobotMap .XBOX_Y_AXIS );
33
- }
34
29
// There are a few additional built in buttons you can use. Additionally,
35
30
// by subclassing Button you can create custom triggers and bind those to
36
31
// commands the same as any other Button.
@@ -51,4 +46,7 @@ public double getXboxY() {
51
46
// until it is finished as determined by it's isFinished method.
52
47
// button.whenReleased(new ExampleCommand());
53
48
49
+ public double getAxis (int axis ) {
50
+ return controller .getRawAxis (axis );
51
+ }
54
52
}
0 commit comments