GenericHID

class wpilib.interfaces.GenericHID(port)[source]

Bases: object

GenericHID Interface.

class HIDType(value)[source]

Bases: object

kHID1stPerson = 24
kHIDDriving = 22
kHIDFlight = 23
kHIDGamepad = 21
kHIDJoystick = 20
kUnknown = -1
kXInputArcadePad = 19
kXInputArcadeStick = 3
kXInputDancePad = 5
kXInputDrumKit = 8
kXInputFlightStick = 4
kXInputGamepad = 1
kXInputGuitar = 6
kXInputGuitar2 = 7
kXInputGuitar3 = 11
kXInputUnknown = 0
kXInputWheel = 2
class GenericHID.Hand[source]

Bases: object

Which hand the Human Interface Device is associated with.

kLeft = 0

Left Hand

kRight = 1

Right Hand

class GenericHID.RumbleType[source]

Bases: object

Represents a rumble output on the JoyStick.

kLeftRumble = 0

Left Hand

kRightRumble = 1

Right Hand

GenericHID.getName()[source]

Get the name of the HID.

Returns:the name of the HID.
GenericHID.getPOV(pov=0)[source]

Get the angle in degrees of a POV on the HID.

The POV angles start at 0 in the up direction, and increase clockwise (eg right is 90, upper-left is 315).

Parameters:pov – The index of the POV to read (starting at 0)
Returns:the angle of the POV in degrees, or -1 if the POV is not pressed.
GenericHID.getPOVCount()[source]

For the current HID, return the number of POVs.

GenericHID.getPort()[source]

Get the port number of the HID.

Returns:The port number of the HID.
GenericHID.getRawAxis(which)[source]

Get the raw axis.

Parameters:which – index of the axis
Returns:the raw value of the selected axis
GenericHID.getRawButton(button)[source]

Is the given button pressed.

Parameters:button – which button number
Returns:the angle of the POV in degrees, or -1 if the POV is not pressed.
GenericHID.getType()[source]

Get the type of the HID.

Returns:the type of the HID.
GenericHID.getX(hand=None)[source]

Get the x position of HID.

Parameters:hand – which hand, left or right
Returns:the x position
GenericHID.getY(hand=None)[source]

Get the y position of the HID.

Parameters:hand – which hand, left or right
Returns:the y position
GenericHID.setOutput(outputNumber, value)[source]

Set a single HID output value for the HID.

Parameters:
  • outputNumber – The index of the output to set (1-32)
  • value – The value to set the output to
GenericHID.setOutputs(value)[source]

Set all HID output values for the HID.

Parameters:value – The 32 bit output value (1 bit for each output)
GenericHID.setRumble(type, value)[source]

Set the rumble output for the HID. The DS currently supports 2 rumble values, left rumble and right rumble.

Parameters:
  • type – Which rumble value to set
  • value – The normalized value (0 to 1) to set the rumble to