Originally Posted by MuskieProgramme
Such as were, precisely, your robot is.
I read the original request as looking for the angle between the centerline of the robot and the centerline of the peg, for which you need to know your robot's field-relative angle, but not where precisely it is. If your gyro is telling you you are at 66deg relative to your starting position (which in this game is most likely parallel with the field) then you know you are at 6deg relative to the left peg, 66deg relative to the center peg, and 126% relative to the right peg. If you can SEE a peg, then odds are very high it's the left peg--since few camera have a FOV that would allow them to see an object at 66deg or 126deg.
Now, if the OP was not looking for the robot's angle relative to the peg, but rather the offset angle of the center of the vision targets from the robot, that's a different set of math--that's available in countless CD threads and in many teams' open-sourced vision code. Our function for that (getAngle) is available in our github
One of the best resources on vision is 254's intro