public class XboxController extends GenericHID
This class handles Xbox input that comes from the Driver Station. Each time a value is requested the most recent value is returned. There is a single class instance for each controller and the mapping of ports to hardware buttons depends on the code in the Driver Station.
GenericHID.Hand, GenericHID.HIDType, GenericHID.RumbleType
Constructor and Description |
---|
XboxController(int port)
Construct an instance of a joystick.
|
Modifier and Type | Method and Description |
---|---|
boolean |
getAButton()
Read the value of the A button on the controller.
|
boolean |
getAButtonPressed()
Whether the A button was pressed since the last check.
|
boolean |
getAButtonReleased()
Whether the A button was released since the last check.
|
boolean |
getBackButton()
Read the value of the back button on the controller.
|
boolean |
getBackButtonPressed()
Whether the back button was pressed since the last check.
|
boolean |
getBackButtonReleased()
Whether the back button was released since the last check.
|
boolean |
getBButton()
Read the value of the B button on the controller.
|
boolean |
getBButtonPressed()
Whether the B button was pressed since the last check.
|
boolean |
getBButtonReleased()
Whether the B button was released since the last check.
|
boolean |
getBumper(GenericHID.Hand hand)
Read the value of the bumper button on the controller.
|
boolean |
getBumperPressed(GenericHID.Hand hand)
Whether the bumper was pressed since the last check.
|
boolean |
getBumperReleased(GenericHID.Hand hand)
Whether the bumper was released since the last check.
|
boolean |
getStartButton()
Read the value of the start button on the controller.
|
boolean |
getStartButtonPressed()
Whether the start button was pressed since the last check.
|
boolean |
getStartButtonReleased()
Whether the start button was released since the last check.
|
boolean |
getStickButton(GenericHID.Hand hand)
Read the value of the stick button on the controller.
|
boolean |
getStickButtonPressed(GenericHID.Hand hand)
Whether the stick button was pressed since the last check.
|
boolean |
getStickButtonReleased(GenericHID.Hand hand)
Whether the stick button was released since the last check.
|
double |
getTriggerAxis(GenericHID.Hand hand)
Get the trigger axis value of the controller.
|
double |
getX(GenericHID.Hand hand)
Get the X axis value of the controller.
|
boolean |
getXButton()
Read the value of the X button on the controller.
|
boolean |
getXButtonPressed()
Whether the X button was pressed since the last check.
|
boolean |
getXButtonReleased()
Whether the X button was released since the last check.
|
double |
getY(GenericHID.Hand hand)
Get the Y axis value of the controller.
|
boolean |
getYButton()
Read the value of the Y button on the controller.
|
boolean |
getYButtonPressed()
Whether the Y button was pressed since the last check.
|
boolean |
getYButtonReleased()
Whether the Y button was released since the last check.
|
getAxisCount, getAxisType, getButtonCount, getName, getPort, getPOV, getPOV, getPOVCount, getRawAxis, getRawButton, getRawButtonPressed, getRawButtonReleased, getType, getX, getY, setOutput, setOutputs, setRumble
public XboxController(int port)
port
- The port on the Driver Station that the joystick is plugged into.public double getX(GenericHID.Hand hand)
getX
in class GenericHID
hand
- Side of controller whose value should be returned.public double getY(GenericHID.Hand hand)
getY
in class GenericHID
hand
- Side of controller whose value should be returned.public double getTriggerAxis(GenericHID.Hand hand)
hand
- Side of controller whose value should be returned.public boolean getBumper(GenericHID.Hand hand)
hand
- Side of controller whose value should be returned.public boolean getBumperPressed(GenericHID.Hand hand)
hand
- Side of controller whose value should be returned.public boolean getBumperReleased(GenericHID.Hand hand)
hand
- Side of controller whose value should be returned.public boolean getStickButton(GenericHID.Hand hand)
hand
- Side of controller whose value should be returned.public boolean getStickButtonPressed(GenericHID.Hand hand)
hand
- Side of controller whose value should be returned.public boolean getStickButtonReleased(GenericHID.Hand hand)
hand
- Side of controller whose value should be returned.public boolean getAButton()
public boolean getAButtonPressed()
public boolean getAButtonReleased()
public boolean getBButton()
public boolean getBButtonPressed()
public boolean getBButtonReleased()
public boolean getXButton()
public boolean getXButtonPressed()
public boolean getXButtonReleased()
public boolean getYButton()
public boolean getYButtonPressed()
public boolean getYButtonReleased()
public boolean getBackButton()
public boolean getBackButtonPressed()
public boolean getBackButtonReleased()
public boolean getStartButton()
public boolean getStartButtonPressed()
public boolean getStartButtonReleased()