Class ControlWord

java.lang.Object
org.wpilib.hardware.hal.ControlWord

public class ControlWord extends Object
A wrapper for the HALControlWord bitfield.
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    static final ControlWordStruct
     
  • Constructor Summary

    Constructors
    Constructor
    Description
    Default constructor.
  • Method Summary

    Modifier and Type
    Method
    Description
    boolean
     
    long
    Gets the native HAL control word value.
    long
    Gets the opmode ID.
    Gets the robot mode.
    int
     
    boolean
    Gets a value indicating whether the Driver Station requires the robot to be running in autonomous mode.
    boolean
    Gets a value indicating whether the Driver Station requires the robot to be running in autonomous mode and enabled.
    boolean
    Gets the DS attached flag.
    boolean
    Gets the Enabled flag.
    boolean
    Gets the E-Stop flag.
    boolean
    Gets the FMS attached flag.
    boolean
    Gets a value indicating whether the Driver Station requires the robot to be running in operator-controlled mode.
    boolean
    Gets a value indicating whether the Driver Station requires the robot to be running in operator-controller mode and enabled.
    boolean
    Gets a value indicating whether the Driver Station requires the robot to be running in test mode.
    boolean
    Gets a value indicating whether the Driver Station requires the robot to be running in test mode and enabled.
    void
    setOpModeId(long id)
    Sets the opmode ID.
    void
    update(long word)
    Updates from the native HAL value.
    void
    update(long opModeHash, RobotMode robotMode, boolean enabled, boolean emergencyStop, boolean fmsAttached, boolean dsAttached)
    Updates from state values.
    void
    Updates from an existing word.

    Methods inherited from class Object

    clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait
  • Field Details

  • Constructor Details

    • ControlWord

      public ControlWord()
      Default constructor.
  • Method Details

    • update

      public void update(long opModeHash, RobotMode robotMode, boolean enabled, boolean emergencyStop, boolean fmsAttached, boolean dsAttached)
      Updates from state values.
      Parameters:
      opModeHash - opmode hash
      robotMode - robot mode
      enabled - enabled
      emergencyStop - emergency stopped
      fmsAttached - FMS attached
      dsAttached - DS attached
    • update

      public void update(long word)
      Updates from the native HAL value.
      Parameters:
      word - value
    • update

      public void update(ControlWord word)
      Updates from an existing word.
      Parameters:
      word - word to update from
    • getOpModeId

      public long getOpModeId()
      Gets the opmode ID.
      Returns:
      the opmode ID
    • setOpModeId

      public void setOpModeId(long id)
      Sets the opmode ID.
      Parameters:
      id - opmode ID
    • getRobotMode

      Gets the robot mode.
      Returns:
      the robot mode
    • isEnabled

      public boolean isEnabled()
      Gets the Enabled flag.
      Returns:
      the Enabled flag
    • isEStopped

      public boolean isEStopped()
      Gets the E-Stop flag.
      Returns:
      the E-Stop flag
    • isFMSAttached

      public boolean isFMSAttached()
      Gets the FMS attached flag.
      Returns:
      the FMS attached flag
    • isDSAttached

      public boolean isDSAttached()
      Gets the DS attached flag.
      Returns:
      the DS attached flag
    • isAutonomous

      public boolean isAutonomous()
      Gets a value indicating whether the Driver Station requires the robot to be running in autonomous mode.
      Returns:
      True if autonomous mode should be enabled, false otherwise.
    • isAutonomousEnabled

      public boolean isAutonomousEnabled()
      Gets a value indicating whether the Driver Station requires the robot to be running in autonomous mode and enabled.
      Returns:
      True if autonomous should be set and the robot should be enabled.
    • isTeleop

      public boolean isTeleop()
      Gets a value indicating whether the Driver Station requires the robot to be running in operator-controlled mode.
      Returns:
      True if operator-controlled mode should be enabled, false otherwise.
    • isTeleopEnabled

      public boolean isTeleopEnabled()
      Gets a value indicating whether the Driver Station requires the robot to be running in operator-controller mode and enabled.
      Returns:
      True if operator-controlled mode should be set and the robot should be enabled.
    • isTest

      public boolean isTest()
      Gets a value indicating whether the Driver Station requires the robot to be running in test mode.
      Returns:
      True if test mode should be enabled, false otherwise.
    • isTestEnabled

      public boolean isTestEnabled()
      Gets a value indicating whether the Driver Station requires the robot to be running in test mode and enabled.
      Returns:
      True if test mode should be set and the robot should be enabled.
    • getNative

      public long getNative()
      Gets the native HAL control word value.
      Returns:
      control word value
    • equals

      public boolean equals(Object obj)
      Overrides:
      equals in class Object
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class Object