Introducing Limelight Lib
Limelight Lib is a single-file library that makes Limelight easier than ever. With one line of code, you can start using the full JSON output of Limelight to build more versatile software.
All you need to do is copy the file into your robot project.
You don’t need to instantiate any objects to interact with your Limelights. The library is meant to be used in a stateless/functional manner.
Java:
LimelightResults llresults = LimelightHelpers.getLatestResults("");
int numAprilTags = llresults.results.targets_Fiducials.length;
CPP:
LimelightHelpers::LimelightResultsClass llresults = LimelightHelpers::getLatestResults();
int numAprilTags = llresults.targetingResults.FiducialResults.size();
It also has helper functions for all networktables controls
Java
LimelightHelpers.setCropWindow("",-1,1,-1,1);
LimelightHelpers.setLEDMode_ForceBlink("")
double tx = LimelightHelpers.getTX("");
LimelightHelpers.takeSnapshot("","snapshotname");
CPP
LimelightHelpers::setCropWindow("",-1,1,-1,1);
LimelightHelpers::setLEDMode_ForceBlink("")
double tx = LimelightHelpers::getTX("");
Here are the current classes and methods. The naming is currently a bit different for the CPP library:
LimelightTarget_Retro
LimelightTarget_Fiducial
LimelightTarget_Barcode
LimelightTarget_Classifier
LimelightTarget_Detector
Results
LimelightResults
(Pure Static) LimelightHelpers
getLimelightNTTable()
getLimelightNTTableEntry()
getLimelightNTDouble()
setLimelightNTDouble()
setLimelightNTDoubleArray()
getLimelightNTDouleArray()
getLimelightNTString()
getLimelightURLString()
getTX()
getTY()
getTA()
getLatency_Pipeline()
getLatency_Capture()
getCurrentPipelineIndex()
getJsonDump()
getBotpose()
getBotpose_wpiRed()
getBotpose_wpiBlue()
getBotpose_TargetSpace()
getCameraPsoe_TargetSpace()
getTargetPose_CameraSpace()
getTargetPose_RobotSpace()
getTargetColor()
getFiducialID()
getNeuralClassID()
setPipelineIndex()
setLEDMode_PipelineControl()
setLEDMode_ForceOff()
setLEDMode_ForceBlink()
setLEDMode_ForceOn()
setStreamMode_Standard()
setStreamMode_PiPMain()
setStreamMode_PiPSecondary()
setCropWindow()
setPythonScriptData()
getPythonScriptData()
takeSnapshot()
getLatestResults()
Code reviews, PRs, and feature requests are welcome.