Multiple LLs for Localization Updates with LimelightHelpers

I’ve been [slowly] putting together localization code in preparation for next year, but I was wondering if it is possible to use multiple limelights (specifically a 3 and 2+) at once with LimelightHelpers.

If not, would it just be easier to do the math ourselves? We already have the math written out for multicam, just not implemented yet.

Code

1 Like

Yes, we have 4 3Gs so we can always see at least one Tag. It improved our auto consistency and teleop shooting performance significantly.

1 Like

Yes, this is possible pretty easily. All you would have to do is assign each limelight a different hostname in the LL web UI and pass that into the LimelightHelpers method.

LimelightHelpers.getBotPoseEstimate_wpiBlue("hostname")

1 Like

I noticed that there is a hardcoded 0.3s offset for latency for each limelight, but you can get more accurate data by using the cl and tl keys through network tables, or use the LimelightHelper methods:

     double tl = LimelightHelpers.getLatency_Capture(name);
        double cl = LimelightHelpers.getLatency_Pipeline(name);
        double fga = Timer.getFPGATimestamp();
        this.timestamp = fga - tl/1000d - cl/1000d;

it isn’t absolutely necessary but might improve accuracy.

1 Like