View Single Post
  #8   Spotlight this post!  
Unread 27-02-2016, 10:40
SamCarlberg's Avatar
SamCarlberg SamCarlberg is offline
GRIP, WPILib. 2084 alum
AKA: Sam Carlberg
no team
Team Role: Mentor
 
Join Date: Nov 2015
Rookie Year: 2009
Location: MA
Posts: 43
SamCarlberg is a splendid one to beholdSamCarlberg is a splendid one to beholdSamCarlberg is a splendid one to beholdSamCarlberg is a splendid one to beholdSamCarlberg is a splendid one to beholdSamCarlberg is a splendid one to beholdSamCarlberg is a splendid one to behold
Re: Computer Vision Processing - Team 5450

What you need to know to calculate distance from the goal:
  • Height of the camera image
  • Vertical FOV
  • Y-distance from the center of the image to some known point on the goal (such as the center of the U)
  • The distance from that point to the ground
  • The distance from the camera to the ground
  • The angle from the camera to the ground

From these, you can calculate the angle of the target point above the horizontal and the distance from the camera to the target point by constructing a right triangle, with the height difference between the camera and the target image as the vertical leg, and the angle you just found as the angle opposite that leg.

Sorry about the poor formatting, I'm on mobile
__________________
WPILib
GRIP, RobotBuilder