How LimelightLib communicates with your Limelight camera over NetworkTables.
LimelightLib uses WPILib’s NetworkTables to communicate with Limelight cameras over the robot network. Every public method in LimelightHelpers takes a limelightName string parameter that maps directly to the NetworkTables table name.
Pass the name you configured in the Limelight web UI — for example, "limelight", "limelight-front", or "limelight-back". Passing "" or null defaults to "limelight":
// From LimelightHelpers.javastatic final String sanitizeName(String name) { if ("".equals(name) || name == null) { return "limelight"; } return name;}
When using multiple cameras, always pass the full hostname you assigned in the Limelight web UI (e.g., "limelight-front", "limelight-back"). This maps directly to the NetworkTables table name and keeps data from each camera separate.
The library caches DoubleArrayEntry objects in a ConcurrentHashMap keyed by "tableName/entryName". Entries are created once on first access and reused on every subsequent call, which avoids the overhead of repeated NT lookups:
LimelightHelpers.Flush() calls NetworkTableInstance.getDefault().flush() to force queued writes to be sent immediately. The library calls this automatically inside SetRobotOrientation() to ensure the camera receives the latest robot heading before the next MegaTag2 solve:
public static void Flush() { NetworkTableInstance.getDefault().flush();}
If you are calling SetRobotOrientation() at high frequency and do not want to flush on every call, use SetRobotOrientation_NoFlush() instead and flush manually at the end of your control loop.
You can read from NetworkTables directly, but LimelightHelpers handles name sanitization, type defaults, and entry caching for you.
// Reads "tx" from the "limelight-front" tabledouble tx = LimelightHelpers.getTX("limelight-front");// Reads "tv" and returns a booleanboolean hasTarget = LimelightHelpers.getTV("limelight-front");// Writes the pipeline indexLimelightHelpers.setPipelineIndex("limelight-front", 2);