Find angle of vision target relative to field

Hey, we were wondering how you guys plan to drive autonomously to this year’s vision target.
The biggest issue we found is finding the angle in relation to the field in order to adjust the robot and generate paths that end with the robot being in front of the target and not at an angle to it, Since the target might be at the center of the image but still at an angle related to the field itself.
We saw a few posts about using cv2.solvePnP but it seems like a very complex solution so we were wondering if any of you found a good, relatively reliable and simple solution to this problem.


cv2.solvePnP() is likely going to be the most reliable solution. There are several other options, though, including calculating the ratio of the areas of the two pieces of tape and fitting a function to it using known angles. We’ve never tried that, but the ratio should be pretty similar at a angle, regardless of distance. However, at that point, you probably already have almost everything you need to run solvePnP(), and I’d recommend checking that out if you have time.

The LigerBots (2877) have some really nice code that you can check out for reference on solvePnP():