Class GenericHIDSim
java.lang.Object
org.wpilib.simulation.GenericHIDSim
- Direct Known Subclasses:
GamepadSim, JoystickSim, NiDsPS4ControllerSim, NiDsPS5ControllerSim, NiDsStadiaControllerSim, NiDsXboxControllerSim
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, DriverStation.POVDirection value) Set the value of a given POV.voidsetPOV(DriverStation.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(int supportedOutputs) Set the supported outputs of this device.
-
Field Details
-
m_port
GenericHID port.
-
-
Constructor Details
-
GenericHIDSim
Constructs from a GenericHID object.- Parameters:
joystick- joystick to simulate
-
GenericHIDSim
Constructs from a joystick port number.- Parameters:
port- port number
-
-
Method Details
-
notifyNewData
Updates joystick data so that new values are visible to the user program. -
setRawButton
Set the value of a given button.- Parameters:
button- the button to setvalue- the new value
-
setRawAxis
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
Set the maximum axis index for this device.- Parameters:
maximumIndex- the new maximum axis index
-
setAxesAvailable
Set the axis count of this device.- Parameters:
count- the new axis count
-
setPOVsMaximumIndex
Set the maximum POV index for this device.- Parameters:
maximumIndex- the new maximum POV index
-
setPOVsAvailable
Set the POV count of this device.- Parameters:
count- the new POV count
-
setButtonsMaximumIndex
Set the maximum button index for this device.- Parameters:
maximumIndex- the new maximum button index
-
setButtonsAvailable
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
-
getLeds
-
getRumble
Get the joystick rumble.- Parameters:
type- the rumble to read- Returns:
- the rumble value
-