Limelight not accurate at all when using ComputerVisionUtil functions

The observed distance was 4.3 meters but the limelight gave us 2.3 meters iirc from memory. Why is this? I am sure all of my constants are correct, the limelight is at an offset of a foot to the back, so what am I doing wrong?

double input = ComputerVisionUtil.calculateDistanceToTarget(Constants.limelightHeight, 
    Constants.hubHeight, Units.degreesToRadians(Constants.limelightMountAngle), 
    Units.degreesToRadians(LimeLight.getTy()), Units.degreesToRadians(LimeLight.getTx()));
    SmartDashboard.putNumber("distance to hub", input); //this is inaccurate

You didn’t tell us the context of your aiming. Are you really aiming at the low hub from 4.3 m away?
edit: Sorry. You can aim at anything you want that’s 43 inches off the ground but that’s a pretty flat shoot from a shooter that’s probably about 25 inches off the ground. Are you sure you aimed right?

Is there even retro-reflective tape at the low hub? I don’t remember any.>

public static final double hubHeight = Units.inchesToMeters(43);//2.6416;

the opening of the UPPER HUB is 8 ft. 8 in. (~264 cm)
lower hub 3 ft 5 in (~104 cm)
I see in the game manual there is vision tape only on the upper hub so I don’t know what you expect LL to see at 43 inches up. Looks like a miscommunications on using heights.

The UPPER HUB is marked with a single 360° vision target consisting of 5 in. (~13 cm) long strips of 2 in.
(~5 cm) wide 3M 8830 Scotchlite™ Reflective Material

1 Like

I don’t see any outright errors in your code, although I can’t see how your limelight is configured. To debug this, I’d want to gather data of reported tx and ty for a range of field positions.

One confounding detail is that the Rapid React target is a horizontal ring, of which you can probably see about one third, barring occlusions. Are you finding the centre of the bounding box? We found that the top of the bounding box was the best predictor of distance.

The problem was my actual degree mount on my limelight wasn’t what it was in cad

3 Likes

If you use iOS, the built-in “Measure” app has a level function that can tell angle of elevation. Super helpful for this.

2 Likes

I use photonvision, and I’ve found photonvision’s distance to target method to be more reliable than the measure app.

I wasn’t talking about getting the distance to target, I’m talking about getting camera pitch. The Level function looks like this. I put it up against my camera and it tells me angle away from the horizontal. Recently our camera mount was bent in a match, so I used this to check if the pit crew got it back to the right degree.

2 Likes

oh that’s cool. our camera was on a fixed mount installed onto the robot frame so it wouldn’t budge. We just adjusted our shooter hood using a pneumatic piston so the 2 positions don’t mess up. Ours was a simple and robust design. We did have to do a little bit of trig to find our best shooting distance from each angle though.

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