Class Control

java.lang.Object
io.github.roboblazers7617.buttonbox.Control
Direct Known Subclasses:
Button, TestControl

public class Control extends Object
Class for buttonbox controls that handles feedback and NetworkTables.
  • Constructor Details

    • Control

      public Control(String id)
      Creates a new Control.
      Parameters:
      id - The ID string that the device should use. This will be used as the name for the NetworkTables subtable used by this control.
  • Method Details

    • updateServer

      public void updateServer()
      Updates the control's state on the server.

      This doesn't do anything by default, and should be overridden by the class inheritting this.

    • updateOnClient

      public void updateOnClient()
      Updates the control's state on the client and hardware. This is called by the program loop and is not intended to be overridden.
    • updateClient

      public void updateClient()
      Updates the control's state on the client. This should get any feedback from the server, but this should not interface with the buttonbox hardware.

      This doesn't do anything by default, and should be overridden by the class inheritting this.

    • updateHardware

      public void updateHardware()
      Interfaces with the buttonbox hardware and updates the state of the physical control. Called after updateClient().

      This doesn't do anything by default, and should be overridden by the class inheritting this.

    • setupNetworkTables

      public void setupNetworkTables(NetworkTable table)
      Called by the Control class when the NetworkTable is set. Not intended to be called outside of the class.

      This should create all of the NetworkTables publishers and subscribers for the inheritting class.

      Parameters:
      table - NetworkTable
    • setupSimulation

      public void setupSimulation()
      Should set up any simulation-specific things.

      Called as a part of the constructor if the library is running in simulation.

    • getId

      public String getId()
      Gets the ID of this control.
      Returns:
      The ID of this control.
    • getTable

      public NetworkTable getTable()
      Gets the NetworkTable used by this Control.
    • setTable

      public void setTable(NetworkTable table)
      Sets the NetworkTable to be used by this Control. A subtable will be created with the ID string as its key.