Getting Limelight Setup

I am in the process of getting the limelight setup for distance tracking, however I am stuck. Apparently there is a library or what some have called a wrapper that you need to get setup to call some commands from. However so matter what I try I cant find anything to get it into the project. One thing said to add some lines to the build.gradle file, but on a previous project that our old programmer did has the limelight stuff in the file, but nothing is changed in the build.gradle so I’m lost.

2 Likes

The best thing to start with is the docs:
https://docs.limelightvision.io/en/latest/

If these fail you, post the code that didn’t work. Long distance troubleshooting is a little bit difficult.

There is no premade wrapper, some teams create there own for convenience, but it’s not absolutely necessary to get going.

I am able to get the Camera displayed to dashboard, but I am trying to get this installed. Library
From a separate topic, I was shown a command to estimate distance, however it requires a function that is found in that library, and I have no idea how to get that set up. The function I need is the getdegVerticaltoTarget.

So this is a teams repository that they shared. 3244 is a great team. Have you read their readme file? They told you what to do with your build.gradle file.

With that said, you could just copy their limelight class file to your project as well.

2 Likes

I’ve tried doing what it says, but I have not done any maven or gradle work so I do not know how to do what it says. Our old programmer left so I’m trying to learn everything from scratch. This is the template I am building off of. It does not have an allprojects section, so do I create one, or just add both of those lines into the dependencies?
With that said, by copy, what do you mean? The project I am referencing is our old infinite recharge stuff and it has a whole new folder outside of the frc stuff so do I just copy paste that file directly over and let the maven/gradle stuff do all the rest?

If you really want to learn from scratch, I would highly suggest you read through the limelight website, I posted above, and cross-reference with the library you linked above.

Here are my reasons why:

  • Too long-distance troubleshoot this may get quite frustrating
  • It’ll be more rewarding if you just go through the docs to understand the intricacies of communicating with the limelight
  • 3244 WAS a great team, I believe they are on hold this year while they fix coaching issues, meanwhile their code goes untouched for 3 years
  • Bring in other teammates, to the website to MATH out how to get distance from the pixels your limelight gives you

With that said, I’m not your coach, so I don’t mind telling you how to copy the 3244 library dependency you mentioned above:
Assuming you’re using java, you should ALREADY have a build.gradle file in your project. Open it up.
Find where it says repositories in the file. if you can’t find it, you can create the line "repositories { } "
In those brackets, ur gonna put what they told you below.

next find the dependencies line. repeat the same steps as above, copy pasting what the say to copy paste into your build.gradle file.

save it. right click it, build it (make sure ur connected to internet)
image

The distance can be calculated with the ta limelight value. This is the target area, so after that, just do some calculations and boom, you’ve got a distance formula.

1 Like

my code from last season doesn’t use distance as a factor in aiming, but if you go to my 2020 code and look for the rotate to target command and the vision subsystem, you can see how the networktable entries from the limelight can be used.

2 Likes

Note that using area to estimate distance is much less reliable than using the formula for a fixed angle camera.

I am the developer of that library. How can I help?

it is possible the instruction don’t work with the new Versions of Gradle.

You can copy and paste the oi folder to your project from here https://github.com/GraniteCityGearheads3244/2019_Jupiter/tree/master/src/main/java

I have wanted to return to this and create a better repo but there is always another project to work on.

Sorry for the late reply, but thank you for all of the resources and info. I’ve been able to piece together the general concept of how everything works, so later today when I get working on it again I will update this with any follow-up questions that have stumped me. Once again, thank you, this really helped me out.

Update**

If you use PhotonVison there is a method in the photonlib that calculates distance and returns it as a double for you if you provide the camera’s height (in meters), pitch (aka tilt, in radians), and the target’s height (in meters). This entry in the PhotonLib Docs explains some more.

This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.