forked from frc2879/2014-mermaid
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merged dev1 into master at v1.08, confirmed working
- Loading branch information
Showing
4 changed files
with
539 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -7,6 +7,7 @@ | |
.Trashes | ||
ehthumbs.db | ||
Thumbs.db | ||
__MACOSX | ||
|
||
# NetBeans specific # | ||
nbproject/private/ | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,134 @@ | ||
/* | ||
* To change this license header, choose License Headers in Project Properties. | ||
* To change this template file, choose Tools | Templates | ||
* and open the template in the editor. | ||
*/ | ||
|
||
package com.frc2879.bender; | ||
|
||
/** | ||
* | ||
* @author floogulinc | ||
*/ | ||
public class GamepadXbox extends XboxController{ | ||
|
||
public GamepadXbox(int port) { | ||
super(port); | ||
} | ||
|
||
// Defining Joystick Mappings: | ||
public final int Button_X = 3; | ||
public final int Button_Y = 4; | ||
public final int Button_A = 1; | ||
public final int Button_B = 2; | ||
public final int Button_START = 8; | ||
public final int Button_BACK = 7; | ||
public final int Button_RIGHT_BUMPER = 6; | ||
//public final int Button_RIGHT_TRIGGER = 8; | ||
public final int Button_LEFT_BUMPER = 5; | ||
// public final int Button_LEFT_TRIGGER = 7; | ||
public final int Button_LEFT_STICK = 11; | ||
public final int Button_RIGHT_STICK = 12; | ||
|
||
// Joystick axis(s) | ||
public final int Stick_LEFT_Y = 2; | ||
public final int Stick_LEFT_X = 1; | ||
public final int Stick_RIGHT_X = 4; | ||
public final int Stick_RIGHT_Y = 5; | ||
public final int Axis_TRIGGER = 3; | ||
public final int Axis_DPAD = 6; | ||
|
||
|
||
/** | ||
* Returns the X position of the left stick. | ||
*/ | ||
public double getLeftX() { | ||
return getRawAxis(Stick_LEFT_X); | ||
} | ||
|
||
/** | ||
* Returns the X position of the right stick. | ||
*/ | ||
public double getRightX() { | ||
return getRawAxis(Stick_RIGHT_X); | ||
} | ||
|
||
/** | ||
* Returns the Y position of the left stick. | ||
*/ | ||
public double getLeftY() { | ||
return getRawAxis(Stick_LEFT_Y); | ||
} | ||
|
||
/** | ||
* Returns the Y position of the right stick. | ||
*/ | ||
public double getRightY() { | ||
return getRawAxis(Stick_RIGHT_Y); | ||
} | ||
|
||
/** | ||
* Checks whether Button A is being pressed and returns true if it is. | ||
*/ | ||
public boolean getButtonStateA() { | ||
return getRawButton(Button_A); | ||
} | ||
|
||
/** | ||
* Checks whether Button B is being pressed and returns true if it is. | ||
*/ | ||
public boolean getButtonStateB() { | ||
return getRawButton(Button_B); | ||
} | ||
|
||
/** | ||
* Checks whether Button X is being pressed and returns true if it is. | ||
*/ | ||
public boolean getButtonStateX() { | ||
return getRawButton(Button_X); | ||
} | ||
|
||
/** | ||
* Checks whether Button Y is being pressed and returns true if it is. | ||
*/ | ||
public boolean getButtonStateY() { | ||
return getRawButton(Button_Y); | ||
} | ||
|
||
public boolean getButtonStateLeftBumper() { | ||
return getRawButton(Button_LEFT_BUMPER); | ||
} | ||
|
||
public boolean getButtonStateRightBumper() { | ||
return getRawButton(Button_RIGHT_BUMPER); | ||
} | ||
|
||
|
||
|
||
/** | ||
* Return the DPad axis positions. | ||
*/ | ||
public double getDPadX() { | ||
return getRawAxis(Axis_DPAD); | ||
} | ||
|
||
|
||
//Stuff from old logitech class | ||
|
||
|
||
/** | ||
* DPad Left and Right only WPILIB cannot access the vertical axis of the | ||
* Logitech Game Controller Dpad | ||
*/ | ||
// public boolean getDPadLeft() { | ||
// double x = getDPadX(); | ||
// return (x < -0.5); | ||
// } | ||
|
||
//public boolean getDPadRight() { | ||
// double x = getDPadX(); | ||
// return (x > 0.5); | ||
// } | ||
|
||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.