Class GenericHIDSim

java.lang.Object
org.wpilib.simulation.GenericHIDSim
Direct Known Subclasses:
GamepadSim, JoystickSim, NiDsPS4ControllerSim, NiDsPS5ControllerSim, NiDsStadiaControllerSim, NiDsXboxControllerSim

public class GenericHIDSim extends Object
Class to control a simulated generic joystick.
  • Field Details

    • m_port

      protected final int m_port
      GenericHID port.
  • Constructor Details

    • GenericHIDSim

      public GenericHIDSim(GenericHID joystick)
      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 set
      value - the new value
    • setRawAxis

      public void setRawAxis(int axis, double value)
      Set the value of a given axis.
      Parameters:
      axis - the axis to set
      value - the new value
    • setPOV

      public void setPOV(int pov, DriverStation.POVDirection value)
      Set the value of a given POV.
      Parameters:
      pov - the POV to set
      value - the new value
    • setPOV

      public void setPOV(DriverStation.POVDirection value)
      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

      public void setGamepadType(GenericHID.HIDType type)
      Set the type of this device.
      Parameters:
      type - the new device type
    • setSupportedOutputs

      public void setSupportedOutputs(int supportedOutputs)
      Set the supported outputs of this device.
      Parameters:
      supportedOutputs - the new supported outputs
    • setName

      public void setName(String name)
      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

      public double getRumble(GenericHID.RumbleType type)
      Get the joystick rumble.
      Parameters:
      type - the rumble to read
      Returns:
      the rumble value