Class GenericHIDSim
java.lang.Object
org.wpilib.simulation.GenericHIDSim
- Direct Known Subclasses:
DualSenseControllerSim, DualSenseEdgeControllerSim, DualShock4ControllerSim, GameCubeControllerSim, GamepadSim, JoystickSim, LogitechF310ControllerSim, NiDsPS4ControllerSim, NiDsPS5ControllerSim, NiDsStadiaControllerSim, NiDsXboxControllerSim, SteamControllerSim, Switch2GCControllerSim, Switch2ProControllerSim, SwitchN64ControllerSim, SwitchProControllerSim, XboxControllerSim
Class to control a simulated generic joystick.
-
Field Summary
Fields -
Constructor Summary
ConstructorsConstructorDescriptionGenericHIDSim(int port) Constructs from a joystick port number.GenericHIDSim(GenericHID joystick) Constructs from a GenericHID object. -
Method Summary
Modifier and TypeMethodDescriptionintgetLeds()Get the led color set.doubleGet the joystick rumble.voidUpdates joystick data so that new values are visible to the user program.voidsetAxesAvailable(int count) Set the axis count of this device.voidsetAxesMaximumIndex(int maximumIndex) Set the maximum axis index for this device.voidsetButtonsAvailable(long count) Set the button count of this device.voidsetButtonsMaximumIndex(int maximumIndex) Set the maximum button index for this device.voidSet the type of this device.voidSet the name of this device.voidsetPOV(int pov, POVDirection value) Set the value of a given POV.voidsetPOV(POVDirection value) Set the value of the default POV (port 0).voidsetPOVsAvailable(int count) Set the POV count of this device.voidsetPOVsMaximumIndex(int maximumIndex) Set the maximum POV index for this device.voidsetRawAxis(int axis, double value) Set the value of a given axis.voidsetRawButton(int button, boolean value) Set the value of a given button.voidsetSupportedOutputs(EnumSet<GenericHID.SupportedOutput> supportedOutputs) Set the supported outputs of this device.
-
Field Details
-
m_port
protected final int m_portGenericHID port.
-
-
Constructor Details
-
GenericHIDSim
Constructs from a GenericHID object.- Parameters:
joystick- joystick to simulate
-
GenericHIDSim
public GenericHIDSim(int port) Constructs from a joystick port number.- Parameters:
port- port number
-
-
Method Details
-
notifyNewData
public void notifyNewData()Updates joystick data so that new values are visible to the user program. -
setRawButton
public void setRawButton(int button, boolean value) Set the value of a given button.- Parameters:
button- the button to setvalue- the new value
-
setRawAxis
public void setRawAxis(int axis, double value) Set the value of a given axis.- Parameters:
axis- the axis to setvalue- the new value
-
setPOV
Set the value of a given POV.- Parameters:
pov- the POV to setvalue- the new value
-
setPOV
Set the value of the default POV (port 0).- Parameters:
value- the new value
-
setAxesMaximumIndex
public void setAxesMaximumIndex(int maximumIndex) Set the maximum axis index for this device.- Parameters:
maximumIndex- the new maximum axis index
-
setAxesAvailable
public void setAxesAvailable(int count) Set the axis count of this device.- Parameters:
count- the new axis count
-
setPOVsMaximumIndex
public void setPOVsMaximumIndex(int maximumIndex) Set the maximum POV index for this device.- Parameters:
maximumIndex- the new maximum POV index
-
setPOVsAvailable
public void setPOVsAvailable(int count) Set the POV count of this device.- Parameters:
count- the new POV count
-
setButtonsMaximumIndex
public void setButtonsMaximumIndex(int maximumIndex) Set the maximum button index for this device.- Parameters:
maximumIndex- the new maximum button index
-
setButtonsAvailable
public void setButtonsAvailable(long count) Set the button count of this device.- Parameters:
count- the new button count
-
setGamepadType
Set the type of this device.- Parameters:
type- the new device type
-
setSupportedOutputs
Set the supported outputs of this device.- Parameters:
supportedOutputs- the new supported outputs
-
setName
Set the name of this device.- Parameters:
name- the new device name
-
getLeds
public int getLeds()Get the led color set.- Returns:
- the led color set
-
getRumble
Get the joystick rumble.- Parameters:
type- the rumble to read- Returns:
- the rumble value
-