Class Control
java.lang.Object
io.github.roboblazers7617.buttonbox.Control
- Direct Known Subclasses:
Button
,TestControl
Class for buttonbox controls that handles feedback and NetworkTables.
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptiongetId()
Gets the ID of this control.getTable()
Gets the NetworkTable used by this Control.void
setTable
(NetworkTable table) Sets the NetworkTable to be used by this Control.void
setupNetworkTables
(NetworkTable table) Called by the Control class when the NetworkTable is set.void
Should set up any simulation-specific things.void
Updates the control's state on the client.void
Interfaces with the buttonbox hardware and updates the state of the physical control.void
Updates the control's state on the client and hardware.void
Updates the control's state on the server.
-
Constructor Details
-
Control
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 afterupdateClient()
.This doesn't do anything by default, and should be overridden by the class inheritting this.
-
setupNetworkTables
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
Gets the ID of this control.- Returns:
- The ID of this control.
-
getTable
Gets the NetworkTable used by this Control. -
setTable
Sets the NetworkTable to be used by this Control. A subtable will be created with the ID string as its key.
-