Hi,
we are trying to use limelight to get distance to april tags, currently we can get a fairly accurate distance to the april tag at the cube node scoring station, but when we try and look at an april tag that would be at the loading zone the distance is way off. We are adjusting for the target height for loading station april tag in code when we try and get distance for the loading station april tag. The mounting angle in both cases is same.
Our formula for getting a distance is (height between the camera and target) / tan(angle that the limelight shows + camera mounting angle) ← the angles are in radians. We got this from the limelight documentation.
Any help and ideas on why this might be the case and how can we fix this?
Apriltags give you 3D pose data that is going to be so much more accurate than using trig. You can extract your desired distance from there using the Limelight Helper library.
There could be several reasons why the distance estimate for the April tag at the loading zone is way off. Here are a few things you can try to troubleshoot the issue:
Verify the target height: Make sure that the height of the April tag at the loading zone is accurately measured and is being used in your distance calculation. Even a small error in the target height can cause a significant error in the distance estimate.
Check for any obstructions: Make sure that there are no obstacles between the camera and the April tag at the loading zone that could be causing the Limelight to misidentify the tag or distort its apparent size.
Verify the mounting angle: Double-check that the camera mounting angle is the same for both the cube node scoring station and the loading zone. Even a small difference in the mounting angle can cause a significant error in the distance estimate.
Check the lighting conditions: The lighting conditions at the loading zone may be different from the cube node scoring station, which could affect the Limelight’s ability to accurately detect and track the April tag. Make sure that the lighting conditions are consistent and optimal for the Limelight.
Experiment with different distance estimation formulas: The formula you are using is based on the assumption that the camera and the target are on the same plane, which may not always be the case. You could try using other distance estimation formulas that take into account the distance between the camera and the target in addition to the angle of the Limelight.
Calibrate the Limelight: If none of the above solutions work, you may need to calibrate the Limelight to ensure that it is accurately detecting and tracking the April tag at the loading zone. This can involve adjusting the camera’s exposure settings, white balance, and other parameters to optimize its performance.
Found some of these through an older post but added some more additional information.