photonvision icon indicating copy to clipboard operation
photonvision copied to clipboard

`PhotonUtils.calculateDistanceToTargetMeters` should incorporate yaw

Open pjreiniger opened this issue 1 year ago • 1 comments

Describe the bug The distance calculation helper function should probably include yaw. During the brief time that wpilib had an equivalent function, it incorporated yaw.

I found this in simulating detecting a game piece with the new simulator. It appears that that factors yaw in, so if the util function is correct, the sim calculation is incorrect.

I started to do this myself but it has a couple tendrils, so I wanted to make sure it was the right path before digging further.

pjreiniger avatar Jan 26 '24 05:01 pjreiniger

Couldn't you just use the PhotonUtils#estimateCameraToTargetTranslation function? It takes in the distance to the target and the target yaw and returns an adjusted Translation2d .

gautvm avatar Jan 29 '24 22:01 gautvm