photonvision
photonvision copied to clipboard
`PhotonUtils.calculateDistanceToTargetMeters` should incorporate yaw
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.
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 .