Package com.titaniumtigers4829.utils
Class NTUtils
java.lang.Object
com.titaniumtigers4829.utils.NTUtils
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic voidClears any static caches held in TigerHelpers.static voidFlushes the NetworkTables to ensure that any newly updated entry is immediately sent to the network.static edu.wpi.first.networktables.DoubleArrayEntrygetLimelightDoubleArrayEntry(String tableName, String entryName) Gets a DoubleArrayEntry from a Limelight camera.static edu.wpi.first.networktables.NetworkTablegetLimelightNetworkTable(String tableName) Gets the NetworkTable for a Limelight camera.static doublegetLimelightNetworkTableDouble(String tableName, String entryName) Gets a NetworkTableEntry from a Limelight camera as a double.static double[]getLimelightNetworkTableDoubleArray(String tableName, String entryName) Gets a NetworkTableEntry from a Limelight camera as a double array.static edu.wpi.first.networktables.NetworkTableEntrygetLimelightNetworkTableEntry(String tableName, String entryName) Gets a NetworkTableEntry from a Limelight camera.static edu.wpi.first.networktables.NetworkTableInstanceGets the NetworkTableInstance used for Limelight communication.static voidsetLimelightNetworkTableDouble(String tableName, String entryName, double val) Sets a NetworkTableEntry from a Limelight camera as a double.static voidsetLimelightNetworkTableDoubleArray(String tableName, String entryName, double[] val) Sets a NetworkTableEntry from a Limelight camera as a double array.static voidsetNetworkTableInstance(edu.wpi.first.networktables.NetworkTableInstance newNetworkTableInstance) Sets the NetworkTableInstance to use for Limelight communication.
-
Constructor Details
-
NTUtils
public NTUtils()
-
-
Method Details
-
getNetworkTableInstance
public static edu.wpi.first.networktables.NetworkTableInstance getNetworkTableInstance()Gets the NetworkTableInstance used for Limelight communication.- Returns:
- The NetworkTableInstance used for Limelight communication
-
setNetworkTableInstance
public static void setNetworkTableInstance(edu.wpi.first.networktables.NetworkTableInstance newNetworkTableInstance) Sets the NetworkTableInstance to use for Limelight communication. Normally it it uses the default instance. This is useful for unit testing when you might need multiple instances. -
clearCaches
public static void clearCaches()Clears any static caches held in TigerHelpers. This should be called in your test setup (or teardown) to ensure a fresh state between tests. -
flushNetworkTable
public static void flushNetworkTable()Flushes the NetworkTables to ensure that any newly updated entry is immediately sent to the network. -
getLimelightNetworkTable
Gets the NetworkTable for a Limelight camera.- Parameters:
tableName- The name of the Limelight set in the UI ("" for default)- Returns:
- NetworkTable for the Limelight
-
getLimelightNetworkTableEntry
public static edu.wpi.first.networktables.NetworkTableEntry getLimelightNetworkTableEntry(String tableName, String entryName) Gets a NetworkTableEntry from a Limelight camera.- Parameters:
tableName- The name of the Limelight set in the UI ("" for default)entryName- Name of the entry to get- Returns:
- NetworkTableEntry for the entry name
-
getLimelightNetworkTableDouble
Gets a NetworkTableEntry from a Limelight camera as a double.- Parameters:
tableName- The name of the Limelight set in the UI ("" for default)entryName- Name of the entry to get- Returns:
- double value of the entry
-
setLimelightNetworkTableDouble
Sets a NetworkTableEntry from a Limelight camera as a double.- Parameters:
tableName- The name of the Limelight set in the UI ("" for default)entryName- Name of the entry to setval- Value to set the entry to
-
getLimelightNetworkTableDoubleArray
Gets a NetworkTableEntry from a Limelight camera as a double array.- Parameters:
tableName- The name of the Limelight set in the UI ("" for default)entryName- Name of the entry to get- Returns:
- double array value of the entry
-
setLimelightNetworkTableDoubleArray
public static void setLimelightNetworkTableDoubleArray(String tableName, String entryName, double[] val) Sets a NetworkTableEntry from a Limelight camera as a double array. If you want to the network table array for a PoseEstimate, use setBotPoseEstimate(PoseEstimate, String), if for the RawFiducials use setRawFiducials(RawFiducial[], String).- Parameters:
tableName- The name of the Limelight set in the UI ("" for default)entryName- Name of the entry to setval- Value to set the entry to
-
getLimelightDoubleArrayEntry
public static edu.wpi.first.networktables.DoubleArrayEntry getLimelightDoubleArrayEntry(String tableName, String entryName) Gets a DoubleArrayEntry from a Limelight camera. This is useful for getting raw pose data.- Parameters:
tableName- The name of the Limelight set in the UI ("" for default)entryName- Name of the entry to get- Returns:
- DoubleArrayEntry for the entry name
-