GenericHIDSim

class wpilib.simulation.GenericHIDSim(*args, **kwargs)

Bases: pybind11_object

Class to control a simulated generic joystick.

Overloaded function.

  1. __init__(self: wpilib.simulation._simulation.GenericHIDSim, joystick: wpilib.interfaces._interfaces.GenericHID) -> None

Constructs from a GenericHID object.

Parameters:

joystick – joystick to simulate

  1. __init__(self: wpilib.simulation._simulation.GenericHIDSim, port: int) -> None

Constructs from a joystick port number.

Parameters:

port – port number

getOutput(outputNumber: int) bool

Read the output of a button.

Parameters:

outputNumber – the button number

Returns:

the value of the button (true = pressed)

getOutputs() int

Get the encoded 16-bit integer that passes button values.

Returns:

the button values

getRumble(type: wpilib.interfaces._interfaces.GenericHID.RumbleType) float

Get the joystick rumble.

Parameters:

type – the rumble to read

Returns:

the rumble value

notifyNewData() None

Updates joystick data so that new values are visible to the user program.

setAxisCount(count: int) None

Set the axis count of this device.

Parameters:

count – the new axis count

setAxisType(axis: int, type: int) None

Set the type of an axis.

Parameters:
  • axis – the axis

  • type – the type

setButtonCount(count: int) None

Set the button count of this device.

Parameters:

count – the new button count

setName(name: str) None

Set the name of this device.

Parameters:

name – the new device name

setPOV(*args, **kwargs)

Overloaded function.

  1. setPOV(self: wpilib.simulation._simulation.GenericHIDSim, pov: int, value: int) -> None

Set the value of a given POV.

Parameters:
  • pov – the POV to set

  • value – the new value

  1. setPOV(self: wpilib.simulation._simulation.GenericHIDSim, value: int) -> None

Set the value of the default POV (port 0).

Parameters:

value – the new value

setPOVCount(count: int) None

Set the POV count of this device.

Parameters:

count – the new POV count

setRawAxis(axis: int, value: float) None

Set the value of a given axis.

Parameters:
  • axis – the axis to set

  • value – the new value

setRawButton(button: int, value: bool) None

Set the value of a given button.

Parameters:
  • button – the button to set

  • value – the new value

setType(type: wpilib.interfaces._interfaces.GenericHID.HIDType) None

Set the type of this device.

Parameters:

type – the new device type