Trouble with CameraToTarget and Robot Pose from PhotonVision

We are trying to get a 3D robot pose of the robot from PhotonVision running on a LL3. Photonvision reports a distance of 2.4 meters from the individual tags and when it does a multi-target estimation, it returns a distance of 2.21 meters. Both of these distances have an error of ± 10 cm as when we measured the actual robot position, we reported a distance of 2.3 meters. (We measured the distance from the speaker’s face to the camera on the X-axis).


1 Like

Here is an example from a farther distance.


The tag distance is reported by 3.77/3.8 meters and the multi-tag pose reported was ~3.67. The actual distance from the speaker to the camera is 3.83 meters.

1 Like

What’s the distance between tags?

15.75 inches between the closest black squares. But the distance between tags shouldn’t affect the CameratoTag distance reported by Photonvision right?

It shouldnt since the horizontal distance is represented by Y.

1 Like

If you’re using multi-target and don’t have the also send single target result option selected, the reported camera to tag transform is calculated as the Transform3d from (field to robot) to (field to tag), not calculated individually. So the tag positioning very much matters in that case, since it changes if (field to robot) is accurately calculated via mulit-tag solvepnp.

See: photonvision/photon-core/src/main/java/org/photonvision/vision/pipeline/AprilTagPipeline.java at 3738e7821b768c1fb3c04e4d56fe8346f9945a54 · PhotonVision/photonvision · GitHub

1 Like

I will recheck the tag position first thing tomorrow. I can’t believe I missed that Y-values being off.

I see, I tried to confirm this by switching from multi-target detection to single target and I noticed that Photonvision reported the same X values (camera to tag transform) regardless of a multi-tag or single tag. Still, in hindsight, the values probably didn’t update due to the latency of changing from multi-tag to single tag.

@thatmattguy @Aperson I reprinted Apriltags and made sure that the distance between April tags was 15.75 inches and it was 53.88 inches off the ground. However I did get the same issue with CameraToTag as 2.61/2.62 meters and Multi-tag pose as 2.41 meters. However when we measured the distance to the speaker face it was 2.5 meters. Looking at the code @thatmattguy linked, why would the multi-tag pose and cameratotag show different X values?

How are you calculating camera to tag, and can you show me more of the math you’re doing? I want to make sure you aren’t mixing up multi-tag pose, which is a transform from field origin to camera origin, with camera to target

The cameratotag I am referring to is just referring to this value:
image

Theory:

does this explain your situation? Or, can you redraw the picture for what you’re measuring and believe to be inaccurate?

Additionally:

They are almost never the same, they don’t measure the same dimension.

So note that if the ambiguity says (in multi tag), that’s the pose estimated like I described above. Tell me a bit more about how you set up your experiment, and why you think measuring the distance you’re measuring right now should correspond to that distance number? Picture is cool. (Note: that camera to tag X is along the ray pointing straight out of the camera, so the camera +X must be perfectly orthogonal to the amp plane for that to be valid)

This makes complete sense, I probably should have looked at the code before assuming what X and Y were supposed to return for the cameratotag.

But this doesn’t explain why this is returning 2.41 meters when the measured distance is 2.5.
image

So I had a misconception about the X meters in cameratotag. But @gerthworm’s picture pretty much explains my experiment. The only issue now is why is Multi-tag pose returning an X of 2.41 meters when it should be 2.5 meters.
image

Ok. Again, without knowing exactly where you’re measuring from/to, it’s going to be difficult to say what the issue is with certanty.

You’re talking about a delta of 9 cm.

Last year, we saw a nominal error of at least 1 or 2 centimeters, even with the best camera and target setup - that’s just usual measurement noise.

On the real field, the tag’s face is offset 3.8cm backward from the origin. Also, it looks like in your image, the plywood surface that the tags are mounted on is not flush with the speaker face, nor does the speaker face go all the way to the ground:

I’m not saying with certainty that this is the issue, but you’re asking about measurements where single-centimeter precision matters, and the evidence you’ve presented so far doesn’t make me feel confident your 2.5 m number was measured with centimeter precision.

Can you go back and be certain that you’ve accurately measured the distance correctly? Apply the following checklist - The length measured must …

  • Be fully in the plane formed by the floor (the floor is a plane, correct?)
  • Start from the plane formed by face of the apriltags
  • End at a point in the floor plane formed from projecting the camera’s sensor center downward into the floor plane
  • Be normal to the plane that is formed by both apriltag faces?

For tags 7 and 8, this distance, minus the 3.8cm offset, should be what photonvision supports (again, +/- a centimeter or two)

1 Like

Thank you!