XboxController

class wpilib.XboxController(port)[source]

Bases: wpilib.interfaces.GamepadBase

GenericHID.Handle input from Xbox 360 or Xbox One controllers connected to the Driver Station.

This class handles Xbox input that comes from the Driver Station. Each time a value is requested the most recent value is returend. 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.

Construct an instance of an XBoxController. The XBoxController index is the USB port on the Driver Station.

Parameters:port – The port on the Driver Station that the joystick is plugged into
getAButton()[source]

Read the value of the A button on the controller

Returns:The state of the A button
Return type:boolean
getBButton()[source]

Read the value of the B button on the controller

Returns:The state of the B button
Return type:boolean
getBackButton()[source]

Read the value of the back button on the controller

Returns:The state of the back button
Return type:boolean
getBumper(hand)[source]

Read the values of the bumper button on the controller.

Parameters:hand – Side of controller whose value should be returned.
Returns:The state of the button
Return type:boolean
getName()[source]
getPOV(pov)[source]
getPOVCount()[source]
getRawAxis(axis)[source]

Get the value of the axis

Parameters:axis – The axis to read, starting at 0
Returns:The value of the axis
Return type:float
getRawButton(button)[source]

Get the buttom value (starting at button 1)

Parameters:button – The button number to be read (starting at 1)
Returns:The state of the button
Return type:boolean
getStartButton()[source]

Read the value of the start button on the controller

Returns:The state of the start button
Return type:boolean
getStickButton(hand)[source]

Read the values of the stick button on the controller

Parameters:hand – Side of the controller whose value should be returned
Returns:The state of the button
Return type:boolean
getTriggerAxis(hand)[source]

Get the trigger axis value of the controller.

Parameters:hand – Side of controller whose value should be returned
Returns:The trigger axis value of the controller
Return type:float
getType()[source]
getX(hand)[source]

Get the X axis value of the controller.

Parameters:hand – Side of controller whose value should be returned
Returns:The X axis value of the controller
Return type:float
getXButton()[source]

Read the value of the X button on the controller

Returns:The state of the X button
Return type:boolean
getY(hand)[source]

Get the Y axis value of the controller.

Parameters:hand – Side of controller whose value should be returned
Returns:The Y axis value of the controller
Return type:float
getYButton()[source]

Read the value of the Y button on the controller

Returns:The state of the Y button
Return type:boolean
setOutput(outputNumber, value)[source]
setOutputs(value)[source]
setRumble(type_, value)[source]