View Single Post
  #9   Spotlight this post!  
Unread 07-19-2017, 08:53 PM
BenBernard's Avatar
BenBernard BenBernard is offline
Programming and Controls Mentor
FRC #5687 (The Outliers)
Team Role: Mentor
 
Join Date: Jan 2016
Rookie Year: 2015
Location: Portland, ME
Posts: 80
BenBernard is on a distinguished road
Re: Angle of bot in relation to peg

Quote:
Originally Posted by MuskieProgramme View Post
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.
Reply With Quote