EasyLimelight
EasyLimelight wraps the Limelight 3A. The camera does the processing, so your robot only reads results. It supports ball detection, AprilTags and robot pose, and exposes pipeline control, snapshots and diagnostics.
#Creating an EasyLimelight
EasyLimelight limelight = new EasyLimelight(hardwareMap, "limelight")
.setMount(10, 30, DistanceUnit.INCH)
.setPipeline(0);
limelight.start();The optional third constructor argument sets the poll rate in hertz. Call update() every loop:
limelight.update();
if (limelight.hasTag(20)) {
double age = limelight.getAgeMs();
}#Lifecycle
start(),stop(),pause(),resume(): control the camera.update(): reads the latest result.isRunning(),isConnected(): state of the camera and of the USB connection.setPollRateHz(rate),setMaxResultAgeMs(ms): how often to poll and how old a result may be.
#Balls
hasBall(),getBallCount(): whether there is a ball and how many.getBallTx(),getBallTy(),getBallTa(): horizontal angle, vertical angle and area from the Limelight.getBallX(),getBallY(),getBallSize(): position and size in the image.getBallClass(): the class name of the detection.setBallFilter(text): only uses detections whose class contains the text.getBallDistance(unit): the estimated distance. It needssetMount().setMount(height, pitchDownDegrees, unit): the height of the camera and how far it points down.
#Aiming
getAimError(), getAimPower(), isAligned(), setAimGain, setAimDeadband, setAimTolerance, setAimMaxPower and setAimDirection work as described in the Vision tab.
#AprilTags
hasTag(),hasTag(id): whether any tag, or a specific tag, is visible.getTags(): all visible tags.getTag(id): one tag by id.
#Robot Pose
getBotpose(): the pose from MegaTag 1.getBotposeMT2(): the pose from MegaTag 2.getBotposeTagCount(): how many tags were used.updateRobotOrientation(yawDegrees): gives the camera the robot heading.
#MegaTag 1 and MegaTag 2
MegaTag 2 is more stable, but it is only valid when the Limelight knows the heading of the robot. Call updateRobotOrientation(yaw) with the IMU heading on every loop, then read getBotposeMT2(). Without that call the MegaTag 2 pose is wrong.
The dashboard shows the pose from getBotpose(), which is MegaTag 1.
#Pipelines and Diagnostics
setPipeline(index),getPipeline(),reloadPipeline(): choose and reload a pipeline.setPythonInputs(...),getPythonOutput(): exchange numbers with a Python pipeline.getAgeMs(),getLatencyMs(),getFps(),getTemp(): result age, latency, frame rate and temperature.captureSnapshot(name),deleteSnapshots(): save and delete snapshots on the camera.addTelemetry(telemetry),getDevice(): telemetry helper and the underlying Limelight3A.
Última actualización 2026-11-16